DiscordLua
discorddiscord
v1.2.9
Install

WorkerShardingStrategy

Class
On this page

WorkerShardingStrategy is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.

class Module 1.2.9 Source

Constructor

WorkerShardingStrategy.new(manager, options)

The class table is callable, so WorkerShardingStrategy(manager, options) is the same as .new.

NameTypeRequiredBehavior
manager any required Passed through to the implementation as written.
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
lua
local discord = require("discord")
local object = discord.WorkerShardingStrategy({}, {})

Properties

WorkerShardingStrategy.manager

# readonly
Name
manager
Type
any
Access
readonly
Description
Instance field WorkerShardingStrategy.manager. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this WorkerShardingStrategy.

WorkerShardingStrategy.options

# readonly
Name
options
Type
any
Access
readonly
Description
Instance field WorkerShardingStrategy.options. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this WorkerShardingStrategy.

WorkerShardingStrategy.shards

# readonly
Name
shards
Type
Collection
Access
readonly
Description
Instance field WorkerShardingStrategy.shards. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this WorkerShardingStrategy.
Related
Collection

WorkerShardingStrategy.shardsPerWorker

# readonly
Name
shardsPerWorker
Type
any
Access
readonly
Description
Instance field WorkerShardingStrategy.shardsPerWorker. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this WorkerShardingStrategy.

Methods

WorkerShardingStrategy:connect()

#

Performs connect on this WorkerShardingStrategy. Call it from bot code when you need that operation on the current object.

Signature

WorkerShardingStrategy:connect()

Parameters

No parameters.

Returns

WorkerShardingStrategy — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a WorkerShardingStrategy
object:connect()

WorkerShardingStrategy:destroy()

#

Close the Gateway, voice, and REST resources owned by this client.

Signature

WorkerShardingStrategy:destroy(options)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

WorkerShardingStrategy — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a WorkerShardingStrategy
object:destroy({})

WorkerShardingStrategy:fetchStatus()

#

Fetch Status from REST and update the local cache when the request succeeds.

Signature

WorkerShardingStrategy:fetchStatus()

Parameters

No parameters.

Returns

WorkerShardingStrategy — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a WorkerShardingStrategy
object:fetchStatus()

WorkerShardingStrategy:send()

#

Send a message, payload, or packet using this object.

Signature

WorkerShardingStrategy:send(shardId, payload)

Parameters

NameTypeRequiredBehavior
shardId string required Snowflake id string.
payload any required Passed through to the implementation as written.

Returns

WorkerShardingStrategy — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a WorkerShardingStrategy
object:send("123", payload)

WorkerShardingStrategy:spawn()

#

Start child processes or shards.

Signature

WorkerShardingStrategy:spawn(shardIds)

Parameters

NameTypeRequiredBehavior
shardIds any required Passed through to the implementation as written.

Returns

WorkerShardingStrategy — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a WorkerShardingStrategy
object:spawn(shardIds)

Examples

lua
local discord = require("discord")
local object = discord.WorkerShardingStrategy({})

ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationCommandNumericOptionMinMaxValueMixin · ApplicationCommandOptionBase

Version: discord 1.2.9 · runtime 1.0.0

Search Ctrl K Navigate Open Esc