Options
All
  • Public
  • Public/Protected
  • All
Menu

Context holding all information about a ran command and utility functions

Hierarchy

  • CommandContext

Index

Constructors

constructor

  • new CommandContext(opts: { args: string[]; command: CommandOptions; message: APIMessage; prefix: string; ran: string; worker: Worker }): CommandContext

Properties

args

args: any[]

Command arguments

command

Command options object

isInteraction

isInteraction: boolean = false

Whether or not a command is an interaction or not

message

message: APIMessage

Message which command was ran with

options

options: InteractionOptions = {}

Interaction options if ran as a slash command

prefix

prefix: string

Prefix command was ran with

ran

ran: string

Actual command that was ran (including possible aliases)

worker

worker: Worker

Worker

Accessors

author

  • get author(): APIUser

channel

  • get channel(): undefined | APIChannel

embed

  • get embed(): Embed<APIMessage>

guild

interaction

me

  • get me(): APIGuildMember

member

  • get member(): APIGuildMember

Methods

delete

  • delete(): Promise<never>

dm

error

  • error(message: string | Promise<string>): Promise<void>
  • Runs an error through sendback of commands.error

    Parameters

    • message: string | Promise<string>

      Message of error

    Returns Promise<void>

hasPerms

  • hasPerms(perms: "createInvites" | "kick" | "ban" | "administrator" | "manageChannels" | "manageGuild" | "addReactions" | "auditLog" | "prioritySpeaker" | "stream" | "viewChannel" | "sendMessages" | "tts" | "manageMessages" | "embed" | "files" | "readHistory" | "mentionEveryone" | "externalEmojis" | "viewInsights" | "connect" | "speak" | "mute" | "deafen" | "move" | "useVoiceActivity" | "nickname" | "manageNicknames" | "manageRoles" | "webhooks" | "emojis" | "useSlashCommands" | "useApplicationCommands" | "requestToSpeak" | "manageThreads" | "usePublicThreads" | "usePrivateThreads" | "createPublicThreads" | "createPrivateThreads" | "useExternalStickers" | "sendMessagesInThreads"): boolean
  • Whether or not the running user has a certain permission

    Parameters

    • perms: "createInvites" | "kick" | "ban" | "administrator" | "manageChannels" | "manageGuild" | "addReactions" | "auditLog" | "prioritySpeaker" | "stream" | "viewChannel" | "sendMessages" | "tts" | "manageMessages" | "embed" | "files" | "readHistory" | "mentionEveryone" | "externalEmojis" | "viewInsights" | "connect" | "speak" | "mute" | "deafen" | "move" | "useVoiceActivity" | "nickname" | "manageNicknames" | "manageRoles" | "webhooks" | "emojis" | "useSlashCommands" | "useApplicationCommands" | "requestToSpeak" | "manageThreads" | "usePublicThreads" | "usePrivateThreads" | "createPublicThreads" | "createPrivateThreads" | "useExternalStickers" | "sendMessagesInThreads"

      Permission to test

    Returns boolean

myPerms

  • myPerms(perms: "createInvites" | "kick" | "ban" | "administrator" | "manageChannels" | "manageGuild" | "addReactions" | "auditLog" | "prioritySpeaker" | "stream" | "viewChannel" | "sendMessages" | "tts" | "manageMessages" | "embed" | "files" | "readHistory" | "mentionEveryone" | "externalEmojis" | "viewInsights" | "connect" | "speak" | "mute" | "deafen" | "move" | "useVoiceActivity" | "nickname" | "manageNicknames" | "manageRoles" | "webhooks" | "emojis" | "useSlashCommands" | "useApplicationCommands" | "requestToSpeak" | "manageThreads" | "usePublicThreads" | "usePrivateThreads" | "createPublicThreads" | "createPrivateThreads" | "useExternalStickers" | "sendMessagesInThreads"): boolean
  • Whether or not the bot user has a certain permission

    Parameters

    • perms: "createInvites" | "kick" | "ban" | "administrator" | "manageChannels" | "manageGuild" | "addReactions" | "auditLog" | "prioritySpeaker" | "stream" | "viewChannel" | "sendMessages" | "tts" | "manageMessages" | "embed" | "files" | "readHistory" | "mentionEveryone" | "externalEmojis" | "viewInsights" | "connect" | "speak" | "mute" | "deafen" | "move" | "useVoiceActivity" | "nickname" | "manageNicknames" | "manageRoles" | "webhooks" | "emojis" | "useSlashCommands" | "useApplicationCommands" | "requestToSpeak" | "manageThreads" | "usePublicThreads" | "usePrivateThreads" | "createPublicThreads" | "createPrivateThreads" | "useExternalStickers" | "sendMessagesInThreads"

      Permission to test

    Returns boolean

react

  • react(emoji: string): Promise<never>

reply

  • reply(data: MessageTypes, mention?: boolean, ephermal?: boolean): Promise<APIMessage>
  • Replies to the invoking message

    Parameters

    • data: MessageTypes

      Data for message

    • mention: boolean = false

      Whether or not to mention the user in the reply (defaults to false)

    • ephermal: boolean = false

      Whether to send the message so only the user can see (only available in slash commands)

    Returns Promise<APIMessage>

    Message sent

send

sendFile

  • sendFile(file: { buffer: Buffer; name: string }, extra?: MessageTypes): Promise<APIMessage>
  • Sends a file to the same channel

    Parameters

    • file: { buffer: Buffer; name: string }

      File buffer

      • buffer: Buffer
      • name: string
    • Optional extra: MessageTypes

      Extra message options

    Returns Promise<APIMessage>

typing

  • typing(): Promise<null>

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Static method

Generated using TypeDoc