Interface: StandaloneManagerOptions
Extends
ManagerOptionswith required cache hooks for directnew Manager(...)instantiation.The built-in wrappers (
DiscordJSManager,ErisManager, etc.) provide these hooks automatically. UseStandaloneManagerOptionsonly when constructing aManagerdirectly — for example when using a Discord library that has no built-in MagmaStream wrapper.
Property Type Description Optional getGuildfunction Required. Guild cache getter (id: string) => AnyGuild | undefined. Called when resolving a guild by ID.getUserfunction Required. User cache getter (id: string) => AnyUser | undefined. Called when resolving a user by ID....all other ManagerOptions— All fields from ManagerOptionsare 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);