Tagscript

InteractionTransformer

TagScript


Class: InteractionTransformer

Defined in: tagscript-plugin-discord/src/lib/Transformer/Interaction.ts:35

Transformer for a Discord APIApplicationCommandInteraction payload.

Properties:

id: Gives interaction id.
name: Gives the command name.
mention: Renders a clickable command mention.
applicationId: Gives the application id.
channelId: Gives the channel id.
guildId: Gives the guild id.
commandId: Gives the command id.
commandName: Gives the command name.
locale: Gives the user's locale.
guildLocale: Gives the guild's locale.

Remarks

You need to use StrictVarsParser parser to use this transformer.

Example

import { Interpreter, StrictVarsParser } from 'tagscript';
import { InteractionTransformer } from '@tagscript/plugin-discord';

const ts = new Interpreter(new StrictVarsParser());

await ts.run('You used the {command.commandName} command', { command: new InteractionTransformer(interaction) });
// You used the ping command

Extends

Constructors

Constructor

new InteractionTransformer(base, safeValues?): InteractionTransformer

Defined in: tagscript-plugin-discord/src/lib/Transformer/Base.ts:28

Parameters

base

APIApplicationCommandInteraction

safeValues?

SafeValues<APIApplicationCommandInteraction> = {}

Returns

InteractionTransformer

Inherited from

BaseTransformer.constructor

Properties

base

protected base: APIApplicationCommandInteraction

Defined in: tagscript-plugin-discord/src/lib/Transformer/Base.ts:24

Inherited from

BaseTransformer.base


safeValues

protected safeValues: SafeValues<APIApplicationCommandInteraction> = {}

Defined in: tagscript-plugin-discord/src/lib/Transformer/Base.ts:26

Inherited from

BaseTransformer.safeValues

Methods

resolveId()

protected resolveId(): string

Defined in: tagscript-plugin-discord/src/lib/Transformer/Interaction.ts:36

The snowflake this payload is identified by. Read as {thing.id}.

Returns

string

Overrides

BaseTransformer.resolveId


resolveMention()

protected resolveMention(): string

Defined in: tagscript-plugin-discord/src/lib/Transformer/Interaction.ts:40

What a bare {thing} renders to.

Returns

string

Overrides

BaseTransformer.resolveMention


toJSON()

toJSON(): SafeValues<APIApplicationCommandInteraction>

Defined in: tagscript-plugin-discord/src/lib/Transformer/Base.ts:45

Returns

SafeValues<APIApplicationCommandInteraction>

Inherited from

BaseTransformer.toJSON


transform()

transform(tag): string | null

Defined in: tagscript-plugin-discord/src/lib/Transformer/Base.ts:37

Transforms the given tag.

Parameters

tag

Lexer

The tag that triggered the transformer.

Returns

string | null

Inherited from

BaseTransformer.transform


updateSafeValues()

protected updateSafeValues(): void

Defined in: tagscript-plugin-discord/src/lib/Transformer/Interaction.ts:44

Returns

void

Overrides

BaseTransformer.updateSafeValues

On this page