Skip to content

Commit

Permalink
fix: handle embed over lenght limit error (#190)
Browse files Browse the repository at this point in the history
## The Issue
Accidental embeds over discord's limit leads to an error, that leads to
the daily notifications not being sent.

## The solution
For the moment, just handle the error gracefully.
  • Loading branch information
Kevin-Roman authored Oct 14, 2024
1 parent 76770bf commit 279f747
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions utils/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ async def send_daily_question(

try:
await channel.send(embed=embed, silent=True)
except discord.errors.Forbidden:
except (
discord.errors.Forbidden,
# Embed too large error.
discord.app_commands.errors.CommandInvokeError,
):
bot.logger.info(
f"Forbidden to share daily question to channel with ID: "
f"{channel_id}"
f"Exception sharing daily question to channel with ID: " f"{channel_id}"
)

0 comments on commit 279f747

Please sign in to comment.