Private
_restPrivate
_updateMethod to grab initial connection info from Discord. Should only be called automatically by the lib unless you are a large bot with a max_concurrency not equal to 1. If you are a large bot, you should call this method at a rate of your own discretion to update your max_concurrency cached value to have up to date bucket info.
The amount of shards the bot should spawn if set to auto.
Send an OP 3 PRESENCE_UPDATE to Discord, which updates the status of all shards facilitated by this client's ShardManager.
Promise that's resolved once all shards have sent the websocket payload.
// Connect to Discord and set status to do not disturb and game to "Memes are Dreams".
const CloudStorm = require("cloudstorm"); // CloudStorm also supports import statements.
const token = "token";
const client = new CloudStorm.Client(token);
client.connect();
client.once("ready", () => {
// Client is connected to Discord and is ready, so we can update the status.
client.presenceUpdate({ status: "dnd", game: { name: "Memes are Dreams" } });
});
Send an OP 8 REQUEST_GUILD_MEMBERS to Discord.
Promise that's resolved once the payload was send to Discord.
// Connect to Discord and request guild members.
const CloudStorm = require("cloudstorm"); // CloudStorm also supports import statements.
const token = "token";
const client = new CloudStorm.Client(token);
client.connect();
client.once("ready", () => {
// Client is connected to Discord and is ready, so we can send the request guild members payload.
// We will use shard 0 as the shard to send the payload.
client.requestGuildMembers(0, { guild_id: "id" });
});
id of the shard that should send the payload.
Request guild members data to send.
Send an OP 3 PRESENCE_UPDATE to Discord, which updates the status of a single shard facilitated by this client's ShardManager.
Promise that's resolved once the shard has sent the websocket payload.
// Connect to Discord and set status to do not disturb and game to "Im shard 0".
const CloudStorm = require("cloudstorm"); // CloudStorm also supports import statements.
const token = "token";
const client = new CloudStorm.Client(token);
client.connect();
client.once("ready", () => {
// Client is connected to Discord and is ready, so we can update the status of shard 0.
client.shardPresenceUpdate(0, { status: "dnd", game: { name: "Im shard 0" } });
});
id of the shard that should update it's status.
Presence data to send.
Send an OP 4 VOICE_STATE_UPDATE to Discord. this does not allow you to send audio with CloudStorm itself, it just provides the necessary data for another application to send audio data to Discord.
Promise that's resolved once the payload was sent to Discord.
// Connect to Discord and join a voice channel
const CloudStorm = require("cloudstorm"); // CloudStorm also supports import statements.
const token = "token";
const client = new CloudStorm.Client(token);
client.connect();
client.once("ready", () => {
// Client is connected to Discord and is ready, so we can join a voice channel.
// We will use shard 0 as the shard to send the payload.
client.voiceStateUpdate(0, { guild_id: "id", channel_id: "id", self_mute: false, self_deaf: false });
});
id of the shard that should send the payload.
Voice state update data to send.
Create a new Client to connect to the Discord gateway.
Token received from creating a discord bot user, which will be used to connect to the gateway.
Generated using TypeDoc
Main class used for receiving events and interacting with the Discord gateway.