From ed3b4e5b2935d916ac86cc7e778bfc760ca96218 Mon Sep 17 00:00:00 2001 From: Michael H Date: Thu, 9 Jan 2020 10:50:04 -0500 Subject: [PATCH] Embed pagination fixing (pt2) (#3248) * I hate embeds * changelog * until splitting the fields, ensure a field * make this work, from a user perspective --- changelog.d/3248.misc.rst | 1 + redbot/core/commands/help.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 changelog.d/3248.misc.rst diff --git a/changelog.d/3248.misc.rst b/changelog.d/3248.misc.rst new file mode 100644 index 000000000..aa57d9636 --- /dev/null +++ b/changelog.d/3248.misc.rst @@ -0,0 +1 @@ +fix a buggy first page of paginated help diff --git a/redbot/core/commands/help.py b/redbot/core/commands/help.py index 1de10cfb6..8204c7d8f 100644 --- a/redbot/core/commands/help.py +++ b/redbot/core/commands/help.py @@ -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): + + # 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) - curr_group = [] current_count = 0 - curr_group.append(f) - current_count += f_len + curr_group = [f] else: - # Loop cleanup here if curr_group: ret.append(curr_group)