Tagscript

BaseTransformer

TagScript


Abstract Class: BaseTransformer<T>

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

Transformer for raw Discord API payloads, the objects typed by discord-api-types.

Every subclass answers with a fixed list of keys, so a template can read {member.displayName} and has no way to reach a client, a token or a method.

Extended by

Type Parameters

T

T extends object

The payload type.

Implements

  • ITransformer

Constructors

Constructor

new BaseTransformer<T>(base, safeValues?): BaseTransformer<T>

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

Parameters

base

T

safeValues?

SafeValues<T> = {}

Returns

BaseTransformer<T>

Properties

base

protected base: T

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


safeValues

protected safeValues: SafeValues<T> = {}

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

Methods

resolveId()

abstract protected resolveId(): string

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

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

Returns

string


resolveMention()

abstract protected resolveMention(): string

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

What a bare {thing} renders to.

Returns

string


toJSON()

toJSON(): SafeValues<T>

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

Returns

SafeValues<T>


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

Implementation of

ITransformer.transform


updateSafeValues()

protected updateSafeValues(): void

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

Returns

void

On this page