Skip to content

Commit 499568f

Browse files
committed
refactor(report): improve type hinting
1 parent 7221ddf commit 499568f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

report/report.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ async def send_emergency_report(self, log_channel: TextLikeChannel, embed: disco
305305

306306
async def do_report(
307307
self,
308-
channel: "discord.guild.GuildChannel | discord.Thread",
308+
channel: GuildChannelOrThread,
309309
message: discord.Message,
310310
report_body: str,
311311
emergency: bool,
@@ -380,7 +380,7 @@ async def make_report_embed(
380380
last_msg = await anext(channel.history(limit=1, before=message.created_at), None)
381381
embed.add_field(name="Context Region", value=last_msg.jump_url if last_msg else "No messages found")
382382
else:
383-
embed.add_field(name="Channel", value=message.channel.mention) # type: ignore
383+
embed.add_field(name="Channel", value=channel.mention)
384384

385385
embed.add_field(name="Report Content", value=escape(report_body or "<no message>"))
386386
return embed
@@ -418,9 +418,7 @@ async def notify_truncation(
418418
except discord.Forbidden as exc:
419419
logger.error(f"Failed to notify {message.author.global_name} ({message.author.id}) about report truncation: {exc}")
420420

421-
async def notify_guild_owner_config_error(
422-
self, channel: "discord.guild.GuildChannel | discord.Thread", message: discord.Message, report_body: str
423-
):
421+
async def notify_guild_owner_config_error(self, channel: GuildChannelOrThread, message: discord.Message, report_body: str):
424422
"""Notify guild owner about misconfigured report log channel."""
425423
if channel.guild.owner is None:
426424
logger.warning(

0 commit comments

Comments
 (0)