mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-24 01:15:24 +08:00
fix(telegram): match mention usernames case-insensitively
Co-authored-by: multica-agent <[email protected]>
This commit is contained in:
co-authored by
multica-agent
parent
607a94f324
commit
52e8042f51
@@ -153,12 +153,12 @@ class TelegramMessageConverter(abstract_platform_adapter.AbstractMessageConverte
|
||||
text: str, entities: dict[telegram.MessageEntity, str]
|
||||
) -> list[platform_message.MessageComponent]:
|
||||
msg_components = []
|
||||
mention = f'@{bot_account_id}'
|
||||
mention = f'@{bot_account_id}'.lower()
|
||||
bot_mentions = [
|
||||
entity
|
||||
for entity, value in entities.items()
|
||||
if (entity.type == telegram.MessageEntity.MENTION and value == mention)
|
||||
or (entity.type == telegram.MessageEntity.BOT_COMMAND and value.endswith(mention))
|
||||
if (entity.type == telegram.MessageEntity.MENTION and value.lower() == mention)
|
||||
or (entity.type == telegram.MessageEntity.BOT_COMMAND and value.lower().endswith(mention))
|
||||
]
|
||||
|
||||
if bot_mentions:
|
||||
|
||||
Reference in New Issue
Block a user