doubledare704

Untitled

Mar 12th, 2021 (edited)
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. import telebot
  2. import random
  3.  
  4.  
  5. bot = telebot.TeleBot('TOKEN')
  6.  
  7.  
  8. @bot.message_handler(commands=['start'])
  9. def welcome_start(message):
  10.     bot.send_message(message.chat.id, 'Угадай число от 0 до 10!' '\n'
  11.     'Какое число?')
  12.  
  13. a = (random.randint(0, 10))
  14.  
  15. @bot.message_handler(content_types=['text'])
  16. def text(message):
  17.     if int(message.text) == a:
  18.         bot.send_message(message.chat.id, 'Верно!')
  19.         a = (random.randint(0, 10))
  20.     elif int(message.text) > a:
  21.         bot.send_message(message.chat.id, 'Меньше!')
  22.     elif int(message.text) < a:
  23.         bot.send_message(message.chat.id, 'Больше!')
  24.  
  25. bot.polling()
  26.  
Add Comment
Please, Sign In to add comment