我正在使用该库在 python 中开发一个小机器人,python-telegram-bot但遇到了一个小问题:
我有一个InlineKeyboardButton带有参数的switch_inline_query_current_chat,所以当用户点击它时,一个命令会自动写入它的聊天中。
但是,该命令之前提到了机器人(带有@)。
问题是我的机器人在这种情况下没有回答,我不知道为什么..
有没有一种解决方案可以使按钮不在命令之前提到机器人?
来自@BotFather组被允许并且隐私组被关闭。
十分感谢
编辑:这是 CommandHandler 的代码:
def getEntry(update, context):
if not (is_allowed_user(update.message.from_user.username, 'getEntry')):
context.bot.send_message(chat_id=update.effective_chat.id,
text='Who the hell are you @' + update.message.from_user.username + ' ?')
return
search = ' '.join(context.args)
infos, err = get_infos_people(search)
if err is not None:
context.bot.send_message(chat_id=update.effective_chat.id, text=err)
return
context.bot.send_message(chat_id=update.effective_chat.id, text=beautify_infos(infos),
parse_mode=ParseMode.MARKDOWN, reply_markup=getMainKeyboard(infos))
get_handler = CommandHandler('get', getEntry, filters=~Filters.update.edited_message)
这是按钮的代码:
def getMainKeyboard(infos):
keyboard = [InlineKeyboardButton("modify",
switch_inline_query_current_chat="/get " + infos[0] + "<write here>")]]
return InlineKeyboardMarkup(keyboard)