Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions cogs/committee_actions_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import contextlib
import logging
import random
import textwrap
from enum import Enum
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -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"
)
Comment on lines +634 to +636
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be sent to the user? Or just a logged message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating that, tbh I have half a mind to say it's not needed at all. not too bothered

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yh lets get rid of it

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(
Expand Down Expand Up @@ -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(
Expand Down