Functioncustom-idv0.3.2
prefixOf
Strip the layout hash off a wire and return the prefix that the customId was declared with.
Route on this. A click on a component built before a shape change still reaches the same handler
because changing a shape doesn't change its prefix. decode then throws the stale error there.
Returns an empty string when the wire is missing its colon or its routeKey is too short to carry a hash.
const Approve = new CustomId('approve').snowflake('userId');
// 'approve', whatever fields the definition carries today
prefixOf(Approve.encode({ userId: '123' }));
// route a raw interaction on it
const handler = handlers.get(prefixOf(interaction.customId));wire
wire: stringThe customId string from the interaction.