在电报聊天中客户按下内联键盘按钮后我如何执行某些功能

how i can do some function after client's push inline keyboard button in telegram chat

在电报聊天中按下内联键盘按钮后我需要执行一些功能(例如发送图片或使用一些 api 并从 api 发送 json)。在 telegram-bot-api 的文档中我找不到我应该做什么。

def button(update, context):
    query = update.callback_query
    if query.data == '1':
        updater.dispatcher.add_handler(CommandHandler('', get_pic))
    elif query.data == '2':
        query.edit_message_text(text="Mosc".format(query.data))
    elif query.data == '3':
        query.edit_message_text(text="SaintP".format(query.data))

我希望电报聊天的第一个 'if' 用户可以看到 'get_pic' 功能

在我的例子中,点击 mp3 InlineButton 后调用我的函数实际上你有很多选择要做

try:  
    data = update.callback_query.data
    link = cache.get(f'{user_id}_link')
    if data == 'Mp3':
        bot.send_message(user_id, WAITING)
        bot.send_chat_action(user_id, action=telegram.ChatAction.FIND_LOCATION)
        download_send_youtube(link, user_id, bot, 'mp3') # my function
        return "youtube"
except AttributeError:
    pass