aqualink v2.3.0
AquaLink
An Stable, performant, Recourse friendly and fast lavalink wrapper
This code is based in riffy, but its an 100% Rewrite made from scratch...
Why use AquaLink
- Only uses 1 dependecy (ws for websocket, atm)
- HTTP1.1 / HTTP2 Support
- Very Low memory comsuption
- Built in Queue manager
- Lots of features to use
- Lowest CPU Usage
- Very fast (mine take less than 1 second to load an song!)
- 1 Player created = ~1 - 0,5 mb per player
- Auto clean Up memory when song finishes / bot leave the vc (Now Options supported!)
- Plugin system
- Lavalink v4.0.8 | v4.1.0 Support (Nodelink works, but only with play etc, more support soon)
- Youtube and Spotify support (Soundcloud, deezer, vimeo, etc also works...)
- Minimal Requests to the lavalink server (helps the lavalink recourses!)
- Playlist support (My mix playlists, youtube playlists, spotify playlists, etc)
- Lyrics Support by Lavalink
- https://github.com/topi314/LavaLyrics (RECOMMENDED)
- https://github.com/DRSchlaubi/lyrics.kt (?)
- https://github.com/DuncteBot/java-timed-lyrics (RECOMMENDED)
Tralalero Tralala 2.3.0 Released
now is ~21% more lightweight, reduced disk space
Improved the
AQUA
module- 3x better cleanup system
- Fixed some memory leaks
- Improved long process support
- Faster node caching
Remade the
Player
module- Added circular buffer for previousTracks (way more memory efficient)
- Reorganized the event handlings
- Way better Memory management
Rewrite the
Node
system- Fixed an memory leak in connections
- Improved the overal speed
- Improved code readbility / modules
- improved cleanup System
- Better long runtime
- Rewrite the Filter system
Improved
Rest
code- Fixed lyrics (both search and get)
- Better chunks system for more performance
Improved
fetchImage
speed and recourses
Docs (Wiki)
Example bot: https://github.com/ToddyTheNoobDud/Kenium-Music
Discord support: https://discord.com/invite/K4CVv84VBC
How to install
npm install aqualink
pnpm install aqualink
Basic usage
// If you're using Module, use this:
// import { createRequire } from 'module';
// const require = createRequire(import.meta.url);
//const { Aqua } = require('aqualink');
const { Aqua } = require("aqualink");
const { Client, Collection, GatewayDispatchEvents } = require("discord.js");
const client = new Client({
intents: [
"Guilds",
"GuildMembers",
"GuildMessages",
"MessageContent",
"GuildVoiceStates"
]
});
const nodes = [
{
host: "127.0.0.1",
password: "yourpass",
port: 233,
secure: false,
name: "localhost"
}
];
const aqua = Aqua(client, nodes, {
defaultSearchPlatform: "ytsearch",
restVersion: "v4",
autoResume: false,
infiniteReconnects: true,
});
client.aqua = aqua;
client.once("ready", () => {
client.aqua.init(client.user.id);
console.log("Ready!");
});
client.on("raw", (d) => {
if (![GatewayDispatchEvents.VoiceStateUpdate, GatewayDispatchEvents.VoiceServerUpdate,].includes(d.t)) return;
client.aqua.updateVoiceState(d);
});
client.on("messageCreate", async (message) => {
if (message.author.bot) return;
if (!message.content.startsWith("!play")) return;
const query = message.content.slice(6);
const player = client.aqua.createConnection({
guildId: message.guild.id,
voiceChannel: message.member.voice.channel.id,
textChannel: message.channel.id,
deaf: true,
});
const resolve = await client.aqua.resolve({ query, requester: message.member });
if (resolve.loadType === 'playlist') {
await message.channel.send(`Added ${resolve.tracks.length} songs from ${resolve.playlistInfo.name} playlist.`);
for (const track of result.tracks) {
player.queue.add(track);
}
if (!player.playing && !player.paused) return player.play();
} else if (resolve.loadType === 'search' || resolve.loadType === 'track') {
const track = resolve.tracks.shift();
track.info.requester = message.member;
player.queue.add(track);
await message.channel.send(`Added **${track.info.title}** to the queue.`);
if (!player.playing && !player.paused) return player.play();
} else {
return message.channel.send(`There were no results found for your query.`);
}
});
client.aqua.on("nodeConnect", (node) => {
console.log(`Node connected: ${node.name}`);
});
client.aqua.on("nodeError", (node, error) => {
console.log(`Node "${node.name}" encountered an error: ${error.message}.`);
});
client.login("Yourtokenhere");
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago