Advertisement
darkor

error polling

Oct 23rd, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.47 KB | None | 0 0
  1. import telebot
  2. import constants
  3. from telebot import types
  4. import timetable
  5. bot = telebot.TeleBot(constants.test_token)
  6. print(bot.get_me())
  7.  
  8. @bot.message_handler(commands=['start'])
  9. def hundle_start(message):
  10.     bot.send_message(message.chat.id,'Hi!')
  11.  
  12. @bot.message_handler(content_types=["text"])
  13. def any_msg(message):
  14.     keyboard = types.InlineKeyboardMarkup()
  15.     callback_button_0 = types.InlineKeyboardButton(text='Понеділок', callback_data='Понеділок')
  16.     callback_button_1 = types.InlineKeyboardButton(text='Вівторок', callback_data='Вівторок')
  17.     callback_button_2 = types.InlineKeyboardButton(text='Середа', callback_data='Середа')
  18.     callback_button_3 = types.InlineKeyboardButton(text='Четвер', callback_data='Четвер')
  19.     callback_button_4 = types.InlineKeyboardButton(text="П'ятниця", callback_data="П'ятниця")
  20.     keyboard.add(callback_button_0, callback_button_1, callback_button_2, callback_button_3, callback_button_4)
  21.     bot.send_message(message.chat.id, "Виберіть день тижня:", reply_markup=keyboard)
  22.  
  23. @bot.callback_query_handler(func=lambda call: True)
  24. def inline(call):
  25.     if call.message:
  26.         if call.data == 'Понеділок':
  27.             if call.data in timetable.time_table_chuselnuk_none:
  28.                 bot.send_message(call.message.from_user.id, timetable.time_table_chuselnuk_none[f'{callback.data}']
  29.  
  30. bot.polling(none_stop=True, interval=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement