From bea5cce42f39f231c1e514e4c6b0aa6455fc48bc Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Sat, 22 Nov 2025 17:10:11 +0000 Subject: [PATCH 1/5] Fix message max length error --- cogs/committee_actions_tracking.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cogs/committee_actions_tracking.py b/cogs/committee_actions_tracking.py index b48499e3..d267a331 100644 --- a/cogs/committee_actions_tracking.py +++ b/cogs/committee_actions_tracking.py @@ -808,6 +808,13 @@ async def list_all_actions( ], ) + if len(all_actions_message) >= 2000: + chunks: list[str] = all_actions_message.split('\n\n') + await ctx.respond("Action list exceeds maximum message length, sending in chunks:") + for chunk in chunks: + await ctx.respond(content=chunk) + return + await ctx.respond(content=all_actions_message) @committee_actions.command( From 0137e68674853fe21fce860e1862fe1a249ebcda Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sat, 22 Nov 2025 17:12:18 +0000 Subject: [PATCH 2/5] [pre-commit.ci lite] apply automatic fixes --- cogs/committee_actions_tracking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/committee_actions_tracking.py b/cogs/committee_actions_tracking.py index d267a331..43fe0285 100644 --- a/cogs/committee_actions_tracking.py +++ b/cogs/committee_actions_tracking.py @@ -809,7 +809,7 @@ async def list_all_actions( ) if len(all_actions_message) >= 2000: - chunks: list[str] = all_actions_message.split('\n\n') + chunks: list[str] = all_actions_message.split("\n\n") await ctx.respond("Action list exceeds maximum message length, sending in chunks:") for chunk in chunks: await ctx.respond(content=chunk) From b91e496396fec9b3be34eaba9787069f1cddfd82 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Thu, 27 Nov 2025 18:42:51 +0000 Subject: [PATCH 3/5] Fix for list command --- cogs/committee_actions_tracking.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cogs/committee_actions_tracking.py b/cogs/committee_actions_tracking.py index 43fe0285..5e353423 100644 --- a/cogs/committee_actions_tracking.py +++ b/cogs/committee_actions_tracking.py @@ -629,6 +629,12 @@ async def list_user_actions( # NOTE: Committee role check is not present becaus }" ) + if len(actions_message) >= 2000: + number_of_chunks: int = len(actions_message) // 2000 + 1 + for index in range(number_of_chunks): + await ctx.respond(content=actions_message[index * 2000 : (index + 1) * 2000]) + return + await ctx.respond(content=actions_message) @committee_actions.command( From 482abf200bcec3315996d65b1fd1d0e230f6c099 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Thu, 27 Nov 2025 18:49:47 +0000 Subject: [PATCH 4/5] Improve list-all --- cogs/committee_actions_tracking.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/cogs/committee_actions_tracking.py b/cogs/committee_actions_tracking.py index 5e353423..f09149a7 100644 --- a/cogs/committee_actions_tracking.py +++ b/cogs/committee_actions_tracking.py @@ -3,6 +3,7 @@ import contextlib import logging import random +import textwrap from enum import Enum from typing import TYPE_CHECKING @@ -630,9 +631,13 @@ async def list_user_actions( # NOTE: Committee role check is not present becaus ) if len(actions_message) >= 2000: - number_of_chunks: int = len(actions_message) // 2000 + 1 - for index in range(number_of_chunks): - await ctx.respond(content=actions_message[index * 2000 : (index + 1) * 2000]) + for chunk in textwrap.wrap( + text=actions_message, + width=2000, + break_long_words=False, + fix_sentence_endings=True, + ): + await ctx.respond(content=chunk) return await ctx.respond(content=actions_message) @@ -818,6 +823,14 @@ async def list_all_actions( chunks: list[str] = all_actions_message.split("\n\n") await ctx.respond("Action list exceeds maximum message length, sending in chunks:") for chunk in chunks: + if len(chunk) >= 2000: + for sub_chunk in textwrap.wrap( + text=chunk, + width=2000, + break_long_words=False, + fix_sentence_endings=True, + ): + await ctx.respond(content=sub_chunk) await ctx.respond(content=chunk) return From f53da7a04a6ebc686e785c2e9163b232fa5fdf28 Mon Sep 17 00:00:00 2001 From: MattyTheHacker <18513864+MattyTheHacker@users.noreply.github.com> Date: Thu, 27 Nov 2025 19:34:43 +0000 Subject: [PATCH 5/5] Fixes --- cogs/committee_actions_tracking.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cogs/committee_actions_tracking.py b/cogs/committee_actions_tracking.py index f09149a7..e13f2d8b 100644 --- a/cogs/committee_actions_tracking.py +++ b/cogs/committee_actions_tracking.py @@ -631,9 +631,12 @@ async def list_user_actions( # NOTE: Committee role check is not present becaus ) if len(actions_message) >= 2000: + await ctx.respond( + content="Actions list exceeds maximum message length, sending in chunks" + ) for chunk in textwrap.wrap( text=actions_message, - width=2000, + width=1950, break_long_words=False, fix_sentence_endings=True, ): @@ -821,17 +824,16 @@ async def list_all_actions( if len(all_actions_message) >= 2000: chunks: list[str] = all_actions_message.split("\n\n") - await ctx.respond("Action list exceeds maximum message length, sending in chunks:") + chunk: str for chunk in chunks: - if len(chunk) >= 2000: - for sub_chunk in textwrap.wrap( - text=chunk, - width=2000, - break_long_words=False, - fix_sentence_endings=True, - ): - await ctx.respond(content=sub_chunk) - await ctx.respond(content=chunk) + sub_chunk: str + for sub_chunk in textwrap.wrap( + text=chunk, + width=1950, + break_long_words=False, + fix_sentence_endings=True, + ): + await ctx.respond(content=sub_chunk) return await ctx.respond(content=all_actions_message)