bot.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:MusicBot 作者: BjoernPetersen 项目源码 文件源码
def send_callback_keyboard(self, bot, chat_id, text, buttons, action=None):
        keyboard = []
        for button in buttons:
            keyboard.append([button])
        keyboard.append([InlineKeyboardButton("cancel", callback_data="null")])

        markup = InlineKeyboardMarkup(keyboard)

        try:
            message_id = self._sent_keyboard_message_ids[chat_id]
            message = bot.edit_message_text(chat_id=chat_id, message_id=message_id, text=text, reply_markup=markup)
        except KeyError:
            message = bot.send_message(chat_id=chat_id, text=text, reply_markup=markup)

        self._sent_keyboard_message_ids[chat_id] = message.message_id

        if action:
            self._sent_keyboard[chat_id] = action
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号