fix(issues): improved split formatting
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
This commit is contained in:
parent
854935da7e
commit
efb292ca10
1 changed files with 14 additions and 1 deletions
|
@ -112,7 +112,20 @@ class Issues(commands.Cog):
|
||||||
value = item.value
|
value = item.value
|
||||||
if value is not None:
|
if value is not None:
|
||||||
if len(value) > 1024:
|
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):
|
for i, part in enumerate(split_value):
|
||||||
embed.add_field(name=title if i == 0 else "\u200b", value=part, inline=False)
|
embed.add_field(name=title if i == 0 else "\u200b", value=part, inline=False)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue