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
2
Answers
You’ll need to pass each option to
filter.commands
, including the variants with the bot name.If you’re looking for a more dynamic solution, you can use something like
That will loop over a list of commands, and the same command with the bot name attached.
For even more copy/paste logic, you can retrieve the bot name from
pyrogram
itself.If we take a look at Pyrogram’s
User
class; we’ll see the following data:[Link to documentation]
This seems like a perfect fit to automate the
myBot
variable in my example above.use regex