Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CommandClient

Command Client, hooks onto the ShardClient to provide easier command handling Flow is onMessageCheck -> onPrefixCheck -> onCommandCheck

Hierarchy

  • EventSpewer
    • CommandClient

Implements

  • EventEmitter

Index

Constructors

constructor

Properties

_clientSubscriptions

_clientSubscriptions: Array<EventSubscription> = []

activateOnEdits

activateOnEdits: boolean = false

client

commands

commands: Array<Command>

ignoreMe

ignoreMe: boolean = true

maxEditDuration

maxEditDuration: number = 5 * 60 * 1000

mentionsEnabled

mentionsEnabled: boolean = true

prefixes

prefixes: object

Type declaration

  • custom: BaseSet<string>
  • mention: BaseSet<string>

ran

ran: boolean

ratelimits

ratelimits: Array<CommandRatelimit> = []

replies

replies: BaseCollection<string, CommandReply>

Accessors

rest

  • Returns RestClient | Client

Methods

add

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

addMentionPrefixes

  • addMentionPrefixes(): void
  • Returns void

addMultiple

addMultipleIn

  • addMultipleIn(directory: string, options?: object): Promise<CommandClient>
  • Parameters

    • directory: string
    • Default value options: object = {}
      • Optional isAbsolute?: undefined | false | true
      • Optional subdirectories?: undefined | false | true

    Returns Promise<CommandClient>

clear

  • clear(): void
  • Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getAttributes

getCommand

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getPrefixes

  • getPrefixes(context: Context): Promise<BaseSet<string>>
  • Parameters

    Returns Promise<BaseSet<string>>

handle

handleDelete

  • handleDelete(name: string, deletePayload: object): Promise<void>
  • Parameters

    • name: string
    • deletePayload: object
      • raw: object
        • id: string

    Returns Promise<void>

handleMessageCreate

  • Parameters

    Returns Promise<void>

handleMessageUpdate

  • Parameters

    Returns Promise<void>

hasEventListener

  • hasEventListener(name: string | symbol): boolean
  • Parameters

    • name: string | symbol

    Returns boolean

kill

  • kill(): void
  • Returns void

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • on(event: "commandDelete", listener: function): this
  • on(event: "commandError", listener: function): this
  • on(event: "commandFail", listener: function): this
  • on(event: "commandNone", listener: function): this
  • on(event: "commandPermissionsFailClient", listener: function): this
  • on(event: "commandPermissionsFail", listener: function): this
  • on(event: "commandRan", listener: function): this
  • on(event: "commandRatelimit", listener: function): this
  • on(event: "commandResponseDelete", listener: function): this
  • on(event: "commandRunError", listener: function): this
  • on(event: "killed", listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    Returns this

  • Parameters

    Returns this

  • Parameters

    • event: "commandFail"
    • listener: function

    Returns this

  • Parameters

    • event: "commandNone"
    • listener: function

    Returns this

  • Parameters

    Returns this

  • Parameters

    Returns this

  • Parameters

    • event: "commandRan"
    • listener: function

    Returns this

  • Parameters

    Returns this

  • Parameters

    Returns this

  • Parameters

    Returns this

  • Parameters

    • event: "killed"
    • listener: function
        • (): any
        • Returns any

    Returns this

Optional onCommandCheck

  • onCommandCheck(context: Context, command: Command): boolean | Promise<boolean>
  • Parameters

    Returns boolean | Promise<boolean>

Optional onMessageCheck

  • onMessageCheck(context: Context): boolean | Promise<boolean>
  • Parameters

    Returns boolean | Promise<boolean>

Optional onPrefixCheck

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(name?: string | symbol): this
  • Parameters

    • Optional name: string | symbol

    Returns this

removeAllSubscriptions

  • removeAllSubscriptions(): this
  • Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

removeSubscription

  • removeSubscription(subscription: EventSubscription): void
  • Parameters

    • subscription: EventSubscription

    Returns void

resetSubscriptions

  • resetSubscriptions(): void
  • Returns void

run

setActivateOnEdits

  • setActivateOnEdits(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

setMaxEditDuration

  • setMaxEditDuration(value: number): void
  • Parameters

    • value: number

    Returns void

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setMentionsEnabled

  • setMentionsEnabled(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

setPrefixSpace

  • setPrefixSpace(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

setSubscriptions

  • setSubscriptions(): void
  • Returns void

storeReply

  • Parameters

    Returns void

subscribe

  • subscribe(name: string | symbol, listener: function): EventSubscription
  • Parameters

    • name: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns EventSubscription

Generated using TypeDoc