From f491c8be419b9d34bf8dbdb51b586d8fec69cd1e Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 12 Nov 2024 21:31:25 +0100 Subject: [PATCH] fix(bot): normalize mention case for command handling Ensure that the bot commands are recognized regardless of the letter casing of the mention. This improves command compatibility and user experience by allowing flexibility in how the bot is invoked. Prior to this change, commands were case-sensitive, potentially leading to inconsistencies in command recognition. --- src/matrix_applicationbot/classes/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix_applicationbot/classes/bot.py b/src/matrix_applicationbot/classes/bot.py index 9ba5f67..f3b6ead 100644 --- a/src/matrix_applicationbot/classes/bot.py +++ b/src/matrix_applicationbot/classes/bot.py @@ -64,7 +64,7 @@ class ApplicationBot: body = event.body if hasattr(event, "body") else None if body: - mention = body.split()[0] + mention = body.split()[0].lower() if mention == "!applicationbot" or mention in self.username: return await self.handle_command(room, sender, body.split(" ", 1)[1])