Tagscript

@tagscript/plugin-discordDocs


Class: MemberTransformer

Transformer for Discord GuildMember.

Properties:

id: Gives member id.
mention: Mentions the member.
username: Gives username of the member.
discriminator: Gives discriminator of the member
tag: Gives username#discriminator
avatar: Gives member's custom avatar if they have one. Else it'll be an empty string.
displayAvatar: Gives member's avatar URL if they have one else gives member's default avatar.
nickname: Gives member's nickname.
displayName: Gives member's display name. (nickname if they have one else username)
joinedAt: Gives member's join date.
joinedTimestamp: Gives member's join date in ms
createdAt: Gives member's account create date.
createdTimestamp: Gives member's account created date in ms
bot: Gives true if the member is a bot else false.
color: Gives member's highest role color.
position: Gives member's highest role position.
roles: Gives member's roles.
roleIds: Gives member's roles ids.
roleNames: Gives member's roles names.
topRole: Gives member's highest role name.
timeoutUntil: Gives member's timeout until date.
timeoutUntilTimestamp: Gives member's timeout until date in ms.

Remarks

You need to use StrictVarsParser parser to use this transformer.

Example

import { Interpreter, StrictVarsParser } from 'tagscript';
import { MemberTransformer } from '@tagscript/plugin-discord';
 
const ts = new Interpreter(new StrictVarsParser());
 
await ts.run('Hi {member}', { member: new MemberTransformer(GuildMember) });
// Hi <@758880890159235083>

Extends

Constructors

new MemberTransformer()

new MemberTransformer(base, safeValues): MemberTransformer

Parameters

base: GuildMember

safeValues: SafeValues<GuildMember> = {}

Returns

MemberTransformer

Inherited from

BaseTransformer.constructor

Defined in

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

Properties

base

protected base: GuildMember

Inherited from

BaseTransformer.base

Defined in

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


safeValues

protected safeValues: SafeValues<GuildMember> = {}

Inherited from

BaseTransformer.safeValues

Defined in

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

Methods

toJSON()

toJSON(): SafeValues<GuildMember>

Returns

SafeValues<GuildMember>

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/GuildMember.ts:48

On this page