Skip to content

String compression for custom ids #14

Open
@Sharp-Eyes

Description

@Sharp-Eyes

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      String compression for custom ids · Issue #14 · DisnakeCommunity/disnake-compass