Skip to content

Commit

Permalink
use get_or_fetch_user
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmTomahawkx committed Jul 24, 2023
1 parent 9aed1ed commit 22e37c5
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions modules/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,15 @@ async def logging_loop(self) -> None:

if not avatar_url and self.user is not None and "runner" in core.CONFIG["LOGGING"]:
runner_id: int = core.CONFIG["LOGGING"]["runner"]
user = self.user or self.bot.get_user(runner_id)
try:
user = self.user or self.bot.get_or_fetch_user(runner_id)
except:
self.user = user = None # This will tell us not to attempt again.

if user:
avatar_url = user.display_avatar.url
avatar_name = f"Logging: Dev: {user.display_name}"

else:
try:
user = await self.bot.fetch_user(
runner_id
) # dont particularly need to chunk the entire guild for the one user
self.user = user
except:
self.user = None # This will tell us not to attempt again.
else:
avatar_url = user.display_avatar.url
avatar_name = f"Logging: Dev: {user.display_name}"

await self.webhook.send(
message,
username=avatar_name,
Expand Down

0 comments on commit 22e37c5

Please sign in to comment.