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

String compression for custom ids #14

Open
Sharp-Eyes opened this issue Sep 5, 2022 · 0 comments
Open

String compression for custom ids #14

Sharp-Eyes opened this issue Sep 5, 2022 · 0 comments
Labels
enhancement New feature or request priority: low target: rewrite This will be completed in the rewrite.

Comments

@Sharp-Eyes
Copy link
Member

Summary

Add string compression for custom ids, such that users can store more data than normally allowed by discord's 100-character limit.

What is the feature request for?

disnake.ext.components

The Problem

Discord enforces a maximum length of 100 characters for their components' custom ids. Since ext-components stores data in these custom ids, it is feasible to run out of space. It would be nice to provide the user with hooks with which they can (de)compress custom ids with a compression lib of their choice.

The Ideal Solution

Provide users with hooks to (de)compress custom ids. Provide a 'default' library through installation of e.g. disnake-ext-components[compress]. This default library will probably be python bindings to unishox-2: unishox2-py3, as this can handle the complex nature of custom ids an d still provide compression.

note: discord only cares about text-length, not byte length, which we can make optimal use of with this lib.

The Current Solution

Currently, the only way to make use of compression would be to use a custom converter on each callback parameter to individually compress them. In many situations, this would barely provide any gains.

Additional Context

This should come paired with proper length checks for created custom ids.

@Sharp-Eyes Sharp-Eyes added enhancement New feature or request priority: low labels Sep 6, 2022
@Sharp-Eyes Sharp-Eyes added the target: rewrite This will be completed in the rewrite. label Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: low target: rewrite This will be completed in the rewrite.
Projects
None yet
Development

No branches or pull requests

1 participant