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
This commit is contained in:
Dav 2021-06-24 06:22:58 +00:00 committed by GitHub
parent 34b912bc7c
commit 0fb7c8bdba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()))