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.3. 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.