Skip to content

Commit

Permalink
fix make_friendly func
Browse files Browse the repository at this point in the history
  • Loading branch information
greeeen-dev committed Jun 27, 2024
1 parent 3825f48 commit 61a2867
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cogs/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,17 +690,20 @@ async def make_friendly(self, text, source):
try:
if source == 'revolt':
user = self.bot.revolt_client.get_user(userid)
display_name = user.display_name
elif source == 'guilded':
user = self.bot.guilded_client.get_user(userid)
display_name = user.display_name
else:
user = self.bot.get_user(userid)
display_name = user.global_name
if not user:
raise ValueError()
except:
offset += 1
continue
text = text.replace(f'<@{userid}>', f'@{user.global_name or user.name}').replace(
f'<@!{userid}>', f'@{user.global_name or user.name}')
text = text.replace(f'<@{userid}>', f'@{display_name or user.name}').replace(
f'<@!{userid}>', f'@{display_name or user.name}')
offset += 1
return text

Expand Down

0 comments on commit 61a2867

Please sign in to comment.