-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebify_Tele_Bot.py
More file actions
27 lines (21 loc) · 1.22 KB
/
Copy pathWebify_Tele_Bot.py
File metadata and controls
27 lines (21 loc) · 1.22 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
27
import telebot
from telebot import types
bot = telebot.TeleBot('5861935603:AAHIJlSDAEzcT0f9CVd_Onapzkb4EyCLdxM')
@bot.message_handler(commands=['start'])
def start(mes):
bot.send_message(mes.chat.id, "Привет! \n функции: \n /start - начать \n /send_application - отправить заявку")
@bot.message_handler(commands=['send_application'])
def send_application(mes):
global application;
while application == '': #проверяем что возраст изменился
try:
application = int(mes.text) #проверяем, что возраст введен корректно
except Exception:
bot.send_message(mes.from_user.id, 'Цифрами, пожалуйста');
keyboard = types.InlineKeyboardMarkup(); #наша клавиатура
key_yes = types.InlineKeyboardButton(text='Да', callback_data='yes'); #кнопка «Да»
keyboard.add(key_yes); #добавляем кнопку в клавиатуру
key_no= types.InlineKeyboardButton(text='Нет', callback_data='no');
keyboard.add(key_no);
bot.send_message(mes.from_user.id, "", reply_markup=keyboard)
bot.polling()