From 0fb7c8bdba2d17a066563f532a5cd5fc3d2fc410 Mon Sep 17 00:00:00 2001 From: Dav Date: Thu, 24 Jun 2021 06:22:58 +0000 Subject: [PATCH] Raise on an uncompliant message in Context.maybe_send_embed() (#4465) * Raise on uncompliant message * just wait for me to be done flame! (grammar+testing) * i liked this better --- redbot/core/commands/context.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redbot/core/commands/context.py b/redbot/core/commands/context.py index c956db112..71434a511 100644 --- a/redbot/core/commands/context.py +++ b/redbot/core/commands/context.py @@ -248,8 +248,11 @@ class Context(DPYContext): see `discord.abc.Messageable.send` discord.HTTPException see `discord.abc.Messageable.send` + ValueError + when the message's length is not between 1 and 2000 characters. """ - + if not message or len(message) > 2000: + raise ValueError("Message length must be between 1 and 2000") if await self.embed_requested(): return await self.send( embed=discord.Embed(description=message, color=(await self.embed_colour()))