aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-05-13 17:54:00 +0100
committerGravatar Joe Banks <[email protected]>2024-05-13 17:54:00 +0100
commit5870a74a6b6fdb9e3d059d6d132a221bd69a5d75 (patch)
tree67cc2685a901be2fd166c2db89dd1de48512bdd6
parentMerge pull request #3047 from python-discord/jb3/2938-nominate-context-menu (diff)
Check length of nomination reason before attempting to send to site API
This ensures we will not attempt to send a reason that is longer than the REASON_MAX_CHARS value, which can quickly be reached through the addition of message links in context.
-rw-r--r--bot/exts/recruitment/talentpool/_cog.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py
index ad232df8c..5b9958d52 100644
--- a/bot/exts/recruitment/talentpool/_cog.py
+++ b/bot/exts/recruitment/talentpool/_cog.py
@@ -432,6 +432,13 @@ class TalentPool(Cog, name="Talentpool"):
reason += f"\n\n{message.jump_url}"
+ if len(reason) > REASON_MAX_CHARS:
+ await interaction.response.send_message(
+ ":x: Cannot add additional context due to nomination reason character limit.",
+ ephemeral=True
+ )
+ return
+
await self.api.edit_nomination_entry(
nomination.id,
actor_id=interaction.user.id,