Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KBotify

Hierarchy

  • KaiheilaBot
    • KBotify

Index

Constructors

constructor

  • new KBotify(config: BotConfig & { debug?: boolean }, omit?: boolean): KBotify
  • Creates an instance of KBotify.

    memberof

    KBotify

    Parameters

    • config: BotConfig & { debug?: boolean }

      the config of bot, please see readme.md

    • omit: boolean = true

    Returns KBotify

Properties

API

API: API

axios

axios: AxiosInstance

cache

cache: CacheManager

collectors

collectors: CollectorManager = ...

commandMap

commandMap: Map<string, AppCommand | MenuCommand> = ...

config

config: BotConfig

event

event: EventProcessor

help

help: string = 'help for this bot.'

logger

logger: Logger = ...

mentionWithSpace

mentionWithSpace: boolean = false
deprecated
memberof

KBotify

message

message: MessageProcessor

messageSource

messageSource: MessageSource

userId

userId: string = 'kaiheila user id for this bot.'

Static Readonly captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: typeof errorMonitor

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.

Methods

addAlias

addCommands

addListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns KBotify

connect

  • connect(): void

defaultHandler

  • defaultHandler(): void

emit

  • emit<K>(event: K, ...args: Parameters<RawEmissions[K]>): boolean
  • Type parameters

    • K: keyof RawEmissions

    Parameters

    • event: K
    • Rest ...args: Parameters<RawEmissions[K]>

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

execute

get

  • get(url: string, params: any): Promise<AxiosResponse<any>>
  • Parameters

    • url: string
    • params: any

    Returns Promise<AxiosResponse<any>>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

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

    • event: 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): KBotify
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns KBotify

on

  • on<K>(event: K, listener: RawEmissions[K]): KBotify

once

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

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

          • Rest ...args: any[]

          Returns void

    Returns KBotify

post

  • post(url: string, data: any): Promise<AxiosResponse<any>>
  • Parameters

    • url: string
    • data: any

    Returns Promise<AxiosResponse<any>>

prependListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns KBotify

prependOnceListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns KBotify

processMsg

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): KBotify
  • Parameters

    • Optional event: string | symbol

    Returns KBotify

removeListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns KBotify

setMaxListeners

  • setMaxListeners(n: number): KBotify
  • Parameters

    • n: number

    Returns KBotify

toJSON

  • toJSON(): { botUserId: string; mode: "webhook" | "websocket" | "pc"; port: undefined | number }
  • Returns { botUserId: string; mode: "webhook" | "websocket" | "pc"; port: undefined | number }

    • botUserId: string
    • mode: "webhook" | "websocket" | "pc"
    • port: undefined | number

Static getEventListener

  • getEventListener(emitter: EventEmitter | DOMEventTarget, name: string | symbol): Function[]
  • Returns a list listener for a specific emitter event name.

    Parameters

    • emitter: EventEmitter | DOMEventTarget
    • name: string | symbol

    Returns Function[]

Static listenerCount

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

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string, options?: StaticEventEmitterOptions): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

Generated using TypeDoc