ESN-Trondheim / ESNbot

A Slack bot for ESN Trondheim
MIT License
3 stars 1 forks source link

Tagging the bot will send the bot into an infinite loop #56

Closed LaiAlexander closed 10 months ago

LaiAlexander commented 10 months ago

When tagging the bot without further commands, the bot should respond with

@username
You tagged me! Try @esnbot list to get started. 

This happens correctly, but in the console you can see that the bot is stuck in an infinite loop.

Bot is tagged
(...)

30-10-2023 21:29:07: Command used was '`list`'
(...)

30-10-2023 21:29:08: Command used was 'i'm'
(...)

30-10-2023 21:29:09: Command used was 'i'm'
(...)

30-10-2023 21:29:12: Command used was 'i'm'
(...)

30-10-2023 21:29:13: Command used was 'i'm'
(...)

30-10-2023 21:29:14: Command used was 'i'm'
(...)

30-10-2023 21:29:16: Command used was 'i'm'
(...)

30-10-2023 21:29:17: Command used was 'i'm'
(...)

30-10-2023 21:29:18: Command used was 'i'm'
(...)

30-10-2023 21:29:19: Command used was 'i'm'

I'm guessing that the command "i'm" comes from this code snippet: https://github.com/ESN-Trondheim/ESNbot/blob/a61b463a083d6a47716524bb994258680b1f42ec/esnbot/main.py#L147C1-L163C60

My guess is that the bot is trying to respond to the self tagging from the initial comment, and then trying to respond to each ephemeral message after that, but that isn't shown in chat.

I'm 90% sure this has been a bug in the past, that was fixed at some point. Either it's been reintroduced, or it was never fixed in the first place.

Edit: Same issue with help and watermark commands it seems, should check the rest of the commands as well.