meshcore.js
ReferenceClasses

CommandContext<Args>

Defined in: packages/client/src/commands/context.ts:35

Handed to a command's handler: the parsed args, the triggering message, reply(), and permission checks.

Type Parameters

Args

Args extends object = Record<string, unknown>

Constructors

Constructor

new CommandContext<Args>(
   client, 
   command, 
   message, 
   args
): CommandContext<Args>;

Defined in: packages/client/src/commands/context.ts:48

Parameters

client

Client

Owning client

command

Command

Command being run

message

Message

Message that triggered it

args

Args

Parsed arguments

Returns

CommandContext<Args>

Properties

args

readonly args: Args;

Defined in: packages/client/src/commands/context.ts:39


client

readonly client: Client;

Defined in: packages/client/src/commands/context.ts:36


command

readonly command: Command;

Defined in: packages/client/src/commands/context.ts:37


logger

readonly logger: Logger;

Defined in: packages/client/src/commands/context.ts:40


message

readonly message: Message;

Defined in: packages/client/src/commands/context.ts:38

Accessors

author

Get Signature

get author(): Author;

Defined in: packages/client/src/commands/context.ts:62

Returns

Author


channel

Get Signature

get channel(): Channel | null;

Defined in: packages/client/src/commands/context.ts:66

Returns

Channel | null


isDM

Get Signature

get isDM(): boolean;

Defined in: packages/client/src/commands/context.ts:70

Returns

boolean

Methods

can()

can(permission): Promise<boolean>;

Defined in: packages/client/src/commands/context.ts:83

Parameters

permission

PermissionLike

Permission to check for the author

Returns

Promise<boolean>


canManageContact()

canManageContact(contact): Promise<boolean>;

Defined in: packages/client/src/commands/context.ts:93

Parameters

contact

Contact

Contact the author wants to act on

Returns

Promise<boolean>


canManageRole()

canManageRole(role): Promise<boolean>;

Defined in: packages/client/src/commands/context.ts:88

Parameters

role

Role

Role the author wants to give or take

Returns

Promise<boolean>


reply()

reply(content, options?): Promise<SentMessage>;

Defined in: packages/client/src/commands/context.ts:78

Parameters

content

MessageContent

Text or MessageBuilder

options?

mention prefixes the author on a channel. Default true

mention?

boolean

Returns

Promise<SentMessage>


replyDM()

replyDM(content): Promise<SentMessage>;

Defined in: packages/client/src/commands/context.ts:98

Parameters

content

MessageContent

Text or MessageBuilder, sent to the author as a DM

Returns

Promise<SentMessage>

On this page