Options
All
  • Public
  • Public/Protected
  • All
Menu

Master process controller

Hierarchy

  • EventEmitter<{ CLUSTER_STARTED: Cluster; CLUSTER_STOPPED: Cluster; DEBUG: string; READY: Master }>
    • Master

Index

Constructors

constructor

  • Creates a new Master instance

    Parameters

    • fileName: string

      Location of Worker file

    • options: BotOptions

      Options

    Returns Master

Properties

chunks

chunks: number[][] = ...

Chunked Numbers for shards / cluster

fileName

fileName: string

File name to spawn with

handlers

handlers: { emit: <K>(event: K, cluster: Cluster, data: ThreadEvents[K]["send"], resolve: ResolveFunction<K>) => boolean; on: <K>(event: K, listener: (cluster: Cluster, data: ThreadEvents[K]["send"], resolve: ResolveFunction<K>) => void) => any } = ...

Type declaration

  • emit: <K>(event: K, cluster: Cluster, data: ThreadEvents[K]["send"], resolve: ResolveFunction<K>) => boolean
      • <K>(event: K, cluster: Cluster, data: ThreadEvents[K]["send"], resolve: ResolveFunction<K>): boolean
  • on: <K>(event: K, listener: (cluster: Cluster, data: ThreadEvents[K]["send"], resolve: ResolveFunction<K>) => void) => any
      • <K>(event: K, listener: (cluster: Cluster, data: ThreadEvents[K]["send"], resolve: ResolveFunction<K>) => void): any
      • Type parameters

        Parameters

        • event: K
        • listener: (cluster: Cluster, data: ThreadEvents[K]["send"], resolve: ResolveFunction<K>) => void

        Returns any

log

log: (msg: string, cluster?: Cluster) => void

Log function

Type declaration

    • (msg: string, cluster?: Cluster): void
    • Parameters

      • msg: string
      • Optional cluster: Cluster

      Returns void

options

options: CompleteBotOptions

Options

processes

processes: Collection<string, Cluster> = ...

Process list (including custom processes)

rest

rest: RestManager = ...

Rest Manager (only set after running .start())

session

session: APIGatewaySessionStartLimit

Session data (Set after .start())

sharder

sharder: Sharder = ...

Sharding manager for handling shard ratelimits

spawned

spawned: boolean = false

Whether or not the master has been spawned

Accessors

clusters

  • get clusters(): Collection<string, Cluster>

Methods

broadcastEval

  • broadcastEval(code: string): Promise<any[]>

debug

  • debug(msg: string): void

getStats

guildToCluster

  • guildToCluster(guildId: string): Cluster

guildToShard

  • guildToShard(guildId: string): number

sendToAll

shardToCluster

  • shardToCluster(shardId: number): Cluster

spawnProcess

  • spawnProcess(name: string, fileName: string): Cluster
  • Spawns a custom process

    Parameters

    • name: string

      Name of the process (especially for logging)

    • fileName: string

      Direct path for process

    Returns Cluster

    The new Cluster thread created

start

  • start(): Promise<void>

tellAll

  • tellAll<K>(event: K, data: ThreadEvents[K]["send"], all?: boolean): any[]
  • Sends a TELL event to all clusters

    Type parameters

    Parameters

    • event: K

      Event name

    • data: ThreadEvents[K]["send"]

      Event data

    • all: boolean = false

      Whether or not to send to all processes, including custom ones

    Returns any[]

    Nothing

Legend

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

Generated using TypeDoc