diff --git a/cogs/committee_actions_tracking.py b/cogs/committee_actions_tracking.py index b48499e31..e13f2d8b2 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 @@ -629,6 +630,19 @@ 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=1950, + break_long_words=False, + fix_sentence_endings=True, + ): + await ctx.respond(content=chunk) + return + await ctx.respond(content=actions_message) @committee_actions.command( @@ -808,6 +822,20 @@ async def list_all_actions( ], ) + if len(all_actions_message) >= 2000: + chunks: list[str] = all_actions_message.split("\n\n") + chunk: str + for chunk in chunks: + 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) @committee_actions.command(