Classkitv0.1.1
CustomId
A typed customId. The single source of truth shared by the component that mints it and the handler that reads it. This gives you typed reads on the .customId.customId field in components. Values are packed into a compact wire string rather than plain stringified tokens, so the 100-char Discord limit goes further. More string per string, basically.
class CustomId<
Prefix extends string,
Shape extends CustomIdShape = {}
>class CustomId<
Prefix extends string,
Shape extends CustomIdShape = {}
>Member visibility
Filter class members by access level.
Prefix
The stable route prefix, e.g. 'approve'.
Shape
The accumulated fields, filled in by the chain.
Shape extends CustomIdShape = {}Shape extends CustomIdShape = {}public bool<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<boolean>>
>public bool<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<boolean>>
>public decode(wire: string): DecodedParams<Shape>public decode(wire: string): DecodedParams<Shape>Parameter:
wireThe customId string from the interaction.
public encode(values: DecodedParams<Shape>): stringpublic encode(values: DecodedParams<Shape>): stringParameter:
valuesOne value per field, typed by the chain.
Add an integer field with no bounds, for a value up to 2^53.
public int<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<number>>
>public int<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<number>>
>public oneOf<Name, Choices>(
name: Name,
choices: Choices
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<Choices[number]>>
>public oneOf<Name, Choices>(
name: Name,
choices: Choices
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<Choices[number]>>
>public snowflake<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<Snowflake>>
>public snowflake<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<Snowflake>>
>public str<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<string>>
>public str<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<string>>
>public uuid<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<string>>
>public uuid<Name>(
name: Name
): CustomId<
Prefix,
Shape & Record<Name, CustomIdField<string>>
>