Skip to content

Commit 491ee47

Browse files
committed
Add check for if logs channel still exists
1 parent f7d3fe5 commit 491ee47

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

logs/searcher.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ async def log_completed_log(self, log: FullLog):
267267
if "logs" in guild_settings:
268268
if not guild_settings["logs"]["enabled"]:
269269
return
270-
logs_channel = guild_settings["logs"]["channel"]
270+
logs_channel_id: int = guild_settings["logs"]["channel"]
271+
logs_channel: nextcord.abc.GuildChannel = self.bot.get_channel(
272+
logs_channel_id
273+
)
271274
else:
272275
return
273276

@@ -285,9 +288,9 @@ async def log_completed_log(self, log: FullLog):
285288
else:
286289
log_url = f"https://logs.tf/{log.log_id}"
287290

288-
await self.bot.get_channel(logs_channel).send(
289-
content=f"{category_string}{log_url}"
290-
)
291+
if logs_channel:
292+
await logs_channel.send(content=f"{category_string}{log_url}")
293+
291294
await self.bot.get_channel(DEV_SUCCESSFUL_LOGS).send(
292295
content=f"{category_string}{log_url}\nGuild: {log.guild}"
293296
)

0 commit comments

Comments
 (0)