Home Manual Reference Source Repository
public class | source

Command

A command that can be run in a bot

Static Method Summary

Static Public Methods
public static

isEnabled(settings: SettingStorage, guild: Guild, command: Command | string): boolean

Checks if a command is enabled on a guild

public static

setEnabled(settings: SettingStorage, guild: Guild | string, command: Command | string, enabled: boolean)

Enables or disables a command on a guild

Constructor Summary

Public Constructor
public

constructor(bot: Bot, info: CommandInfo)

Member Summary

Public Members
public
public
public
public
public

bot: Bot

public
public
public
public
public
public
public
public
public
public

Method Summary

Public Methods
public

hasPermission(guild: Guild, user: User): boolean

Checks a user's permission on a guild

public

Checks if the command is enabled on a guild

public

isUsable(message: Message): boolean

Checks if the command is usable for a message

public

run(message: Message, args: string[], fromPattern: boolean): Promise<CommandResult | string[] | string>

Runs the command

public

setEnabled(guild: Guild | string, enabled: boolean)

Enables or disables the command on a guild

Static Public Methods

public static isEnabled(settings: SettingStorage, guild: Guild, command: Command | string): boolean source

Checks if a command is enabled on a guild

Params:

NameTypeAttributeDescription
settings SettingStorage

The setting storage to use

guild Guild

The guild

command Command | string

The command or command name

Return:

boolean

Whether or not the command is enabled

See:

public static setEnabled(settings: SettingStorage, guild: Guild | string, command: Command | string, enabled: boolean) source

Enables or disables a command on a guild

Params:

NameTypeAttributeDescription
settings SettingStorage

The setting storage to use

guild Guild | string

The guild or guild ID

command Command | string

The command or command name

enabled boolean

Whether the command should be enabled or disabled

See:

Public Constructors

public constructor(bot: Bot, info: CommandInfo) source

Params:

NameTypeAttributeDescription
bot Bot

The bot the command is for

info CommandInfo

The command information

Public Members

public aliases: string[] source

See:

public argsCount: number source

See:

public argsSingleQuotes: boolean source

See:

public argsType: string source

See:

public bot: Bot source

public defaultHandling: boolean source

See:

public description: string source

See:

public details: string source

See:

public examples: string[] source

See:

public guildOnly: boolean source

See:

public memberName: string source

See:

public module: string source

See:

public name: string source

See:

public patterns: RegExp[] source

See:

public usage: string source

See:

Public Methods

public hasPermission(guild: Guild, user: User): boolean source

Checks a user's permission on a guild

Params:

NameTypeAttributeDescription
guild Guild

The guild to test the user's permission in

user User

The user to test the permission of

Return:

boolean

Whether or not the user has permission to use the command in a guild

public isEnabled(guild: Guild): boolean source

Checks if the command is enabled on a guild

Params:

NameTypeAttributeDescription
guild Guild

The guild

Return:

boolean

Whether or not the command is enabled

See:

public isUsable(message: Message): boolean source

Checks if the command is usable for a message

Params:

NameTypeAttributeDescription
message Message
  • nullable: true

The message

Return:

boolean

Whether or not the command is usable

public run(message: Message, args: string[], fromPattern: boolean): Promise<CommandResult | string[] | string> source

Runs the command

Params:

NameTypeAttributeDescription
message Message

The message the command is being run for

args string[]

The arguments for the command, or the matches from a pattern

fromPattern boolean

Whether or not the command is being run from a pattern match or not

Return:

Promise<CommandResult | string[] | string>

The result of running the command

public setEnabled(guild: Guild | string, enabled: boolean) source

Enables or disables the command on a guild

Params:

NameTypeAttributeDescription
guild Guild | string

The guild or guild ID

enabled boolean

Whether the command should be enabled or disabled

See: