Tagscript

ResolveCommandOptions

TagScript


Function: resolveCommandOptions()

resolveCommandOptions(data): Record<string, ITransformer>

Defined in: tagscript-plugin-discord/src/lib/Utils/CommandInteraction.ts:103

Turns a chat input command's data into transformers, ready to pass to run as seed variables. Whatever the user typed into the command becomes readable by name from the template.

Parameters

data

APIChatInputApplicationCommandInteractionData

The command data off the interaction payload

Returns

Record<string, ITransformer>

One transformer per option, keyed by option name

Example

client.on('interactionCreate', async (interaction) => {
 if (!interaction.isChatInputCommand()) return;

 const result = await ts.run(template, resolveCommandOptions(data));
 await interaction.reply(result.body);
});

On this page