From 279f74760ed7a9cfe7c719a61cc011448ce162c2 Mon Sep 17 00:00:00 2001 From: Kevin Roman <44275689+Kevin-Roman@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:00:57 +0100 Subject: [PATCH] fix: handle embed over lenght limit error (#190) ## 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. --- utils/notifications.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/notifications.py b/utils/notifications.py index 6e240fd..72ec65f 100644 --- a/utils/notifications.py +++ b/utils/notifications.py @@ -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}" )