JIITODC / bot

JIITODC's very own telegram bot!
MIT License
6 stars 10 forks source link

[good-first-issue] Respond to commands only when mentioned #15

Closed DelusionalOptimist closed 3 years ago

DelusionalOptimist commented 3 years ago

Summary Right now the bot responds to any command followed by /. This may create conflicts if there are multiple bots in the group and a given command is not meant for this bot. So the bot should respond only when it is addressed. E.g: /command@bot_name

Implementation A possible way to implement this is using regular expressions. We can add regex filters in CommandHandlers. https://github.com/JIITODC/bot/blob/22302be3e738a49ec22da6be882a50f16376a292/bot.py#L54 Here is a brief documentation on the regex filter that the python-telegram-bot api wrapper provides: https://python-telegram-bot.readthedocs.io/en/stable/telegram.ext.filters.html#telegram.ext.filters.Filters.regex

Lastly, a little guide on regular expressions: https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285

Alternatives Do suggest in the comments if you have some other approach in mind. :smiley:

If this is your first time contributing Hey! :wave: If you're interested to work on this issue, do comment, "I would like to work on this issue. Please assign this to me.", below to let others know that you're interested in working on this. Also, do take a look at the contributing guide which will take you step by step from forking this repo to creating a pull request :rocket: :fire:. We use the python-telegram-bot api wrapper. Here is a link to its documentation: https://python-telegram-bot.readthedocs.io/en/stable/index.html Feel free to ask anything related to this issue :hugs:

Abjcodes commented 3 years ago

Hey @DelusionalOptimist, Can I take up this issue?

rexagod commented 3 years ago

Go ahead, @Abjcodes! šŸ‘šŸ»

Abjcodes commented 3 years ago

@DelusionalOptimist @rexagod Please review the PR and notify me if there are any changes to be made.