Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BotCommunication

Hierarchy

  • EventEmitter
    • BotCommunication

Index

Constructors

constructor

Properties

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: keyof symbol

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Accessors

Static identifier

  • get identifier(): number

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

broadcast

  • broadcast(event: string): Promise<Serializable[]>
  • Send and receive the data returned from the registered event for each shard

    Parameters

    • event: string

      The registered event to be emitted

    Returns Promise<Serializable[]>

emit

  • emit(event: string | symbol, ...args: unknown[]): boolean
  • emit(event: string | symbol, ...args: unknown[]): Promise<unknown>
  • {@link EventEmitter} 'emit' override to return a {@link Promise} with the return value of the registered listener

    Parameters

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

    Returns boolean

  • Parameters

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

    Returns Promise<unknown>

eventNames

  • eventNames(): Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number

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: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (bot: Bot) => void): this
  • {@link EventEmitter} 'on' override to resolve with the listener's returned value

    Parameters

    • event: string | symbol

      Event name

    • listener: (bot: Bot) => void

      Callback to be executed when this event is emitted

        • (bot: Bot): void
        • Parameters

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...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(event?: string | symbol): this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

send

  • send(event: string, shardId: ShardId): Promise<Serializable>
  • Send and receive the data returned from the registered event for the shard matching the supplied ID

    Parameters

    • event: string

      The registered event to be emitted

    • shardId: ShardId

      The ID of the shard where this event should be emitted

    Returns Promise<Serializable>

setMaxListeners

  • setMaxListeners(n: number): this

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc