fix(bot): ensure correct username parsing for mentions

Adjusted mention handling logic to split the username at the colon, ensuring correct comparison for command processing. This prevents false positives when the username contains additional information post-colon.
This commit is contained in:
Kumi 2024-11-12 21:34:26 +01:00
parent f491c8be41
commit d847484b5c
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -65,7 +65,7 @@ class ApplicationBot:
if body: if body:
mention = body.split()[0].lower() mention = body.split()[0].lower()
if mention == "!applicationbot" or mention in self.username: if mention == "!applicationbot" or mention in self.username.split(":")[0]:
return await self.handle_command(room, sender, body.split(" ", 1)[1]) return await self.handle_command(room, sender, body.split(" ", 1)[1])
if body and body.startswith("!apply") and not sender == self.client.user_id: if body and body.startswith("!apply") and not sender == self.client.user_id: