A powerful discord music library written in TypeScript for Node.js. Support youtube links.
Version 16.6.0 or newer of Node.js is required
Ensure that discord.js and @discordjs/voice have been installed before installing this library
npm install @discordx/music
yarn add @discordx/music
Note: Create a pull request to include your bot in the example list.
QueueNode
is a service that oversees the management of a worker service responsible for handling audio nodes and the corresponding audio node managers. Its primary purpose is to provide music functionality within a system. By utilizing QueueNode
, multiple workers can be spawned as needed to enable concurrent music playback across multiple guilds. The QueueNode
service ensures efficient coordination and distribution of music playback tasks, allowing for seamless and synchronized playback across different guilds.
TrackQueue
is a service specifically designed to offer playlist-like functionality within a music system. It provides a range of functions such as queuing songs, playing tracks, skipping, repeating, pausing/unpausing, and more. By creating a TrackQueue
instance per guild, you can seamlessly integrate playlist functionality into your music system. This allows users to manage and enjoy their own personalized playlists within their respective guilds, enhancing the overall music experience. With TrackQueue
, users can easily control the playback flow, manage track order, and apply various playlist-related operations to curate their desired musical journey.
// Create a queue node
const queueNode = new QueueNode(client);
// Create a track queue for guild
const trackQueue = new TrackQueue({
client: client,
guildId: guildId,
queueNode: queueNode,
});
// Join voice channel
queue.join({
channelId: channelId,
guildId: guildId,
});
// Add and play track
queue.addTrack({
url: "VIDEO_URL",
});