When using pyTelegramBotAPI, we can register a command using the decorator @bot.message_handler(commands=['help']). Let's say our bot has a username @example_bot, and this handler responds to the commands /help, /help@example_bot, which is correct. However, it also responds to the command /help@another_bot, which is incorrect.


Currently, the boilerplate code below is used to solve the problem, but it is obvious that it should be solved at the API level.
@bot.message_handler(commands=['help'])
def help_msg(message):
if not bot_name_checker(message):
return
def bot_name_checker(message):
cmd_text = message.text.split()[0]
if f"@{utils.bot.get_me().username}" in cmd_text or not "@" in cmd_text:
return True
else:
return False