Even smarter body chunking

This commit is contained in:
Zeva Rose 2021-06-29 17:33:19 -06:00
parent 51b8809f21
commit e797671ad8

View file

@ -70,6 +70,18 @@ class JokeCog(commands.Cog):
) )
body_chunks = [] body_chunks = []
body = ""
for word in result["body"].split(" "):
if len(body) + 1 + len(word) > 1024:
body_chunks.append(Field("", body, False))
body = ""
if word == "\n" and body == "":
continue
elif word == "\n":
body += word
else:
body += " " + word
for chunk in result["body"].split("\n"): for chunk in result["body"].split("\n"):
if len(chunk) > 0: if len(chunk) > 0:
body_chunks.append(Field("", chunk, False)) body_chunks.append(Field("", chunk, False))