Skip to content

Commit 175dc6c

Browse files
committed
Slightly improve error handling
1 parent 2283bda commit 175dc6c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/cyclomonitor/cyclomonitor.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,18 @@ async def auto_update(self):
141141
channel_id = server_vars.get("tracking_channel", guild.id)
142142
channel = bot.get_channel(channel_id)
143143
if channel is not None:
144-
await channel.send(CM_SUPPRESSED_MESSAGE)
145-
await channel.send(
146-
NEXT_AUTO_UPDATE.format(
147-
math.floor(cog.auto_update.next_iteration.timestamp())
144+
try:
145+
await channel.send(CM_SUPPRESSED_MESSAGE)
146+
await channel.send(
147+
NEXT_AUTO_UPDATE.format(
148+
math.floor(
149+
cog.auto_update.next_iteration.timestamp()
150+
)
151+
)
148152
)
149-
)
153+
except discord.errors.HTTPException:
154+
logging.warning(LOG_GUILD_UNAVAILABLE)
155+
continue
150156
return
151157
for guild in bot.guilds:
152158
channel_id = server_vars.get("tracking_channel", guild.id)

0 commit comments

Comments
 (0)