Skip to content

Commit

Permalink
Fix use of expansion format commands
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanC committed Oct 12, 2024
1 parent 71cc8c0 commit b4eebc2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions extensions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async def CommandEdit(

if not msg:
logger.debug(
f"Failed to fetch message {messageId} in channel {ExpandChannel(channelId, format=False)}"
f"Failed to fetch message {messageId} in channel {await ExpandChannel(channelId, format=False)}"
)

await ctx.respond(
Expand Down Expand Up @@ -201,7 +201,7 @@ async def CommandEmojiUpload(
ctx.guild_id,
name,
image.url,
reason=f"Emoji uploaded by {ExpandUser(ctx.author, format=False)}.",
reason=f"Emoji uploaded by {await ExpandUser(ctx.author, format=False)}.",
)

await ctx.respond(
Expand Down Expand Up @@ -231,7 +231,7 @@ async def CommandEmojiDelete(
await ctx.client.rest.delete_emoji(
ctx.guild_id,
int(emojiId),
reason=f"Emoji deleted by {ExpandUser(ctx.author, format=False)}.",
reason=f"Emoji deleted by {await ExpandUser(ctx.author, format=False)}.",
)

await ctx.respond(
Expand Down Expand Up @@ -273,7 +273,7 @@ async def CommandStickerUpload(
name,
related,
image.url,
reason=f"Sticker uploaded by {ExpandUser(ctx.author, format=False)}.",
reason=f"Sticker uploaded by {await ExpandUser(ctx.author, format=False)}.",
)

await ctx.respond(
Expand Down Expand Up @@ -303,7 +303,7 @@ async def CommandStickerDelete(
await ctx.client.rest.delete_sticker(
ctx.guild_id,
int(stickerId),
reason=f"Sticker deleted by {ExpandUser(ctx.author, format=False)}.",
reason=f"Sticker deleted by {await ExpandUser(ctx.author, format=False)}.",
)

await ctx.respond(
Expand Down
10 changes: 5 additions & 5 deletions extensions/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def EventDirectMessage(event: DMMessageCreateEvent) -> None:
)

logger.success(
f"Notified of direct message from {ExpandUser(event.author, format=False)}"
f"Notified of direct message from {await ExpandUser(event.author, format=False)}"
)


Expand Down Expand Up @@ -196,7 +196,7 @@ async def EventKeyword(event: GuildMessageCreateEvent) -> None:
)

logger.success(
f"Notified of keyword(s) ({", ".join(found)}) mention by {ExpandUser(event.author, format=False)} in {ExpandServer(event.get_guild(), format=False)} {ExpandChannel(event.get_channel(), format=False)}"
f"Notified of keyword(s) ({", ".join(found)}) mention by {await ExpandUser(event.author, format=False)} in {await ExpandServer(event.get_guild(), format=False)} {await ExpandChannel(event.get_channel(), format=False)}"
)


Expand Down Expand Up @@ -276,7 +276,7 @@ async def EventMention(event: GuildMessageCreateEvent) -> None:
)

logger.success(
f"Notified of mention(s) ({found}) by {ExpandUser(event.author, format=False)} in {ExpandServer(event.get_guild(), format=False)} {ExpandChannel(event.get_channel(), format=False)}"
f"Notified of mention(s) ({found}) by {await ExpandUser(event.author, format=False)} in {await ExpandServer(event.get_guild(), format=False)} {await ExpandChannel(event.get_channel(), format=False)}"
)


Expand Down Expand Up @@ -389,7 +389,7 @@ async def EventContext(event: InteractionCreateEvent) -> None:
await interaction.edit_initial_response(embeds=results)

logger.success(
f"Fetched context requested by {ExpandUser(interaction.user, format=False)} in {ExpandServer(interaction.get_guild(), format=False)} {ExpandChannel(interaction.get_channel(), format=False)}"
f"Fetched context requested by {await ExpandUser(interaction.user, format=False)} in {await ExpandServer(interaction.get_guild(), format=False)} {await ExpandChannel(interaction.get_channel(), format=False)}"
)


Expand Down Expand Up @@ -451,7 +451,7 @@ async def EventDump(event: InteractionCreateEvent) -> None:
for message in context:
logger.trace(message)

result += f"{ExpandUser(message.author, format=False)}"
result += f"{await ExpandUser(message.author, format=False)}"
result += f" at {message.timestamp}"

if content := message.content:
Expand Down
6 changes: 3 additions & 3 deletions extensions/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async def CommandRawSlash(

if not msg:
logger.debug(
f"Failed to fetch message {messageId} in channel {ExpandChannel(channelId, format=False)}"
f"Failed to fetch message {messageId} in channel {await ExpandChannel(channelId, format=False)}"
)

await ctx.respond(
Expand Down Expand Up @@ -182,7 +182,7 @@ async def CommandParse(ctx: GatewayContext, msg: Message) -> None:
await ctx.respond(str(result), flags=MessageFlag.EPHEMERAL)

logger.success(
f"Parsed {len(results):,} {descriptor} ({results}) from message {msg.id} in {ExpandServer(ctx.get_guild(), format=False)} {ExpandChannel(await msg.fetch_channel(), format=False)}"
f"Parsed {len(results):,} {descriptor} ({results}) from message {msg.id} in {await ExpandServer(ctx.get_guild(), format=False)} {await ExpandChannel(await msg.fetch_channel(), format=False)}"
)


Expand Down Expand Up @@ -299,7 +299,7 @@ async def CommandReport(ctx: GatewayContext, msg: Message) -> None:
fields=fields,
author=await ExpandUser(msg.author, format=False),
authorIcon=GetUserAvatar(msg.author),
footer=f"Reported by {ExpandUser(ctx.author, format=False)}",
footer=f"Reported by {await ExpandUser(ctx.author, format=False)}",
footerIcon=GetUserAvatar(ctx.author),
),
)
Expand Down
8 changes: 4 additions & 4 deletions extensions/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ async def EventValidateRoles(event: GuildMessageCreateEvent) -> None:
cfg.channels["user"],
Log(
"shirt",
f"Removed role (`{match}`) from {ExpandUser(event.author)} with reason: *Member exceeds limit (1) of allowed roles.*",
f"Removed role (`{match}`) from {await ExpandUser(event.author)} with reason: *Member exceeds limit (1) of allowed roles.*",
),
)

logger.success(
f"Invalidated role {match} for {ExpandUser(event.author, format=False)} in {ExpandServer(event.get_guild(), format=False)}"
f"Invalidated role {match} for {await ExpandUser(event.author, format=False)} in {await ExpandServer(event.get_guild(), format=False)}"
)

# Refetch equipped roles before continuing validation
Expand Down Expand Up @@ -104,12 +104,12 @@ async def EventValidateRoles(event: GuildMessageCreateEvent) -> None:
cfg.channels["user"],
Log(
"shirt",
f"Removed role (`{role}`) from {ExpandUser(event.author)} with reason: *Requirements not met.*",
f"Removed role (`{role}`) from {await ExpandUser(event.author)} with reason: *Requirements not met.*",
),
)

logger.success(
f"Invalidated role ({role}) for {ExpandUser(event.author, format=False)} in {ExpandServer(event.get_guild(), format=False)}"
f"Invalidated role ({role}) for {await ExpandUser(event.author, format=False)} in {await ExpandServer(event.get_guild(), format=False)}"
)


Expand Down
2 changes: 1 addition & 1 deletion extensions/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def TaskArchiveThreads(client: GatewayClient) -> None:
)
except Exception as e:
logger.opt(exception=e).error(
f"Failed to archive thread {title} in {ExpandServer(thread.get_guild(), format=False)}"
f"Failed to archive thread {title} in {await ExpandServer(thread.get_guild(), format=False)}"
)

continue
Expand Down

0 comments on commit b4eebc2

Please sign in to comment.