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 = []
|
||||
current_count = 0
|
||||
|
||||
for f in fields:
|
||||
for i, f in enumerate(fields):
|
||||
f_len = len(f.value) + len(f.name)
|
||||
if curr_group and (f_len + current_count > max_chars):
|
||||
ret.append(curr_group)
|
||||
curr_group = []
|
||||
current_count = 0
|
||||
curr_group.append(f)
|
||||
|
||||
# Commands start at the 1st index of fields, i < 2 is a hacky workaround for now
|
||||
if not current_count or f_len + current_count > max_chars or i < 2:
|
||||
current_count += f_len
|
||||
curr_group.append(f)
|
||||
elif curr_group:
|
||||
ret.append(curr_group)
|
||||
current_count = 0
|
||||
curr_group = [f]
|
||||
else:
|
||||
# Loop cleanup here
|
||||
if curr_group:
|
||||
ret.append(curr_group)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user