### Install NicoNico Plugin Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Install an additional plugin for Kazagumo to support nicovideo.jp using npm. ```bash npm i kazagumo-nico ``` -------------------------------- ### Install Kazagumo Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Install the Kazagumo library using npm. This is the primary step to begin using the library. ```bash npm i kazagumo ``` -------------------------------- ### Install Stone-Deezer Plugin Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Install the Stone-Deezer plugin for Kazagumo using npm. This is an alternative Deezer plugin. ```bash npm i stone-deezer ``` -------------------------------- ### Install Spotify Plugin Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Install the official Spotify plugin for Kazagumo using npm. This plugin extends Kazagumo's capabilities to support Spotify. ```bash npm i kazagumo-spotify ``` -------------------------------- ### Install Apple Plugin Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Install an additional Apple plugin for Kazagumo using npm. This plugin adds support for Apple services. ```bash npm i kazagumo-apple ``` -------------------------------- ### Install Deezer Plugin Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Install an additional Deezer plugin for Kazagumo using npm. This plugin enables Deezer support. ```bash npm i kazagumo-deezer ``` -------------------------------- ### playerStart Event Source: https://github.com/takiyo0/kazagumo/blob/main/docs/interfaces/Kazagumo.KazagumoEvents.html Emitted when a new track starts playing. It provides the player instance and the track that started. ```APIDOC ## playerStart Event ### Description Emitted when a new track starts playing. ### Parameters - **player** ([`KazagumoPlayer`](../classes/Managers_KazagumoPlayer.KazagumoPlayer.html)) - The player instance. - **track** ([`KazagumoTrack`](../classes/Managers_Supports_KazagumoTrack.KazagumoTrack.html)) - The track that started playing. ``` -------------------------------- ### Install Filter Plugin Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Install an additional filter plugin for Kazagumo using npm. This plugin provides filtering capabilities. ```bash npm i kazagumo-filter ``` -------------------------------- ### playerStart Source: https://github.com/takiyo0/kazagumo/blob/main/docs/interfaces/Kazagumo.KazagumoEvents.html Emitted when a new track is about to start playing on a player. ```APIDOC ## playerStart ### Description Emitted when a new track is about to start playing on a player. ### Event Signature `playerStart(player: KazagumoPlayer, track: KazagumoTrack)` ### Parameters * **player** (KazagumoPlayer) - The player instance. * **track** (KazagumoTrack) - The track that is about to play. ``` -------------------------------- ### Discord Bot with Kazagumo Music Player Source: https://github.com/takiyo0/kazagumo/blob/main/README.md This snippet shows a full example of a Discord bot using Kazagumo. It includes setting up Lavalink nodes, handling Discord events, and implementing music commands like play, skip, forceplay, and previous. Ensure you have the necessary intents and node configuration. ```javascript const {Client, GatewayIntentBits} = require('discord.js'); const {Guilds, GuildVoiceStates, GuildMessages, MessageContent} = GatewayIntentBits; const {Connectors} = require("shoukaku"); const {Kazagumo, KazagumoTrack} = require("../dist"); const Nodes = [{ name: 'owo', url: 'localhost:2333', auth: 'youshallnotpass', secure: false }]; const client = new Client({intents: [Guilds, GuildVoiceStates, GuildMessages, MessageContent]}); const kazagumo = new Kazagumo({ defaultSearchEngine: "youtube", // MAKE SURE YOU HAVE THIS send: (guildId, payload) => { const guild = client.guilds.cache.get(guildId); if (guild) guild.shard.send(payload); } }, new Connectors.DiscordJS(client), Nodes); client.on("ready", () => console.log(client.user.tag + " Ready!")); kazagumo.shoukaku.on('ready', (name) => console.log(`Lavalink ${name}: Ready!`)); kazagumo.shoukaku.on('error', (name, error) => console.error(`Lavalink ${name}: Error Caught,`, error)); kazagumo.shoukaku.on('close', (name, code, reason) => console.warn(`Lavalink ${name}: Closed, Code ${code}, Reason ${reason || 'No reason'}`)); kazagumo.shoukaku.on('debug', (name, info) => console.debug(`Lavalink ${name}: Debug,`, info)); kazagumo.shoukaku.on('disconnect', (name, count) => { const players = [...kazagumo.shoukaku.players.values()].filter(p => p.node.name === name); players.map(player => { kazagumo.destroyPlayer(player.guildId); player.destroy(); }); console.warn(`Lavalink ${name}: Disconnected`); }); kazagumo.on("playerStart", (player, track) => { client.channels.cache.get(player.textId)?.send({content: `Now playing **${track.title}** by **${track.author}**`}) .then(x => player.data.set("message", x)); }); kazagumo.on("playerEnd", (player) => { player.data.get("message")?.edit({content: `Finished playing`}); }); kazagumo.on("playerEmpty", player => { client.channels.cache.get(player.textId)?.send({content: `Destroyed player due to inactivity.`}) .then(x => player.data.set("message", x)); player.destroy(); }); client.on("messageCreate", async msg => { if (msg.author.bot) return; if (msg.content.startsWith("!play")) { const args = msg.content.split(" "); const query = args.slice(1).join(" "); const {channel} = msg.member.voice; if (!channel) return msg.reply("You need to be in a voice channel to use this command!"); let player = await kazagumo.createPlayer({ guildId: msg.guild.id, textId: msg.channel.id, voiceId: channel.id, volume: 40 }) let result = await kazagumo.search(query, {requester: msg.author}); if (!result.tracks.length) return msg.reply("No results found!"); if (result.type === "PLAYLIST") player.queue.add(result.tracks); // do this instead of using for loop if you want queueUpdate not spammy else player.queue.add(result.tracks[0]); if (!player.playing && !player.paused) player.play(); return msg.reply({content: result.type === "PLAYLIST" ? `Queued ${result.tracks.length} from ${result.playlistName}` : `Queued ${result.tracks[0].title}`}); } if (msg.content.startsWith("!skip")) { let player = kazagumo.players.get(msg.guild.id); if (!player) return msg.reply("No player found!"); player.skip(); log(msg.guild.id); return msg.reply({content: `Skipped to **${player.queue[0]?.title}** by **${player.queue[0]?.author}**`}); } if (msg.content.startsWith("!forceplay")) { let player = kazagumo.players.get(msg.guild.id); if (!player) return msg.reply("No player found!"); const args = msg.content.split(" "); const query = args.slice(1).join(" "); let result = await kazagumo.search(query, {requester: msg.author}); if (!result.tracks.length) return msg.reply("No results found!"); player.play(new KazagumoTrack(result.tracks[0].getRaw(), msg.author)); return msg.reply({content: `Forced playing **${result.tracks[0].title}** by **${result.tracks[0].author}**`}); } if (msg.content.startsWith("!previous")) { let player = kazagumo.players.get(msg.guild.id); if (!player) return msg.reply("No player found!"); const previous = player.getPrevious(); // we get the previous track without removing it first if (!previous) return msg.reply("No previous track found!"); await player.play(player.getPrevious(true)); // now we remove the previous track and play it return msg.reply("Previous!"); } }) client.login(''); ``` -------------------------------- ### Add a One-Time Listener to the Beginning Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Use prependOnceListener to add a listener that will execute only once and be placed at the start of the listener queue. This is useful for immediate, single-occurrence event handling. ```typescript server.prependOnceListener('connection', (stream) => { console.log('Ah, we have our first user!'); }); ``` -------------------------------- ### Workaround for Spotify Playback Source: https://github.com/takiyo0/kazagumo/blob/main/README.md Use this workaround when direct playback of Spotify tracks fails. It involves converting the Spotify track to a KazagumoTrack before playing. Ensure you have the 'kazagumo' package installed. ```javascript const {KazagumoTrack} = require("kazagumo"); // CommonJS import {KazagumoTrack} from "kazagumo"; // ES6; don't laugh if it's wrong let track = result.tracks[0] // the spotify track let convertedTrack = new KazagumoTrack(track.getRaw()._raw, track.author); player.play(convertedTrack); ``` -------------------------------- ### Error.captureStackTrace Example Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Modules_Interfaces.KazagumoError.html Demonstrates how to use Error.captureStackTrace to create a .stack property on an object. This is useful for capturing stack traces without instantiating a new Error object. ```typescript const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` -------------------------------- ### constructor Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Plugins_PlayerMoved.KazagumoPlugin.html Initializes the KazagumoPlugin with a Discord.Client instance. ```APIDOC ## constructor ### Description Initializes the plugin. ### Method constructor ### Parameters #### Parameters - **client** (any) - Required - Discord.Client ### Returns KazagumoPlugin ``` -------------------------------- ### load Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Plugins_PlayerMoved.KazagumoPlugin.html Loads the plugin with a Kazagumo instance. ```APIDOC ## load ### Description Load the plugin. ### Method load ### Parameters #### Parameters - **kazagumo** ([Kazagumo](Kazagumo.Kazagumo.html)) - Required - Kazagumo ### Returns void ``` -------------------------------- ### Initialize Kazagumo with Discord.js Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Sets up the Kazagumo client, configures Lavalink nodes, and integrates with discord.js. Ensure you have the necessary intents enabled for your Discord client. ```javascript const {Client, GatewayIntentBits} = require('discord.js'); const {Guilds, GuildVoiceStates, GuildMessages, MessageContent} = GatewayIntentBits; const {Connectors} = require("shoukaku"); const {Kazagumo, KazagumoTrack} = require("../dist"); const Nodes = [{ name: 'owo', url: 'localhost:2333', auth: 'youshallnotpass', secure: false }]; const client = new Client({ intents: [Guilds, GuildVoiceStates, GuildMessages, MessageContent] }); const kazagumo = new Kazagumo({ defaultSearchEngine: "youtube", // MAKE SURE YOU HAVE THIS send: (guildId, payload) => { const guild = client.guilds.cache.get(guildId); if (guild) guild.shard.send(payload); } }, new Connectors.DiscordJS(client), Nodes); ``` -------------------------------- ### Theme and Display Initialization Source: https://github.com/takiyo0/kazagumo/blob/main/docs/variables/Index.version.html Initializes the theme based on local storage or OS preference and sets up the initial display behavior for the application. The application's main page is shown after a short delay or when the app object is available. ```typescript kazagumodocument.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"; document.body.style.display="none"; setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500) ``` -------------------------------- ### playerStuck Source: https://github.com/takiyo0/kazagumo/blob/main/docs/interfaces/Kazagumo.KazagumoEvents.html Emitted when a player encounters an issue and gets stuck. ```APIDOC ## playerStuck ### Description Emitted when a player encounters an issue and gets stuck. ### Event Signature `playerStuck(player: KazagumoPlayer, data: TrackStuckEvent)` ### Parameters * **player** (KazagumoPlayer) - The player instance that got stuck. * **data** (TrackStuckEvent) - An object containing details about the stuck event. ``` -------------------------------- ### playerStuck Event Source: https://github.com/takiyo0/kazagumo/blob/main/docs/interfaces/Kazagumo.KazagumoEvents.html Emitted when the player gets stuck during playback. It provides the player instance and event data. ```APIDOC ## playerStuck Event ### Description Emitted when the player gets stuck. ### Parameters - **player** ([`KazagumoPlayer`](../classes/Managers_KazagumoPlayer.KazagumoPlayer.html)) - The player instance. - **data** (TrackStuckEvent) - The track stuck event data. ``` -------------------------------- ### KazagumoPlayer Constructor Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Managers_KazagumoPlayer.KazagumoPlayer.html Initializes a new instance of the KazagumoPlayer class. This constructor sets up the player with the necessary Kazagumo instance, Shoukaku player, and configuration options. ```APIDOC ## new KazagumoPlayer(kazagumo, player, options, customData) ### Description Initializes a new instance of the KazagumoPlayer class. ### Parameters * **kazagumo** (Kazagumo) - Kazagumo instance * **player** (Player) - Shoukaku's Player instance * **options** (KazagumoPlayerOptions) - Kazagumo options * **customData** (unknown) - private readonly customData ### Returns KazagumoPlayer ``` -------------------------------- ### Get Listeners for an Event Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Retrieves a copy of the array of listeners for a specific event. Useful for inspecting registered callbacks. ```typescript server.on('connection', (stream) => { console.log('someone connected!');});console.log(util.inspect(server.listeners('connection')));// Prints: [ [Function] ] ``` -------------------------------- ### Kazagumo Constructor Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Initializes a new instance of the Kazagumo class. This constructor sets up the core components of the music library, including options, a connector, and audio nodes. ```APIDOC ## constructor(KazagumoOptions, connector, nodes, options?) ### Description Initialize a Kazagumo instance. ### Parameters * **KazagumoOptions** ([`KazagumoOptions`](../interfaces/Modules_Interfaces.KazagumoOptions.html)) - KazagumoOptions * **connector** (Connector) - Connector * **nodes** (NodeOption[]) - NodeOption[] * **options** (ShoukakuOptions) - ShoukakuOptions (optional, defaults to {}) ### Returns Kazagumo * An instance of Kazagumo. ``` -------------------------------- ### unshift Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Managers_Supports_KazagumoQueue.KazagumoQueue.html Inserts new elements at the start of the queue and returns the new length of the queue. This method is inherited from the Array.unshift method. ```APIDOC ## unshift ### Description Inserts new elements at the start of an array, and returns the new length of the array. ### Method `unshift` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `...items` (KazagumoTrack[]) - Required - Elements to insert at the start of the array. ### Request Example ```json { "items": [ { "title": "Track 1", "artist": "Artist 1", "url": "http://example.com/track1.mp3" } ] } ``` ### Response #### Success Response (200) * `number` - The new length of the array. #### Response Example ```json { "length": 5 } ``` ``` -------------------------------- ### KazagumoTrack Constructor Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Managers_Supports_KazagumoTrack.KazagumoTrack.html Initializes a new KazagumoTrack instance with raw track data and the requester. ```APIDOC ## constructor ### Description Initializes a new KazagumoTrack instance. ### Parameters #### Parameters - **raw** (Track) - The raw track data. - **requester** (unknown) - The entity that requested the track. ### Returns - KazagumoTrack - A new KazagumoTrack instance. ``` -------------------------------- ### Remove Elements from Array using splice Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Managers_Supports_KazagumoQueue.KazagumoQueue.html Removes elements from an array starting at a specified index. Returns the deleted elements. ```typescript queue.splice(start, deleteCount) ``` -------------------------------- ### Create a Kazagumo Player Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html This method is used to create a new player instance. It takes options as an argument and returns a Promise that resolves with the created player. ```typescript createPlayer(options: CreatePlayerOptions): Promise ``` -------------------------------- ### Get Event Listeners for EventEmitter Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Retrieves a copy of the array of listeners for a given event name on an EventEmitter. Useful for debugging. ```typescript import { getEventListeners, EventEmitter } from 'node:events'; { const ee = new EventEmitter(); const listener = () => console.log('Events are fun'); ee.on('foo', listener); console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ] } ``` -------------------------------- ### fill Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Managers_Supports_KazagumoQueue.KazagumoQueue.html Changes all array elements from `start` to `end` index to a static `value` and returns the modified array. This method is inherited from Array.prototype. ```APIDOC ## fill ### Description Changes all array elements from `start` to `end` index to a static `value` and returns the modified array. ### Method Signature fill(value: KazagumoTrack, start?: number, end?: number): this[] ### Parameters #### value - **value** (KazagumoTrack) - The value to fill the array section with. #### start - **start** (number) - Optional. The index to start filling the array at. If negative, it is treated as `length + start`. #### end - **end** (number) - Optional. The index to stop filling the array at. If negative, it is treated as `length + end`. ### Returns - **this[]** - The modified array. ``` -------------------------------- ### Kazagumo Methods Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html This section details the methods available on the Kazagumo class, allowing users to interact with the music library's features such as creating and destroying players, managing connections, and searching for music. ```APIDOC ## createPlayer(options) ### Description Creates a new player instance. ### Parameters * **options** (PlayerOptions) - Options for the player. ### Returns KazagumoPlayer * The created KazagumoPlayer instance. ``` ```APIDOC ## destroyPlayer(player) ### Description Destroys an existing player instance. ### Parameters * **player** (KazagumoPlayer) - The player instance to destroy. ### Returns void ``` ```APIDOC ## getPlayer(guildId) ### Description Retrieves a player instance by its guild ID. ### Parameters * **guildId** (string) - The ID of the guild. ### Returns KazagumoPlayer | undefined * The KazagumoPlayer instance if found, otherwise undefined. ``` ```APIDOC ## search(query, source?) ### Description Searches for tracks using the provided query. ### Parameters * **query** (string) - The search query. * **source** (string) - The source to search from (e.g., 'youtube', 'soundcloud'). Optional. ### Returns Promise * A promise that resolves to an array of Track objects. ``` -------------------------------- ### Get Max Listeners for EventTarget Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Returns the currently set maximum number of listeners for an EventTarget. Exceeding this limit will print a warning. ```typescript import { getMaxListeners, setMaxListeners } from 'node:events'; { const et = new EventTarget(); console.log(getMaxListeners(et)); // 10 setMaxListeners(11, et); console.log(getMaxListeners(et)); // 11 } ``` -------------------------------- ### Get Max Listeners for EventEmitter Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Returns the currently set maximum number of listeners for an EventEmitter. Useful for monitoring listener counts. ```typescript import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events'; { const ee = new EventEmitter(); console.log(getMaxListeners(ee)); // 10 setMaxListeners(11, ee); console.log(getMaxListeners(ee)); // 11 } ``` -------------------------------- ### Get Event Listeners for EventTarget Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Retrieves a copy of the array of listeners for a given event name on an EventTarget. This is the only way to access listeners for EventTargets. ```typescript import { getEventListeners } from 'node:events'; { const et = new EventTarget(); const listener = () => console.log('Events are fun'); et.addEventListener('foo', listener); console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ] } ``` -------------------------------- ### KazagumoQueue Constructors Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Managers_Supports_KazagumoQueue.KazagumoQueue.html Details on how to construct a new KazagumoQueue instance. ```APIDOC ## Constructor ### Description Initializes a new instance of the KazagumoQueue class. ### Method `constructor` ### Parameters This constructor does not accept any parameters. ``` -------------------------------- ### Get Event Names - Node.js EventEmitter Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Retrieves an array of event names for which the EventEmitter has registered listeners. This is a standard Node.js EventEmitter method. ```typescript import { EventEmitter } from 'node:events'; const myEE = new EventEmitter(); myEE.on('foo', () => {}); myEE.on('bar', () => {}); const sym = Symbol('symbol'); myEE.on(sym, () => {}); console.log(myEE.eventNames()); // Prints: [ 'foo', 'bar', Symbol(symbol) ] ``` -------------------------------- ### lastIndexOf(searchElement, fromIndex?) Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Managers_Supports_KazagumoQueue.KazagumoQueue.html Returns the index of the last occurrence of a specified KazagumoTrack in the array, or -1 if it is not present. Searching can be limited to a specific starting index. ```APIDOC ## lastIndexOf(searchElement, fromIndex?) ### Description Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. ### Parameters #### Parameters * **searchElement** (KazagumoTrack) - The value to locate in the array. * **fromIndex** (number) - Optional - The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. ### Returns number ### Inherited from Array.lastIndexOf ### Defined in node_modules/typescript/lib/lib.es5.d.ts:1431 ``` -------------------------------- ### KazagumoPlayer Methods Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Managers_KazagumoPlayer.KazagumoPlayer.html Methods available on the KazagumoPlayer class for controlling playback, managing connections, and interacting with the player. ```APIDOC ## Methods ### connect * **connect**(voiceId: string, textId: string) Connect to a voice channel. ### destroy * **destroy**() Destroy the player. ### disconnect * **disconnect**() Disconnect from the voice channel. ### getPrevious * **getPrevious**() Get previous track. ### pause * **pause**(paused: boolean) Pause or resume the player. ### play * **play**(options: [KazagumoPlayOptions](../interfaces/Modules_Interfaces.KazagumoPlayOptions.html)) Play a track. ### seek * **seek**(position: number) Seek to a position in the current track. ### setLoop * **setLoop**(loop: "none" | "queue" | "track") Set loop status. ### setTextChannel * **setTextChannel**(textId: string) Set text channel. ### setVoiceChannel * **setVoiceChannel**(voiceId: string) Set voice channel. ### setVolume * **setVolume**(volume: number) Set player volume. ### skip * **skip**() Skip the current track. ``` -------------------------------- ### KazagumoError Class Overview Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Modules_Interfaces.KazagumoError.html This snippet provides an overview of the KazagumoError class, including its constructors, properties, and methods as documented by TypeDoc. ```APIDOC ## Class: KazagumoError ### Description Represents a custom error type within the Kazagumo project, extending the base JavaScript Error class. ### Properties * **code** (number) - The error code. * **message** (string) - The error message. * **name** (string) - The name of the error, typically 'KazagumoError'. * **stack** (string) - The stack trace of the error. * **stackTraceLimit** (number) - The maximum number of stack frames to capture. ### Methods * **captureStackTrace(targetObject, constructorOpt)** - Captures the stack trace for the given object. * **prepareStackTrace(error, structuredStack) (static)** - Customizes the error stack trace format. ``` -------------------------------- ### Remove the most recently added listener Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html When a listener is added multiple times, `removeListener` removes the most recently added instance. This example shows removing a `once` listener. ```typescript import { EventEmitter } from 'node:events'; const ee = new EventEmitter(); function pong() { console.log('pong'); } ee.on('ping', pong); ee.once('ping', pong); ee.removeListener('ping', pong); ee.emit('ping'); ee.emit('ping'); ``` -------------------------------- ### createPlayer Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Creates a new Kazagumo player instance. This method allows for the creation of a player with specified options and returns a Promise that resolves with the created player. ```APIDOC ## createPlayer ### Description Create a player. ### Method Not specified (likely a class method) ### Parameters #### Request Body - **options** (CreatePlayerOptions) - Required - Options to configure the player. ### Returns - **Promise** - A Promise that resolves with the created KazagumoPlayer instance or a custom player type T. ``` -------------------------------- ### Get Player by Guild ID - Kazagumo Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Retrieves a KazagumoPlayer instance associated with a specific guild ID. Returns undefined if no player is found for the given guild. ```typescript getPlayer(guildId: string): KazagumoPlayer | T | undefined ``` -------------------------------- ### Create Voice Connection - Kazagumo Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Creates a new voice connection for a given channel and configures the Kazagumo player with specified options. This method returns a Promise that resolves to the Player instance. ```typescript createVoiceConnection( newPlayerOptions: VoiceChannelOptions, kazagumoPlayerOptions: [CreatePlayerOptions](../interfaces/Modules_Interfaces.CreatePlayerOptions.html), ): Promise ``` -------------------------------- ### Node.js EventEmitter once() Example Source: https://github.com/takiyo0/kazagumo/blob/main/docs/classes/Kazagumo.Kazagumo.html Listen for a single event on a Node.js EventEmitter and handle potential errors. This snippet demonstrates basic event emission and error catching. ```typescript import { once, EventEmitter } from 'node:events'; import process from 'node:process'; const ee = new EventEmitter(); process.nextTick(() => { ee.emit('myevent', 42); }); const [value] = await once(ee, 'myevent'); console.log(value); const err = new Error('kaboom'); process.nextTick(() => { ee.emit('error', err); }); try { await once(ee, 'myevent'); } catch (err) { console.error('error happened', err); } ``` -------------------------------- ### Enable PlayerMoved Event with Kazagumo Source: https://github.com/takiyo0/kazagumo/blob/main/docs/index.html Configure Kazagumo to enable the PlayerMoved event by including the PlayerMoved plugin during initialization. This requires passing the client instance to the plugin. ```javascript import {Kazagumo, Payload, Plugins} from "kazagumo"; const kazagumo = new Kazagumo({ ..., plugins: [new Plugins.PlayerMoved(client)] }, Connector, Nodes, ShoukakuOptions) ```