Skip to content

Commit

Permalink
Fix mentions with symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
AlberLC committed Jun 14, 2022
1 parent 5236b15 commit 549cb1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions multibot/bots/discord_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async def _get_mentions(self, original_message: constants.DISCORD_MESSAGE) -> li
chat = await self._get_chat(original_message)
if chat.original_object.guild:
text = await self._get_text(original_message)
text = flanautils.remove_symbols(text, replace_with=' ')
words = text.lower().split()
for member in chat.original_object.guild.members:
user_name = f'{member.name}#{member.discriminator}'.lower()
Expand Down Expand Up @@ -450,6 +451,10 @@ def create_view() -> View | None:
if buttons is not None:
kwargs['view'] = create_view()
message.original_object = await message.original_object.edit(content=text, **kwargs)
if content := getattr(media, 'content', None):
message.contents = [content]
message.update_last_edit()
message.save()
return message

match reply_to:
Expand Down
1 change: 1 addition & 0 deletions multibot/bots/telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ async def _get_mentions(self, original_message: constants.TELEGRAM_MESSAGE) -> l
except ValueError:
pass

text = flanautils.remove_symbols(text, replace_with=' ')
words = text.lower().split()
for participant in await self.client.get_participants(chat.original_object):
user_name = self._get_name_from_entity(participant).strip(' @').lower()
Expand Down
1 change: 1 addition & 0 deletions multibot/bots/twitch_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ async def _get_mentions(self, original_message: constants.TWITCH_MESSAGE) -> lis
mentions = OrderedSet([user for mention in re.findall(r'@[\d\w]+', text) if (user := await self.get_user(mention[1:], chat))])

if chat.original_object.chatters:
text = flanautils.remove_symbols(text, replace_with=' ')
words = text.lower().split()

for chatter in chat.original_object.chatters:
Expand Down

0 comments on commit 549cb1b

Please sign in to comment.