serenity-rs / poise

Discord bot command framework for serenity, with advanced features like edit tracking and flexible argument parsing
MIT License
597 stars 106 forks source link

Fix bug causing bot to reply to its own messages in event_handler example #251

Closed Spacerulerwill closed 4 months ago

Spacerulerwill commented 4 months ago

In the event_handler example, sending message containing the word "poise" would cause the bot to reply with the message "Poise has been mentioned {n} times" like expected. However, since the bot's message itself contained the word "poise", it would continually reply to itself.

I fixed it by adding a simple check to test the message_author's id against the bot's user id.

kangalio commented 4 months ago

Thank you! The CI is still failing, but then we can merge

Spacerulerwill commented 4 months ago

I have formatted the file properly with rustfmt and have ammended my commit