Functioncustom-idv0.3.2
Throws:
The invalid error from
setCustomIdErrorswhen the wire's prefix doesn't match any definition.What
decodethrows when the matched definition rejects the wire.
decodeFor<Defs>(
defs: Defs,
wire: string
): DecodedRoute<Defs>const Approve = new CustomId('approve').snowflake('userId');
const Reject = new CustomId('reject').snowflake('userId').str('reason');
const { prefix, params } = decodeFor([Approve, Reject], wire);
// params.reason only exists on this branch
if (prefix === 'reject') await deny(params.userId, params.reason);Defs
Defsdefs
defs: DefsThe customId definitions to try, in order.
wire
wire: stringThe customId string from the interaction.