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

Interface: StandaloneManagerOptions

Extends ManagerOptions with required cache hooks for direct new Manager(...) instantiation.

The built-in wrappers (DiscordJSManager, ErisManager, etc.) provide these hooks automatically. Use StandaloneManagerOptions only when constructing a Manager directly — for example when using a Discord library that has no built-in MagmaStream wrapper.

Property Type Description Optional
getGuildfunctionRequired. Guild cache getter (id: string) => AnyGuild | undefined. Called when resolving a guild by ID.
getUserfunctionRequired. User cache getter (id: string) => AnyUser | undefined. Called when resolving a user by ID.
...all other ManagerOptionsAll fields from ManagerOptions are inherited.
note

StandaloneManagerOptions is the correct overload when calling new Manager(options) without a second isWrapper argument. If you are writing a custom wrapper, pass isWrapper: true and use ManagerOptions instead.

Example:

import { Manager, StandaloneManagerOptions } from "magmastream";

const options: StandaloneManagerOptions = {
nodes: [{ host: "localhost", port: 2333, password: "youshallnotpass" }],
send: (packet) => {
const guild = client.guilds.cache.get(packet.d.guild_id);
guild?.shard.send(packet);
},
getUser: (id) => client.users.cache.get(id),
getGuild: (id) => client.guilds.cache.get(id),
};

const manager = new Manager(options);