Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HELP = range(1)
- def start(bot, update):
- keyboard = [
- [InlineKeyboardButton('Help', callback_data='help')]
- ]
- # Create initial message:
- message = 'Welcome.'
- update.message.reply_text(message, reply_markup=InlineKeyboardMarkup(keyboard))
- def help(bot, update):
- keyboard = [
- [InlineKeyboardButton('Help', callback_data='help')]
- ]
- bot.edit_message_text(
- text='Help ... help..',
- chat_id=update.callback_query.message.chat_id,
- message_id=update.callback_query.message.message_id,
- reply_markup=InlineKeyboardMarkup(keyboard)
- )
- bot.answer_callback_query(update.callback_query.id, text='')
- def unknown(bot, update):
- message = 'Please press the Help button for more instructions.'
- keyboard = [
- [InlineKeyboardButton('Help', callback_data='help')]
- ]
- update.message.reply_text(message, reply_markup=InlineKeyboardMarkup(keyboard))
- # Create the EventHandler and pass it your bot's token.
- updater = Updater(token=config.TELEGRAM_API_TOKEN)
- # Get the dispatcher to register handlers:
- dispatcher = updater.dispatcher
- dispatcher.add_handler(CommandHandler('start', start))
- dispatcher.add_handler(CallbackQueryHandler(help, pattern='help'))
- dispatcher.add_handler(MessageHandler(Filters.all, unknown))
- updater.start_polling()
- updater.idle()
- sent_message = update.message.reply_text(
- message,
- reply_markup=InlineKeyboardMarkup(keyboard)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement