Recipes

Music Library

Seyfert doesn't have support for playing audio, but we can use an external library called kazagumo.

Installation

First of all, we have to install kazagumo and shoukaku. Both dependencies are extremely necessary when moving forward within this guide.

Dependencies...
pnpm add kazagumo shoukaku

Setup

Understanding declare module

To be able to move forward within this guide it is highly recommended to read the Understanding declare module for a better understanding of what we are doing.

For further information about the different options and events of kazagumo see the official bot example

index.ts
import { Client } from "seyfert";
import { Kazagumo } from "kazagumo";
import { type NodeOption, Connectors } from "shoukaku";
 
const client = new Client();
const nodes: NodeOption[] = [
	{
		name: "Node",
		url: "localhost:2333",
		auth: "youshallnotpass",
		secure: false
	}
];
 
//Basic configuration, perfect for this case
client.kazagumo = new Kazagumo(
	{
		defaultSearchEngine: "youtube",
		send: (guildId, payload) =>
			client.gateway.send(client.gateway.calculateShardId(guildId), payload)
	},
	new Connectors.Seyfert(client),
	nodes
);
 
//To see whether the node is connected
client.kazagumo.shoukaku.on("ready", (name) =>
	console.log(`Lavalink ${name}: Ready!`)
);
 
declare module "seyfert" {
	interface Client {
		kazagumo: Kazagumo;
	}
}
 
client.start().then(() => client.uploadCommands());

On this page