Tagscript

@tagscript/plugin-discord


Class: InteractionTransformer

Transformer for Discord CommandInteraction

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've used the command `{command.name}`', { command: new InteractionTransformer(Role) });
// You've used the command `ping`

Extends

Constructors

new InteractionTransformer()

new InteractionTransformer(base, safeValues): InteractionTransformer

Parameters

base

CommandInteraction<CacheType>

safeValues

SafeValues<CommandInteraction<CacheType>> = {}

Returns

InteractionTransformer

Inherited from

BaseTransformer.constructor

Defined in

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

Properties

base

protected base: CommandInteraction<CacheType>

Inherited from

BaseTransformer.base

Defined in

tagscript-plugin-discord/src/lib/Transformer/Base.ts:22


safeValues

protected safeValues: SafeValues<CommandInteraction<CacheType>> = {}

Inherited from

BaseTransformer.safeValues

Defined in

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

Methods

toJSON()

toJSON(): SafeValues<CommandInteraction<CacheType>>

Returns

SafeValues<CommandInteraction<CacheType>>

Inherited from

BaseTransformer.toJSON

Defined in

tagscript-plugin-discord/src/lib/Transformer/Base.ts:44


transform()

transform(tag): null | string

Transforms the given tag.

Parameters

tag

Lexer

The tag that triggered the transformer.

Returns

null | string

Inherited from

BaseTransformer.transform

Defined in

tagscript-plugin-discord/src/lib/Transformer/Base.ts:36


updateSafeValues()

protected updateSafeValues(): void

Returns

void

Overrides

BaseTransformer.updateSafeValues

Defined in

tagscript-plugin-discord/src/lib/Transformer/Interaction.ts:22