Python 如何更改电报中的内联bot处理程序
我遵循并创建了一个电报机器人。我启用了内联模式并使用以下代码创建了内联查询处理程序:Python 如何更改电报中的内联bot处理程序,python,bots,telegram,telegram-bot,python-telegram-bot,Python,Bots,Telegram,Telegram Bot,Python Telegram Bot,我遵循并创建了一个电报机器人。我启用了内联模式并使用以下代码创建了内联查询处理程序: from telegram import InlineQueryResultArticle, InputTextMessageContent def inline_caps(update, context): query = update.inline_query.query if not query: return results = list() result
from telegram import InlineQueryResultArticle, InputTextMessageContent
def inline_caps(update, context):
query = update.inline_query.query
if not query:
return
results = list()
results.append(
InlineQueryResultArticle(
id=query.upper(),
title='Caps',
input_message_content=InputTextMessageContent(query.upper())
)
)
context.bot.answer_inline_query(update.inline_query.id, results)
from telegram.ext import InlineQueryHandler
inline_caps_handler = InlineQueryHandler(inline_caps)
dispatcher.add_handler(inline_caps_handler)
我多次尝试更改此内联查询处理程序,但都没有效果。这不起作用:
调度程序(内联caps处理程序)
我还尝试禁用内联模式,然后使用BotFather再次启用它,但在重新激活内联模式的站点中,旧的处理程序仍然保持不变
创建一个新的处理程序并添加它也不起作用。您是否再次尝试过它 我遵循了教程(直到“dispatcher.add_handler(inline_caps_handler)”),它没有给我任何问题。 玩完大写之后,我做了dispatcher.remove_处理程序(inline_caps_处理程序),它停止将我写的单词转换为大写。然后我添加了另一个处理程序(一个小写的转换器)并更新了bot 下面是我在Python交互式shell中运行的示例(与教程非常相似,但删去了非内联内容): 在完成测试之后
updater.stop()
updater.stop()