Hierarchy (view full)

Implements

Constructors

  • Creates a new CommandContext associated to a Command.

    Parameters

    Returns CommandContext

Properties

argumentParser?: ArgumentParser

The argument parser of this context, if the command has no arguments it will be undefined.

command: Command

The command itself.

handler: typeof CommandHandler

The handler.

message: Message<boolean>

The message that executed the command.

rawArgs: string[]

The arguments in the message.

Accessors

  • get args(): string[]
  • The old list of raw arguments.

    Returns string[]

    Deprecated

  • get argsString(): string
  • Returns the arguments joined with a space between each.

    Returns string

  • get arguments(): CommandArgument<any>[]
  • Returns the list of arguments of the command.

    Returns CommandArgument<any>[]

  • get channel(): DMChannel | PartialDMChannel | NewsChannel | StageChannel | TextChannel | ThreadChannel | VoiceChannel
  • Returns the channel where the command was executed.

    Returns DMChannel | PartialDMChannel | NewsChannel | StageChannel | TextChannel | ThreadChannel | VoiceChannel

  • get commandName(): string
  • Returns the name of the command executed.

    Returns string

  • get content(): string
  • Returns the content of the message.

    Returns string

  • get guild(): null | Guild
  • Returns the guild of the message.

    Returns null | Guild

  • get isCallingASubCommand(): boolean
  • Returns true if the arguments are calling a SubCommand.

    Returns boolean

  • get member(): null | GuildMember
  • Returns the member of the message, null if executed in private messages.

    Returns null | GuildMember

  • get prefix(): string
  • Returns the prefix used in the message.

    Returns string

  • get textChannel(): undefined | NewsChannel | TextChannel
  • Returns the channel where the command was executed as a TextChannel or undefined if it isn't.

    Returns undefined | NewsChannel | TextChannel

  • get thread(): undefined | ThreadChannel
  • Returns the channel where the command was executed as a ThreadChannel or undefined if it isn't.

    Returns undefined | ThreadChannel

  • get user(): User
  • Returns the author of the message.

    Returns User

Methods

  • Returns an argument. If the argument is errored or not found it will return null.

    Type Parameters

    • T

      The type of the argument.

    Parameters

    • name: string

      The name of the argument.

    Returns Promise<null | T>

    • The argument in a promise or null if the argument is not found or errored or the command has no arguments.
  • Parameters

    • number: number
    • Optional filterOld: boolean

    Returns Promise<Collection<string, Message<boolean>>>

  • Parameters

    • number: Collection<string, Message<boolean>>
    • Optional filterOld: boolean

    Returns Promise<Collection<string, Message<boolean>>>

  • Parameters

    • number: readonly MessageResolvable[]
    • Optional filterOld: boolean

    Returns Promise<Collection<string, Message<boolean>>>

  • Create a Thread, returns undefined if already in a Thread.

    Parameters

    • options: StartThreadOptions

      The options of the Thread.

    Returns undefined | Promise<ThreadChannel>

    • The resulting Thread.
  • Deletes the message with an optional timeout.

    Parameters

    • timeout: number = 0

      The time to wait in milliseconds before deleting the message.

    Returns Promise<Message<boolean>>

    • The deleted message.
  • Add one or multiple reactions to a message.

    Parameters

    • Rest ...emoji: EmojiIdentifierResolvable[]

      The emoji to react with, can be custom or native.

    Returns Promise<void>

    Remarks

    React in the order of emoji used.

  • Remove all the reactions.

    Returns Promise<void>

  • Remove one or multiple reactions from emojis.

    Parameters

    • Rest ...emojis: EmojiIdentifierResolvable[]

      The list of emoji reactions to remove.

    Returns Promise<void>

  • Remove one or multiple reactions from the bot.

    Parameters

    • Rest ...emojis: EmojiIdentifierResolvable[]

      The emojis the bot has to remove reaction from.

    Returns Promise<void>

  • Parameters

    • options: ReplyOptions

    Returns Promise<Message<boolean>>

  • Parameters

    • content: string

    Returns Promise<Message<boolean>>

  • Parameters

    • content: string
    • options: ReplyOptions

    Returns Promise<Message<boolean>>

  • Resolves one of the argument. If the argument is errored it will return a CommandError.

    Type Parameters

    • T

      The type of the argument.

    Parameters

    • name: string

      The name of the argument.

    Returns undefined | Awaitable<ArgumentResolved<T>>

    • The result of the argument maybe in a promise or undefined if no arguments with this name exists or the command has no arguments.

    Remarks

    Internally it uses resolveArguments.

  • Resolves all of the arguments of the command. If an argument has an error it will return a CommandError.

    Type Parameters

    • A extends any[]

    Returns Promise<undefined | Map<string, ArgumentResolved<A[number]>>>

    • A map of arguments or undefined if the command has no arguments.
  • Parameters

    • options: SendOptions

    Returns Promise<Message<boolean>>

  • Parameters

    • content: string

    Returns Promise<Message<boolean>>

  • Parameters

    • content: string
    • options: SendOptions

    Returns Promise<Message<boolean>>

  • Sends the help menu from the default HelpCommand command (even if you are not using it).

    Returns Promise<Message<boolean>>

    • The message of the help menu.
  • Sends the help menu of the command from the default HelpCommand command (even if you are not using it).

    Parameters

    • commandName: string = ...

      The name of the command to send the help menu.

    Returns Promise<undefined | Message<boolean>>

    • The message of the help menu of the command.

Generated using TypeDoc