build_custom_id
Function
base_id:data as compact JSON in url-safe base64. Raises past 100 characters.
from discord_interactions import build_custom_idSignature
def build_custom_id( base_id: str, data: Dict[str, Any] | None = None, max_length: int = 100,) -> strParameters
| Name | Type | Default | Description |
|---|---|---|---|
base_id | str | required | Readable part, used for routing. |
data | Dict[str, Any] | None | None | JSON dict to embed. |
max_length | int | 100 | Maximum allowed length. |
Returns
str
Example
from discord_interactions import build_custom_id, parse_custom_id custom_id = build_custom_id("page", {"p": 3})base_id, data = parse_custom_id(custom_id) # ("page", {"p": 3})