Skip to content

Commit

Permalink
Remove user fetching from blocked command (#3242)
Browse files Browse the repository at this point in the history
We already have all the information we need to mention a user (their
id) and fetching the information from discord will lead to rate
limiting and extremely poor performance on large block lists for
no gain.
  • Loading branch information
khakers authored Jan 21, 2023
1 parent c8b2522 commit 485ab5a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -1665,13 +1665,7 @@ async def blocked(self, ctx):
self.bot.blocked_users.pop(str(id_))
logger.debug("No longer blocked, user %s.", id_)
continue

try:
user = await self.bot.get_or_fetch_user(int(id_))
except discord.NotFound:
users.append((id_, reason))
else:
users.append((user.mention, reason))
users.append((f"<@{id_}>", reason))

blocked_roles = list(self.bot.blocked_roles.items())
for id_, reason in blocked_roles:
Expand Down

0 comments on commit 485ab5a

Please sign in to comment.