def call_handler(bot, update):
""" https://stackoverflow.com/questions/39121678/updating-messages-with-inline-keyboards-using-callback-queries """
if update.callback_query.data == 'update_taxi':
bot.answerCallbackQuery(callback_query_id=update.callback_query.id,
text="Refreshing Promo Codes...")
text_ = "<b>:black_large_square:List of Uber Promo Codes (Latest on Top)</b> \n\n"
text_ += promo.get_code(1, smart=True)
text_ += "\n<b>:white_check_mark:List of Grab Promo Codes (Latest on Top)</b> \n\n"
text_ += promo.get_code(0, smart=True)
text_ += "\n :repeat:Last Update: " + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
# Update Feature with Inline Keyboard
promo_keyboard = InlineKeyboardButton(text="Update!", callback_data="update_taxi")
custom_keyboard = [[promo_keyboard]]
reply_markup = InlineKeyboardMarkup(custom_keyboard)
bot.editMessageText(
message_id=update.callback_query.message.message_id,
chat_id=update.callback_query.message.chat.id,
text=emojize(text_, use_aliases=True),
parse_mode='HTML',
reply_markup=reply_markup
)
评论列表
文章目录