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 clientClient The CloudStorm client instance. optionsManagerOptionsThe manager options.
note
The constructor automatically hooks into the CloudStorm client to:
- Forward
VOICE_STATE_UPDATEandVOICE_SERVER_UPDATEgateway events toupdateVoiceState()via theeventlistener. - Throw a
MagmaStreamErrorif theGUILD_VOICE_STATESintent (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): AnyGuildResolves a guild using the user-provided
getGuildcache callback configured inManagerOptions.Parametersโ
Parameter Type Description Optional guildIdstring The 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
PortableUserobject. CloudStorm has no user cache, so only theidandusername(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 idand optionallyusername.
send()โ
note
This method is protected. It is called internally and is not intended for direct use.
protected override send(packet: GatewayVoiceStateUpdate): voidSends a voice state update packet to Discord via the correct CloudStorm shard, calculated from the guild ID.
Parametersโ
Parameter Type Description Optional packetGatewayVoiceStateUpdate The voice state update packet to send.