If I filter a command using something like filters.command(["my_command"]
, in groups the bot gets notified when I execute the command /my_command
, but if I address it to the bot (e.g. /my_command@MyBot
) it won't get notified.
How can I modify the filter to get notified in both cases (independently on the bot name)?
Thanks
use regex
with app:
bot_username = app.get_me().username
@app.on_message( filters.regex(f'^/my_command($|@{bot_username}$)') )
def handler( client, message ):
pass