-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Closed
🐛 bug
Copy link
Description
Steps to reproduce
- Get a bot, turn off privacy option in
@botfather
, and drag it in a group with other bots (which should respond to/start
command in a group). - Set up the bot with the following code:
import telegram, telegram.ext
tb = telegram.ext.Updater("TOKEN")
def a(bot, update):
bot.sendMessage(update.message.chat_id, "responding to /start cmd")
tb.dispatcher.add_handler(telegram.ext.CommandHandler("start", b))
tb.start_polling()
- Send command
/start@some_other_bot
to the group, and your bot will respond to it. - Send command
/start
to the group and your bot (and in fact many other bots) will respond to it too.
Expected behaviour
Bot should not respond to cmds not pointing to it, and better give an option not to respond to cmd with no target in a group.
Configuration
Operating System:
Mac OS X El Capitan
Version of Python:
$ python3 -V
Python 3.5.1
Version of python-telegram-bot:
$ python3 -c 'import telegram; print(telegram.__version__)'
4.1.1
Logs
Insert logs here (if necessary)
Where the issue happens
update.message.text[1:].split(' ')[0].split('@')[0] == self.command
on line 45 of telegram/ext/commandhandler.py
It is not checking for the target of command issued by user.
Suggested changes
- Check for commands with
@
for whether it's pointed to the bot. - Add a parameter to
CommandHandler
: toggle whether if the bot should respond to simple commands (command without@name_of_the_bot
) in a group, and default it to True. (for backward compatibility, and behaviour consistancy)