Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 send multiple messages if solution is too big #1006

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

twentylemon
Copy link
Member

Summary

Fixes #959

Discord has a message size limit, which sometimes big solutions will run into. This chunks up the message into the biggest possible components that can fit into a single message, then send multiple messages.

Checklist
  • this is a source code change
    • run format in the repository root
    • run pytest in the repository root
    • link to issue being fixed using a fixes keyword, if such an issue exists
    • update the wiki documentation if necessary
  • or, this is not a source code change

@twentylemon twentylemon enabled auto-merge (squash) November 20, 2024 16:03
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.53%. Comparing base (ba5f2ea) to head (6b3ec39).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1006      +/-   ##
==========================================
+ Coverage   96.51%   96.53%   +0.02%     
==========================================
  Files          95       95              
  Lines        2237     2251      +14     
  Branches      165      168       +3     
==========================================
+ Hits         2159     2173      +14     
  Misses         67       67              
  Partials       11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

else:
total = 0
groups.append(group)
return groups + [group] if group else groups
Copy link
Collaborator

Choose a reason for hiding this comment

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

jesus

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 imagine there's a functional way to do this, but I can't think of it right now.

return Embed(title="a" * length)


@pytest.mark.parametrize("length", [0, 1, 3000, 6001])
Copy link
Collaborator

Choose a reason for hiding this comment

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

are 3000 and 6001 meaningful?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

6000 is the max embed length discord has. 3000 is just a non-1 number within the size limit

@twentylemon twentylemon merged commit b6e4d4c into duck-dynasty:main Nov 20, 2024
11 checks passed
@twentylemon twentylemon deleted the embed-messages branch November 20, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

produce some kind of result when the solution factory is large
2 participants