Telegram bot 需要 @ 才能在另一个机器人发送消息后接收命令

时间:2021-06-09 15:31:39

标签: telegram telegram-bot

我正在与多个机器人进行群聊。

第一个可以访问所有消息,并侦听 keyword。当聊天消息包含 keyword 时,它会发送一条消息。例如:

[Navigatron]: This message contains the keyword
[Keyword Bot]: Hello World!

第二个机器人无法访问所有消息,而是侦听命令 /r/r@botname。发生这种情况时,它会发送一个随机报价。

[Navigatron]: /r
[Quote bot]: Hello World!

每当关键字机器人发送消息时,报价机器人就会停止响应 /r 命令。它仍然会响应 /r@botname 命令,然后会再次响应 /r 命令。

其他机器人也停止响应简短命令。使用 /command@bot“唤醒”一个机器人不会“唤醒”任何其他机器人。

例如:(以#开头的行是注释)

# Short commands work
[Navigatron]: /command1
[Bot 1]: Output 1
# Triggering the keyword bot
[Navigatron]: This message contains the keyword
[Keyword bot]: Hello world!
# Short commands no longer work
[Navigatron]: /command1
[Navigatron]: /command2
# Using a "long" command "wakes up" only one bot
[Navigatron]: /command1@bot1
[Bot 1]: Output 1
[Navigatron]: /command1
[Bot 1]: Output 1
[Navigatron]: /command2
# Each additional bot must be "woken up" individually
[Navigatron]: /command2@bot2
[Bot 2]: Output 2
[Navigatron]: /command2
[Bot 2]: Output 2

我希望/希望所有非关键字机器人继续响应短命令,即使在关键字机器人发送消息之后也是如此。

频道中有 6 个机器人。我是其中一些的作者。有些使用nodejs,有些使用python,有些使用webhooks,有些使用轮询——关键字bot“破坏”了所有这些。出于这个原因,我怀疑这不是任何单个机器人的问题,而可能是电报本身的问题。

0 个答案:

没有答案