Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Worker<ExtraEvents>

Cluster Worker used on the worker thread

Type parameters

  • ExtraEvents = {}

Hierarchy

Index

Constructors

constructor

  • new Worker<ExtraEvents>(connectComms?: boolean): Worker<ExtraEvents>
  • Type parameters

    • ExtraEvents = {}

    Parameters

    • connectComms: boolean = true

    Returns Worker<ExtraEvents>

Properties

api

api: RestManager

cacheManager

cacheManager: CacheManager = ...

channels

channels: Collection<string, APIChannel> = ...

Cached channels

comms

comms: Thread

Thread communications

guildRoles

guildRoles: Collection<string, Collection<string, APIRole>> = ...

Cached roles

guilds

guilds: Collection<string, CachedGuild> = ...

Cached guilds

members

members: Collection<string, Collection<string, GatewayGuildMemberAddDispatchData>> = ...

Cached members

options

options: CompleteBotOptions = ...

Bot options

selfMember

selfMember: Collection<string, GatewayGuildMemberAddDispatchData> = ...

Cached self members

shards

shards: Collection<number, Shard> = ...

All shards on this cluster

Optional status

status?: GatewayPresenceUpdateData

The status that the worker will retain when a shard restarts, to change use Worker.setStatus() for no unintended side affects

user

user: APIUser = ...

Self user

users

users: Collection<string, APIUser> = ...

Cached users

voiceStates

voiceStates: Collection<string, CachedVoiceState> = ...

Cached voice states

Accessors

ready

  • get ready(): boolean
  • Whether or not all shards are online and ready

    Returns boolean

Methods

getMembers

  • getMembers(guildId: string): Promise<Collection<any, APIGuildMember>>
  • Gets ALL members in a guild (via ws)

    Parameters

    • guildId: string

      ID of guild

    Returns Promise<Collection<any, APIGuildMember>>

guildShard

  • guildShard(guildId: string): Shard
  • Gets shard in charge of specific guild

    Parameters

    • guildId: string

      ID of guild

    Returns Shard

log

  • log(...data: any[]): void
  • Log something to master

    Parameters

    • Rest ...data: any[]

      What to log

    Returns void

setStatus

  • setStatus(type: "playing" | "streaming" | "listening" | "watching" | "competing", name: string, status?: "idle" | "online" | "dnd" | "offline" | "invisible", url?: string): void
  • Sets the status of the client

    example

    worker.setStatus('playing', 'Rocket League', 'online') // Playing Rocket League // Twitch streams worker.setStatus('streaming', 'Rocket League', 'online', 'https://twitch.com/jpbberry')

    Parameters

    • type: "playing" | "streaming" | "listening" | "watching" | "competing"

      Type of status, e.g "playing" is "Playing Game!"

    • name: string

      Name of status, in this case Game

    • status: "idle" | "online" | "dnd" | "offline" | "invisible" = 'online'

      Status type

    • Optional url: string

      Optional url for twitch stream

    Returns void

start

  • start(shardNumbers: number[]): Promise<void>
  • Parameters

    • shardNumbers: number[]

    Returns Promise<void>

Generated using TypeDoc