@@ -55,11 +55,16 @@ class EmbedContent(NamedTuple):
5555 title : str
5656 url : str
5757 body : str | None = None
58+ description : str | None = None
5859
5960 @property
6061 def dict (self ) -> EmbedContentArgs :
6162 args : EmbedContentArgs = {"title" : self .title , "url" : self .url }
62- if self .body :
63+ if self .description :
64+ # If a description is provided explicitly, don't truncate. However, Discord
65+ # has a description character size limit.
66+ args ["description" ] = truncate (self .description , 4096 )
67+ elif self .body :
6368 args ["description" ] = truncate (self .body , 500 )
6469 return args
6570
@@ -77,7 +82,13 @@ def dict(self, bot: GhosttyBot) -> dict[str, str | None]:
7782
7883class ContentGenerator (Protocol ):
7984 def __call__ (
80- self , event_like : Any , template : str , body : str | None = None , /
85+ self ,
86+ event_like : Any ,
87+ template : str ,
88+ body : str | None = None ,
89+ / ,
90+ * ,
91+ description : str | None = None ,
8192 ) -> EmbedContent : ...
8293
8394
@@ -119,9 +130,9 @@ async def send_edit_difference(
119130 )
120131 if old_title == new_title :
121132 # If the titles are the same, there's no point in showing them;
122- # they just take up a lot of the 500 available characters.
133+ # they just take up a lot of the 750 available characters.
123134 diff_lines = islice (diff_lines , 2 , None )
124- diff = truncate ("\n " .join (diff_lines ), 500 - len ("```diff\n \n ```" ))
135+ diff = truncate ("\n " .join (diff_lines ), 750 - len ("```diff\n \n ```" ))
125136 content = f"```diff\n { diff } \n ```"
126137 elif changes .title :
127138 content = f'Renamed from "{ changes .title .from_ } " to "{ event_object .title } "'
@@ -132,7 +143,7 @@ async def send_edit_difference(
132143 await send_embed (
133144 bot ,
134145 event .sender ,
135- content_generator (event_object , "edited {}" , content ),
146+ content_generator (event_object , "edited {}" , None , description = content ),
136147 footer_generator (event_object ),
137148 )
138149
0 commit comments