From efb292ca10f90fb0ad144af57e6b2e09a7ed2565 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Sat, 19 Aug 2023 16:57:42 -0400 Subject: [PATCH] fix(issues): improved split formatting --- issues/issues.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/issues/issues.py b/issues/issues.py index 323971c..d308b18 100644 --- a/issues/issues.py +++ b/issues/issues.py @@ -112,7 +112,20 @@ class Issues(commands.Cog): value = item.value if value is not None: if len(value) > 1024: - split_value = [value[i:i+1024] for i in range(0, len(value), 1024)] + words = value.split() + split_value = [] + current_part = "" + + for word in words: + if len(current_part) + len(word) + 1 <= 1024: + current_part += word + " " + else: + split_value.append(current_part.strip()) + current_part = word + " " + + if current_part: + split_value.append(current_part.strip()) + for i, part in enumerate(split_value): embed.add_field(name=title if i == 0 else "\u200b", value=part, inline=False) else: