Manager
Coordinates nodes, players, source-aware searches, typed events, and saved state. Search selection is separate from playback-node selection.
Signatures below match the public source surface in 2.10.5. Use manager/player factories for ordinary application setup.
Constructor
constructor(options: StandaloneManagerOptions);
constructor(options: ManagerOptions, isWrapper: true);
constructor(options: ManagerOptions, isWrapper: boolean = false);
Properties
Methods
init
public async init(options: ManagerInitOptions = {}): Promise<this>;
Initiates the Manager.
search
public async search<T = unknown>(query: string | SearchQuery, requester?: T): Promise<SearchResult>;
Builds and normalizes source-aware load requests. Native prefixes/modifiers route to NodeLink; raw Spotify mix recommendations route to Lavalink. Shared string prefixes can use either backend.
getPlayer
public getPlayer(guildId: string): Player | undefined;
Returns a player or undefined if it does not exist.
create
public create(options: PlayerOptions): Player;
Creates a player or returns one if it already exists.
destroy
public async destroy(guildId: string): Promise<void>;
Destroys a player.
createNode
public createNode(options: NodeOptions): Node;
Creates a new node or returns an existing one if it already exists.
destroyNode
public async destroyNode(identifier: string): Promise<void>;
Destroys a node if it exists. Emits a debug event if the node is found and destroyed.
on
public on<T extends keyof ManagerEvents>(event: T, listener: (...args: ManagerEvents[T]) => void): this;
Attaches an event listener to the manager.
updateVoiceState
public async updateVoiceState(data: VoicePacket | VoiceServer | DiscordVoiceState): Promise<void>;
Updates the voice state of a player based on the provided data.
decodeTracks
public async decodeTracks(tracks: string[]): Promise<TrackData[]>;
Decodes an array of base64 encoded tracks and returns an array of TrackData.
decodeTrack
public async decodeTrack(track: string): Promise<TrackData>;
Decodes a base64 encoded track and returns a TrackData.
savePlayerState
public async savePlayerState(guildId: string): Promise<void>;
Saves player states.
loadPlayerStates
public async loadPlayerStates(nodeId: string): Promise<void>;
Restores saved player state for a node, including portable autoplay requester data where available.
handleShutdown
public async handleShutdown(stopProcess?: () => Promise<void>): Promise<void>;
Saves state and performs manager shutdown; an optional callback supplies application process shutdown behavior.
cleanupInactivePlayer
public async cleanupInactivePlayer(guildId: string): Promise<void>;
Cleans up an inactive player by removing its state data.
sendPacket
public sendPacket(packet: GatewayVoiceStateUpdate): unknown;
Sends a Discord gateway voice packet through the configured adapter.
resolveUser
public async resolveUser(user: AnyUser | string): Promise<AnyUser>;
Resolves a PortableUser or ID to a real user object.
resolveGuild
public resolveGuild(guildId: string): AnyGuild;
Resolves a Guild ID to a real guild object.