Music made stronger with Lavalink for ForgeScript.
- Simple and easy-to-use functions
- Support for multiple event listeners
- Various filters support (Coming soon)
- Support for different audio providers
- Playlist support
Caution
ForgeLinked is not compatible with ForgeMusic at the moment. Use it only if you understand Lavalink and its setup.
To install ForgeLinked in your project, use:
npm install @tryforge/forge.linked
If you're using a different package manager, look up how to install Node.js dependencies accordingly.
First, import ForgeLink
and ForgeClient
in your main file:
const { ForgeClient } = require('@tryforge/forgescript');
const { ForgeLink } = require('@tryforge/forge.link');
Then, create a new instance of ForgeLink
with event listeners and Lavalink nodes:
const lavalink = new ForgeLink({
events: {
kazagumo: ['playerStart'],
shoukaku: ['debug', 'ready']
},
kazagumoOptions: {
defaultSearchEngine: 'youtube'
},
nodes: [
{
name: 'Public Node',
auth: 'youshallnotpass',
url: 'lavalink.jirayu.net:13592',
secure: false
}
]
});
Now, create the ForgeClient
and attach lavalink
as an extension:
const client = new ForgeClient({
intents: [
'Guilds',
'GuildMessages',
'MessageContent',
'GuildVoiceStates'
],
events: [
'messageCreate'
],
extensions: [lavalink],
prefixes: ['.']
});
[!INFO]
⚠️ Important
Ensure yourForgeClient
has theGuildVoiceStates
intent enabled for ForgeLink functions to work properly.
ForgeLinked allows you to listen to specific Lavalink events. To do this, define them inside the events
object:
const lavalink = new ForgeLink({
events: {
kazagumo: ['playerStart'],
shoukaku: ['debug', 'ready']
}
});
Then, you can add custom event handlers:
lavalink.commands.kazagumo.add({
type: 'playerStart',
code: '$log[A track started playing now.]'
});
lavalink.commands.shoukaku.add(
{
type: 'debug',
code: '$log[NODE "$env[name]" -> $env[info]]'
},
{
type: 'ready',
code: '$log[NODE "$env[name]" IS READY]'
}
);
To connect ForgeLinked to a Lavalink server, provide the nodes
parameter in the setup:
const lavalink = new ForgeLink({
events: {
kazagumo: ['playerStart'],
shoukaku: ['debug', 'ready']
},
nodes: [
{
name: 'Public Node',
auth: 'youshallnotpass',
url: 'lavalink.jirayu.net:13592',
secure: false
}
]
});
You can find public Lavalink nodes online or host your own.
Lavalink supports multiple search engines. To specify a default, add it under kazagumoOptions
:
const lavalink = new ForgeLink({
kazagumoOptions: {
defaultSearchEngine: 'youtube'
}
});
Many thanks to everyone who contributed to this project! ❤️
Special thanks to Cyberghost for assisting with the event and command managers—without them, this wouldn’t have been possible!
This package was developed with
We hope you enjoy using ForgeLink!