mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Embed pagination fixing (pt2) (#3248)
* I hate embeds * changelog * until splitting the fields, ensure a field * make this work, from a user perspective
This commit is contained in:
parent
9698baf6e7
commit
ed3b4e5b29
1
changelog.d/3248.misc.rst
Normal file
1
changelog.d/3248.misc.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
fix a buggy first page of paginated help
|
||||||
@ -277,16 +277,18 @@ class RedHelpFormatter:
|
|||||||
ret = []
|
ret = []
|
||||||
current_count = 0
|
current_count = 0
|
||||||
|
|
||||||
for f in fields:
|
for i, f in enumerate(fields):
|
||||||
f_len = len(f.value) + len(f.name)
|
f_len = len(f.value) + len(f.name)
|
||||||
if curr_group and (f_len + current_count > max_chars):
|
|
||||||
ret.append(curr_group)
|
# Commands start at the 1st index of fields, i < 2 is a hacky workaround for now
|
||||||
curr_group = []
|
if not current_count or f_len + current_count > max_chars or i < 2:
|
||||||
current_count = 0
|
|
||||||
curr_group.append(f)
|
|
||||||
current_count += f_len
|
current_count += f_len
|
||||||
|
curr_group.append(f)
|
||||||
|
elif curr_group:
|
||||||
|
ret.append(curr_group)
|
||||||
|
current_count = 0
|
||||||
|
curr_group = [f]
|
||||||
else:
|
else:
|
||||||
# Loop cleanup here
|
|
||||||
if curr_group:
|
if curr_group:
|
||||||
ret.append(curr_group)
|
ret.append(curr_group)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user