Skip to main content
Version: v2.10.2 (current)

CloudStorm Wrapper

Table of Contentsโ€‹

Class Definitionโ€‹

export class CloudstormManager extends Manager {}
note

CloudStorm is a gateway-only library โ€” it has no built-in user or guild cache. You must manually call manager.init({ clientId: "your-bot-id" }) inside your ready event handler.

Constructorโ€‹

new CloudstormManager(client: Client, options?: ManagerOptions)
Parameter Type Description Optional
clientClientThe CloudStorm client instance.
optionsManagerOptionsThe manager options.
note

The constructor automatically hooks into the CloudStorm client to:

  • Forward VOICE_STATE_UPDATE and VOICE_SERVER_UPDATE gateway events to updateVoiceState() via the event listener.
  • Throw a MagmaStreamError if the GUILD_VOICE_STATES intent (128) is not set on the client.

Example:

import { CloudstormManager } from "magmastream";

const client = new Client("token", { intents: ["GUILDS", "GUILD_VOICE_STATES"] });
const manager = new CloudstormManager(client, {
nodes: [{ host: "localhost", port: 2333, password: "youshallnotpass" }],
send: (packet) => { /* handle manually if needed */ },
});

client.once("ready", async () => {
await manager.init({ clientId: "your-bot-id" });
});

Methodsโ€‹

resolveGuild()โ€‹

override resolveGuild(guildId: string): AnyGuild

Resolves a guild using the user-provided getGuild cache callback configured in ManagerOptions.

Parametersโ€‹

Parameter Type Description Optional
guildIdstringThe guild ID to resolve.

Returnsโ€‹

Type Description
AnyGuildThe resolved guild from the cache callback.

resolveUser()โ€‹

override async resolveUser(user: AnyUser | string): Promise<PortableUser>

Returns a minimal PortableUser object. CloudStorm has no user cache, so only the id and username (if already on the object) are returned.

Parametersโ€‹

Parameter Type Description Optional
userAnyUser | stringThe user object or user ID to resolve.

Returnsโ€‹

Type Description
Promise<PortableUser>A minimal user object with id and optionally username.

send()โ€‹

note

This method is protected. It is called internally and is not intended for direct use.

protected override send(packet: GatewayVoiceStateUpdate): void

Sends a voice state update packet to Discord via the correct CloudStorm shard, calculated from the guild ID.

Parametersโ€‹

Parameter Type Description Optional
packetGatewayVoiceStateUpdateThe voice state update packet to send.