Interfaces
Comprehensive list of TypeScript interfaces and types used throughout Moonlink.js.
Event Definitions
IManagerEvents
Events emitted by the Manager instance.
Emitted for general debugging logs.
Node Events
Emitted when a node is created.
Emitted when a node is ready to accept requests.
Emitted when a node establishes a WebSocket connection.
Emitted when a node encounters an error.
Emitted when a node successfully reconnects.
Emitted when a node attempts to reconnect.
Emitted when a node session is resumed.
Emitted when a node disconnects.
Emitted when a node is destroyed.
Emitted when a raw packet is received from a node.
Emitted when a node's connection state changes.
Player Events
Emitted when a player is created.
Emitted when a player is destroyed.
Emitted when player update data is received from Lavalink.
Emitted when a player is transferred to a different node.
Emitted when a player starts connecting to voice.
Emitted when a player successfully connects to voice.
Emitted when a player is fully ready.
Emitted when a player starts resuming.
Emitted when a player has successfully resumed.
Emitted when a player disconnects from voice.
Emitted when a player attempts to reconnect.
Emitted when a player moves to a different voice channel.
Emitted when a player's mute state changes.
Emitted when a player's deaf state changes.
Emitted when a player's suppression state changes.
Emitted when autoPlay is toggled.
Emitted when autoLeave is toggled.
Emitted when the volume is changed.
Emitted when the loop mode is changed.
Emitted when the text channel is updated.
Emitted when the voice channel ID is updated manually.
Emitted when the player's node identifier is updated.
Emitted when player recovery begins (e.g. after a crash).
Emitted when player recovery succeeds.
Emitted when player recovery fails.
Failover Events
Emitted when multiple players are moved due to node failure/ejection.
Emitted when players cannot be moved and are left without a node.
Player Triggered Events
Emitted when player.play() is called.
Emitted when player.pause() is called.
Emitted when player.resume() is called.
Emitted when player.stop() is called.
Emitted when player.skip() is called.
Emitted when player.seek() is called.
Emitted when player.shuffle() is called.
Emitted when player.back() is called.
Track Events
Emitted when a track starts playing.
Emitted when a track finishes playing.
Emitted when a track gets stuck (buffers for too long).
Emitted when an error occurs during playback.
Queue Events
Emitted when tracks are added to the queue.
Emitted when tracks are removed from the queue.
Emitted when a range of tracks is moved in the queue.
Emitted when a range of tracks is removed from the queue.
Emitted when tracks are duplicated in the queue.
Emitted when the queue is empty.
Other Events
Emitted when filters are updated.
Emitted when the Discord voice WebSocket closes.
Emitted when the voice session ID changes.
Emitted when a track starts playing via AutoPlay.
Emitted when the player auto-leaves the channel.
Configuration Interfaces
IManagerConfig
Main configuration object for the Manager.
Array of nodes to connect to.
Global options.
Function to send packets to Discord.
IManagerNodeConfig
Configuration for a single Lavalink node.
Node hostname.
Node port.
Node password.
Whether to use SSL/TLS.
Custom identifier for the node.
API version path (default: 'v4').
Delay between reconnection attempts.
Max number of reconnection attempts.
Regions this node is responsible for.
Priority for load balancing.
IManagerOptionsConfig
Global manager options.
Name of the client sent to Lavalink.
Custom User-Agent for HTTP requests.
Prevent replacing the playing track on play call.
Whether to resume session after disconnect.
Timeout in ms for session resuming.
Define custom filter presets.
Default settings for new players.
Voice connection settings.
Node selection and behavior.
Search behavior settings.
Queue limits and behavior.
Source configuration.
Idle player cleanup settings.
Track error and stuck handling.
Properties to load partially for tracks.
Database configuration.
IDefaultPlayerOptions
Default settings for new players.
Default volume.
Default autoPlay state.
Default autoLeave state.
Default selfDeaf state.
Default selfMute state.
Default loop mode ('off', 'track', 'queue').
Size of the track history buffer.
IVoiceConnectionOptions
Voice connection retry and timeout settings.
Connection timeout in ms.
Max reconnection attempts.
Delay between reconnections.
Whether to auto-reconnect on close.
INodeOptions
Node selection strategies.
Strategy to pick nodes ('leastLoad', etc).
Retry delay for node connection.
Retry amount for node connection.
Skip nodes with high CPU/Memory.
Max CPU load to consider healthy.
Max Memory usage to consider healthy.
Move players if a node disconnects.
Automatically rebalance players (not implemented).
ISearchOptions
Search behavior.
Default platform ('youtube', 'soundcloud', etc).
Max results to return.
Max tracks to load from a playlist.
IQueueOptions
Queue limits.
Max tracks in queue.
Allow duplicate tracks.
Max tracks in history.
ISourceOptions
Source management.
List of sources to block.
IPlayerDestructionOptions
Idle player cleanup.
Destroy player when idle.
Time in ms before destruction.
ITrackHandlingOptions
Track error handling.
Skip track on exception.
Skip track if stuck.
Threshold in ms to consider stuck.
Retry track load on failure.
Max retries.
Player Interfaces
IPlayerConfig
Options for creating a player.
The Guild ID.
The Voice Channel ID.
The Text Channel ID.
Specific node identifier to use.
Initial volume.
Join deafened.
Join muted.
Enable autoPlay.
Enable autoLeave.
Initial loop mode.
Number of times to loop.
ITrack
Raw track object structure.
Base64 string.
Metadata.
Plugin-specific data.
Custom user data attached to the track.
ITrackInfo
Track metadata fields.
Track title.
Length in milliseconds.
Unique identifier.
Whether seeking is allowed.
Whether it's a livestream.
Track URL.
Track artwork.
ISRC code.
Source platform name.
Start position.
IPlayerState
Current player state from Lavalink.
Current Unix timestamp.
Track position in ms.
Voice connection status.
Voice latency.
Filter Interfaces
IFilters
Audio filter configuration.
Volume multiplier (0.0 - 5.0).
Array of 15 bands.
Karaoke settings.
Speed/Pitch/Rate settings.
Tremolo settings.
Vibrato settings.
8D audio settings.
Distortion settings.
Channel mixing settings.
LowPass filter settings.
Custom plugin filters.
IEqualizerBand
Band index (0-14).
Gain (-0.25 to 1.0).
IKaraoke
ITimescale
ITremolo
IVibrato
IRotation
IDistortion
IChannelMix
ILowPass
REST Interfaces
INodeStats
Node statistics payload.
Total players.
Active players.
Uptime in seconds.
Memory usage stats.
CPU load stats.
IRESTLoadTracks
Response from loadTracks endpoint.
Type of result ('track', 'playlist', etc).
The track(s) data or exception.
IRESTGetPlayers
Response from getPlayers endpoint.
Voice state.
IRESTGetLyrics
IRoutePlannerStatus
Route planner status.
The class name of the route planner.
Detailed status info.