From bbbb39bf3d67aaabb8a160f80f3ae60bd225fca0 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 15 Apr 2022 01:01:55 +0200 Subject: [PATCH] Truncate title to 256 characters --- src/message.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/message.py b/src/message.py index 6998ef0..a505b4e 100644 --- a/src/message.py +++ b/src/message.py @@ -2,7 +2,15 @@ import discord class BotMessage(discord.Embed): - pass + def __init__(self, **kwargs): + title = kwargs.pop("title", None)[:256] + if title is not None: + # Max embed title length is 256 + title = title[:256] + super().__init__( + **kwargs, + title=title + ) class ErrorMessage(BotMessage):