WorkerShardingStrategy
ClassOn 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.
Constructor
WorkerShardingStrategy.new(manager, options) The class table is callable, so WorkerShardingStrategy(manager, options) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
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. |
local discord = require("discord")
local object = discord.WorkerShardingStrategy({}, {})Properties
- 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.
- 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.
- 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
- 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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
shardId |
string |
required | Snowflake id string. |
payload |
any |
required | Passed through to the implementation as written. |
Returns
WorkerShardingStrategy — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a WorkerShardingStrategy
object:send("123", payload)WorkerShardingStrategy:spawn()
#Start child processes or shards.
Signature
WorkerShardingStrategy:spawn(shardIds) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
shardIds |
any |
required | Passed through to the implementation as written. |
Returns
WorkerShardingStrategy — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a WorkerShardingStrategy
object:spawn(shardIds)Examples
local discord = require("discord")
local object = discord.WorkerShardingStrategy({})Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationCommandNumericOptionMinMaxValueMixin · ApplicationCommandOptionBase
Version: discord 1.2.9 · runtime 1.0.0