1

我有一个电报机器人,我正在尝试向它添加一些我认为通过添加更多CommandHandler. 新功能在个人聊天中运行良好,但在群聊中不起作用。我对此感到困惑。

我的代码如下

def func1(bot, update):
    <somecode>


def func2(bot, update, args):
    <somecode>

def error(bot, update, error):
    <errorhandler>

def newfunc(bot, update, args):
    <newcode>


dispatcher.add_handler(CommandHandler('func1', func1))
dispatcher.add_handler(CommandHandler('func2', func2, pass_args=True))
dispatcher.add_handler(CommandHandler('newfunc', newfunc, pass_args=True))
dispatcher.add_error_handler(error)

和工作正常func1func2他们以前在那里,但新newfunc的在群聊中不起作用。

我不知道是什么原因造成的

4

1 回答 1

0

我解决了这个问题。

update.message.reply_text在代码中有响应文本,newfunc但机器人处于隐私模式。

简单的解决方案是关闭隐私模式,以便它可以访问消息

于 2018-06-09T08:53:04.043 回答