SimpleShardingStrategy
ClassOn this page
SimpleShardingStrategy 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
SimpleShardingStrategy.new(manager) The class table is callable, so SimpleShardingStrategy(manager) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
manager |
any |
required | Passed through to the implementation as written. |
local discord = require("discord")
local object = discord.SimpleShardingStrategy({})Properties
- Name
manager- Type
any- Access
- readonly
- Description
- Instance field
SimpleShardingStrategy.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 SimpleShardingStrategy.
- Name
shards- Type
- Collection
- Access
- readonly
- Description
- Instance field
SimpleShardingStrategy.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 SimpleShardingStrategy.
- Related
- Collection
Methods
SimpleShardingStrategy:connect()
#Performs connect on this SimpleShardingStrategy. Call it from bot code when you need that operation on the current object.
Signature
SimpleShardingStrategy:connect() Parameters
No parameters.
Returns
SimpleShardingStrategy — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SimpleShardingStrategy
object:connect()SimpleShardingStrategy:destroy()
#Close the Gateway, voice, and REST resources owned by this client.
Signature
SimpleShardingStrategy: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
SimpleShardingStrategy — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SimpleShardingStrategy
object:destroy({})SimpleShardingStrategy:fetchStatus()
#Fetch Status from REST and update the local cache when the request succeeds.
Signature
SimpleShardingStrategy:fetchStatus() Parameters
No parameters.
Returns
SimpleShardingStrategy — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SimpleShardingStrategy
object:fetchStatus()SimpleShardingStrategy:send()
#Send a message, payload, or packet using this object.
Signature
SimpleShardingStrategy: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
SimpleShardingStrategy — the same instance, for chaining.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a SimpleShardingStrategy
object:send("123", payload)SimpleShardingStrategy:spawn()
#Start child processes or shards.
Signature
SimpleShardingStrategy:spawn(shardIds) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
shardIds |
any |
required | Passed through to the implementation as written. |
Returns
SimpleShardingStrategy — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SimpleShardingStrategy
object:spawn(shardIds)Examples
local discord = require("discord")
local object = discord.SimpleShardingStrategy({})Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationCommandNumericOptionMinMaxValueMixin · ApplicationCommandOptionBase
Version: discord 1.2.9 · runtime 1.0.0