-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (23 loc) · 1.12 KB
/
main.py
File metadata and controls
26 lines (23 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import random
import telebot
import config
from telebot import types
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.send_message(message.chat.id, "Привет, {0.first_name}!\nЯ - пока что тупой бот, но что-то умею".format(message.from_user, bot.get_me()))
murkup = types.ReplyKeyboardMarkup(resize_keyboard=False)
item1 = types.KeyboardButton("Рандомное число")
item2 = types.KeyboardButton("Как у тебя дела?")
murkup.add(item1, item2)
bot.send_message(message.chat.id, "А ну ка, тыкни на кнпочку", parse_mode='html', reply_markup=murkup)
@bot.message_handler(content_types=['text'])
def knopki(message):
if message.chat.type == 'private':
if message.text == 'Рандомное число':
bot.send_message(message.chat.id, str(random.randint(0, 100)))
elif message.text == 'Как у тебя дела?':
bot.send_message(message.chat.id, "Лучше всех!!!")
else:
bot.send_message(message.chat.id, "Моя твоя не понимать")
bot.polling( none_stop=True )