commit 2820cc881cf76e3b22dd164a71dbd1e2e049ff34
Author: NoLogicAlan
Date: Tue Apr 14 02:23:18 2026 +0300
initial push to remix-bot/fluxer
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3e59e87
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+node_modules/
+storage/data
+config.json
+settings.json
+remix-settings.json
+cmdUsage.md
+bot.js
+bin/
+test_data/
+*.code-workspace
+*old.js
+.ytcache/
+.yt_auth.json
+yt_auth.json
+visitor_data.json
+.moonlink/
+storage/recovery.json
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7d60975
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+MIT License
+Copyright (c) 2026 Remix
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+---
+
+BRANDING NOTICE
+
+The name "Remix", the Remix logo, and all associated graphical depictions
+(banners, icons, etc.) are under PROPRIETARY copyright of the project creator.
+The MIT license does NOT grant you any rights to use the name "Remix" or its
+branding in production. If you are self-hosting this software, you must use a
+different name and logo.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5f335f2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,91 @@
+
+
+
+
+
Remix
+
+ The best high quality Fluxer music bot.
+
+ Invite to your server
+ ·
+ Report bug
+ ·
+ Request Feature
+
+
+
+## About The Project
+
+Remix is a free and open source music bot for Fluxer built on [fluxerjs](https://github.com/fluxerjs/core). All commands on Remix are free and will always be free to use.
+
+## Commands
+
+Below is a table of all of Remix's commands.
+
+| Name | Description | Format | Alias |
+|-----------|----------------------------------------------------------------------------------------------------|-----------------------------|-------------------------|
+| clear | Remove all songs from the queue. | %clear | clear, c |
+| join | Make the bot join a specific voice channel. | %join 'Channel ID: channel' | join |
+| leave | Make the bot leave your current voice channel | %leave | leave, l |
+| list | List the queue in your current voice channel. | %list | list, queue |
+| loop | Toggle the looping of your queue/song. | %loop | loop |
+| np | Request the name and URL of the currently playing song. | %np | np, current, nowplaying |
+| pause | Pause the playback in your voice channel | %pause | pause |
+| play | Play a song from URL/query or a playlist by URL. | %play 'query: text' | play, p |
+| player | Create an emoji player control for your voice channel | %player | player |
+| playnext | Play a song from URL/query or a playlist by URL. The result will be added to the top of the queue. | %playnext 'query: text' | playnext, pn |
+| remove | Remove a specific song from the queue. | %remove 'index: number' | remove |
+| resume | Resume the playback in your voice channel | %resume | resume |
+| search | Display the search results for a given query | %search 'query: text' | search |
+| settings | Change/Get settings in the current server. | %settings | settings, s |
+| shuffle | Re-orders the queue randomly. | %shuffle | shuffle |
+| skip | Skip the current playing song. | %skip | skip |
+| stats | Display stats about the bot like the uptime. | %stats | stats, info |
+| test | A test command used for various purposes. | %test 'number: number' | test |
+| thumbnail | Request the thumbnail of the currently playing song. | %thumbnail | thumbnail, thumb |
+| volume | Change the current volume. | %volume 'volume: number' | volume, v |
+
+## Getting Started
+
+Firstly, you have to [invite Remix](https://web.fluxer.app/oauth2/authorize?client_id=1478084469635211806&scope=bot&permissions=3206208). Then use the `%help` command to get a list of commands that you can use through the bot.
+
+## Hosting The Bot
+
+If you're self-hosting Remix, please make it clear that it is **not the main instance** (or **change the name**) but give credit by **linking to this repo** (for example, in the bot's profile - something like `This bot [Remix](https://github.com/remix-bot/fluxer)` will suffice).
+
+- Clone this repo (`git clone https://github.com/remix-bot/fluxer.git`)
+- Install the dependencies (`npm install`)
+- Set up a `config.json` file
+ - Rename the `config.example.json` file and fill out the missing values. You can generate Spotify credentials [here](https://developer.spotify.com/)
+ - A MySQL database is required. For setup instructions see [DB Setup](#setup-database).
+- Set up a [NodeLink](https://github.com/PerformanC/NodeLink) instance and configure the `nodelink` section in `config.json`:
+```json
+ "nodelink": {
+"host": "localhost",
+"port": 3000,
+"password": "youshallnotpass"
+}
+```
+- Run the bot (`node index.mjs`)
+
+## Setup Database
+
+1. The main thing you'll need is a MySQL database accessible to your server, either publicly or locally.
+2. Create a separate database. This way none of your other data collides with Remix.
+3. Enter the connection details into the respective fields in the `config.json` file.
+4. Run the following SQL commands to create all the necessary tables:
+```sql
+ CREATE TABLE `settings` (
+ `id` varchar(70) NOT NULL,
+ `data` json NOT NULL
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
+```
+5. You're good to go! If you've used the old settings system and want to migrate your data, check the README in the `settings` folder.
+
+## Contact
+
+If you have any questions or would like to talk with other Remix users you can join our Fluxer server here .
+
+---
+
+© 2026 Remix. Code licensed under [MIT](LICENSE). The Remix name and branding are proprietary and may not be reused.
diff --git a/commands/clear.mjs b/commands/clear.mjs
new file mode 100644
index 0000000..59b0373
--- /dev/null
+++ b/commands/clear.mjs
@@ -0,0 +1,20 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("clear")
+ .setDescription("Remove all songs from the queue.", "commands.clear")
+ .addAliases("c")
+ .setCategory("music");
+
+export async function run(msg) {
+ const p = await this.getPlayer(msg, false, false, false);
+ if (!p) return;
+ p.clear();
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription("🗑️ Queue cleared.")
+ .toJSON();
+ msg.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/debug.mjs b/commands/debug.mjs
new file mode 100644
index 0000000..46b9c3e
--- /dev/null
+++ b/commands/debug.mjs
@@ -0,0 +1,38 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("debug")
+ .setDescription("A debug command for various purposes.")
+ .setRequirement(r => r.setOwnerOnly(true))
+ .setCategory("util")
+ .addChoiceOption(o =>
+ o.setName("target")
+ .setDescription("The target that should be examined.")
+ .addChoices("voice")
+ .setRequired(true));
+
+export function run(msg, data) {
+ switch (data.get("target").value) {
+ case "voice": {
+ const servers = [...this.players.playerMap.entries()].map(([cid, s]) => {
+ const channel = this.client.channels.cache.get(cid);
+ return {
+ name: channel?.name ?? "unknown",
+ id: channel?.id ?? cid,
+ status: s.connection?.state?.status ?? "unknown",
+ guildname: channel?.guild?.name ?? "unknown",
+ guildid: channel?.guildId ?? "unknown"
+ };
+ });
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle("🔧 Voice Debug")
+ .setDescription("```json\n" + JSON.stringify(servers, null, 2) + "\n```")
+ .toJSON();
+ msg.replyEmbed({ embeds: [embed] });
+ break;
+ }
+ }
+}
diff --git a/commands/eval.mjs b/commands/eval.mjs
new file mode 100644
index 0000000..6efb5a8
--- /dev/null
+++ b/commands/eval.mjs
@@ -0,0 +1,214 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+import { inspect } from "node:util";
+
+// Auto-remove timer: 1 minute
+const EMOJI_REMOVE_TIMEOUT = 60000;
+
+/**
+ * List of keys that should be redacted from objects before displaying in Discord.
+ */
+const RESTRICTED = [
+ "token",
+ "config",
+ "key",
+ "clientSecret",
+ "clientId",
+ "password",
+ "secret",
+ "authorization"
+];
+
+function hasSensitive(obj, level = 0) {
+ if (level >= 3 || typeof obj !== "object" || obj === null) return false;
+ for (const key in obj) {
+ if (RESTRICTED.some(r => key.toLowerCase().includes(r))) return true;
+ if (typeof obj[key] === "object" && hasSensitive(obj[key], level + 1)) return true;
+ }
+ return false;
+}
+
+function removeSensitive(obj, level = 0) {
+ if (level >= 3 || typeof obj !== "object" || obj === null) return obj;
+
+ const isArray = Array.isArray(obj);
+ const newObj = isArray ? [...obj] : { ...obj };
+ let modified = false;
+
+ for (const key in newObj) {
+ const isSensitive = !isArray && RESTRICTED.some(r => key.toLowerCase().includes(r));
+
+ if (isSensitive) {
+ newObj[key] = "[REDACTED]";
+ modified = true;
+ } else if (typeof newObj[key] === "object" && newObj[key] !== null) {
+ const cleaned = removeSensitive(newObj[key], level + 1);
+ if (cleaned !== newObj[key]) {
+ newObj[key] = cleaned;
+ modified = true;
+ }
+ }
+ }
+ return modified ? newObj : obj;
+}
+
+async function clean(value) {
+ if (value instanceof Promise) value = await value;
+
+ if (typeof value === "object" && value !== null) {
+ if (hasSensitive(value)) {
+ value = removeSensitive(value);
+ }
+ }
+
+ let output;
+ try {
+ output = typeof value === "string" ? value : inspect(value, { depth: 1, compact: false });
+ } catch (err) {
+ output = `[Inspection Error]: ${err.message}`;
+ }
+
+ return output
+ .replace(/`/g, "`\u200b")
+ .replace(/@/g, "@\u200b") || "undefined"; // Fallback if output is empty
+}
+
+/**
+ * Executes the code and returns the raw data instead of a formatted string,
+ * so we can paginate it inside Embeds later.
+ */
+async function runEval(expression, context) {
+ const start = Date.now();
+ let result, isError = false, type = "undefined";
+
+ try {
+ result = await eval(`(async function() { ${expression} })`).call(context);
+ type = result === null ? "null" : typeof result;
+ } catch (e) {
+ result = e;
+ isError = true;
+ type = "error";
+ }
+
+ const elapsed = Date.now() - start;
+ const output = await clean(result);
+
+ return { output, isError, type, elapsed };
+}
+
+export const command = new CommandBuilder()
+ .setName("eval")
+ .setDescription("Evaluates JavaScript code (Owner Only).")
+ .setRequirement(r => r.setOwnerOnly(true))
+ .setCategory("util")
+ .addTextOption(o =>
+ o.setName("expression")
+ .setDescription("The JavaScript expression to evaluate")
+ .setRequired(true)
+ );
+
+export async function run(msg, data) {
+ const expression = data.get("expression").value;
+ const context = Object.assign({ message: msg }, this);
+
+ // 1. Run the evaluation
+ const { output, isError, type, elapsed } = await runEval(expression, context);
+
+ // 2. Chunk the output to bypass Discord limits (Max embed description is 4096 chars)
+ // We use 3800 to leave room for the header and markdown formatting
+ const chunkSize = 3800;
+ const chunks = [];
+ for (let i = 0; i < output.length; i += chunkSize) {
+ chunks.push(output.slice(i, i + chunkSize));
+ }
+
+ const totalPages = chunks.length;
+ let currentPage = 0;
+
+ // Helper to build the specific embed page
+ const buildPageContent = (pageIdx, expired = false) => {
+ const icon = isError ? "❌" : "✅";
+ const title = `${icon} Eval Result`;
+
+ // Embed description includes the metadata and the codeblock
+ const desc = `**Type:** \`${type}\` • **Time:** \`${elapsed}ms\`\n\`\`\`js\n${chunks[pageIdx]}\n\`\`\``;
+
+ // Customize footer based on state
+ let footerText = `Page ${pageIdx + 1}/${totalPages}`;
+ if (expired) footerText = "⌛ Controls expired";
+ else if (totalPages > 1) footerText += " • ⬅️ ➡️ Navigate • ❌ Delete";
+ else footerText += " • ❌ Delete";
+
+ const embed = new EmbedBuilder()
+ .setColor(isError ? "#ff0000" : getGlobalColor()) // Red if error, default otherwise
+ .setTitle(title)
+ .setDescription(desc)
+ .setFooter({ text: footerText })
+ .toJSON();
+
+ return { embeds: [embed] };
+ };
+
+ // 3. Send the initial message using the wrapper
+ const replyMsg = await msg.replyEmbed(buildPageContent(0));
+ if (!replyMsg?.message) return;
+
+ // 4. Setup React UI
+ // If it's only 1 page, we just show the Delete button. Otherwise, add arrows.
+ const navEmojis = totalPages > 1 ? ["⬅️", "➡️", "❌"] : ["❌"];
+ let unobserve = null;
+ let emojiTimeout = null;
+
+ for (const emoji of navEmojis) {
+ await replyMsg.message.react(emoji).catch(() => {});
+ }
+
+ // Helper: Clear reactions when time runs out
+ const clearReactions = async () => {
+ try {
+ await replyMsg.message.removeAllReactions();
+ } catch (e) {
+ for (const emoji of navEmojis) {
+ try {
+ await replyMsg.message.removeReaction(emoji);
+ } catch (_) {}
+ }
+ }
+ };
+
+ // Helper: Reset inactivity timer
+ const resetTimer = () => {
+ clearTimeout(emojiTimeout);
+ emojiTimeout = setTimeout(async () => {
+ if (unobserve) unobserve();
+ await clearReactions();
+ await replyMsg.editEmbed(buildPageContent(currentPage, true)).catch(() => {});
+ }, EMOJI_REMOVE_TIMEOUT);
+ };
+
+ // 5. Start listening for reactions
+ unobserve = replyMsg.onReaction(navEmojis, async (e) => {
+ // Handle specific actions
+ if (e.emoji_id === "❌") {
+ // Clean up and delete the message
+ clearTimeout(emojiTimeout);
+ if (unobserve) unobserve();
+ await replyMsg.message.delete().catch(() => {});
+ return; // Exit completely
+ }
+
+ resetTimer();
+
+ if (e.emoji_id === "⬅️") {
+ currentPage = currentPage > 0 ? currentPage - 1 : totalPages - 1;
+ } else if (e.emoji_id === "➡️") {
+ currentPage = currentPage < totalPages - 1 ? currentPage + 1 : 0;
+ }
+
+ // Update Embed
+ await replyMsg.editEmbed(buildPageContent(currentPage)).catch(() => {});
+ });
+
+ resetTimer();
+}
\ No newline at end of file
diff --git a/commands/forceleave.mjs b/commands/forceleave.mjs
new file mode 100644
index 0000000..09ce7d7
--- /dev/null
+++ b/commands/forceleave.mjs
@@ -0,0 +1,31 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("forceleave")
+ .addAlias("fl")
+ .setDescription("Make Remix leave a channel even if you're not in it.")
+ .setRequirement(r => r.addPermission("ManageChannels"))
+ .setCategory("music")
+ .addChannelOption(o =>
+ o.setName("channelId")
+ .setDescription("The channel that should be left.")
+ .setRequired(true)
+ );
+
+function embed(desc) {
+ return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] };
+}
+
+export async function run(msg, data) {
+ const cid = data.get("channelId").value;
+ const targetChannel = this.client.channels.cache.get(cid);
+ if (!targetChannel) return msg.replyEmbed(embed("❌ Channel not found."));
+ if (msg.message.guildId !== targetChannel.guildId)
+ return msg.replyEmbed(embed("❌ This command has to be run in the same server as the voice channel."));
+ const p = this.players.playerMap.get(cid);
+ if (!p) return msg.replyEmbed(embed("❌ Player not found."));
+ if (!p.connection) return msg.replyEmbed(embed("❌ Player not initialized."));
+ this.players.leave(msg, cid);
+}
diff --git a/commands/invite.mjs b/commands/invite.mjs
new file mode 100644
index 0000000..3480940
--- /dev/null
+++ b/commands/invite.mjs
@@ -0,0 +1,32 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("invite")
+ .setDescription("Get the invite link for Remix and the support server.", "commands.invite")
+ .addAliases("addbot", "remix")
+ .setCategory("util");
+
+export async function run(message) {
+ const description =
+ "Add Remix to your server directly from [FluxerList]().\n\n" +
+ "Join our community at [fluxer.gg/remix](https://fluxer.gg/remix) for support, updates, and direct feedback.";
+
+ const botUser = message.handler.client.user;
+
+ const botIcon = botUser?.displayAvatarURL?.() || null;
+
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setAuthor({
+ name: "Invite Remix",
+ iconURL: botIcon
+ })
+ .setDescription(description)
+ .toJSON();
+
+ await message.replyEmbed({
+ embeds: [embed]
+ });
+}
\ No newline at end of file
diff --git a/commands/join.mjs b/commands/join.mjs
new file mode 100644
index 0000000..8ba21ee
--- /dev/null
+++ b/commands/join.mjs
@@ -0,0 +1,121 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+import Player from "../src/Player.mjs";
+
+export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) {
+ if (!this.client.channels.cache.has(cid)) {
+ ecb();
+ const embed = new EmbedBuilder().setColor(getGlobalColor())
+ .setDescription("Couldn't find the channel `" + cid + "`\nUse the help command to learn more about this. (`%help join`)")
+ .toJSON();
+ return message.replyEmbed({ embeds: [embed] });
+ }
+ if (this.players.playerMap.has(cid)) {
+ cb(this.players.playerMap.get(cid));
+ const embed = new EmbedBuilder().setColor(getGlobalColor())
+ .setDescription("Already joined <#" + cid + ">.")
+ .toJSON();
+ return message.replyEmbed({ embeds: [embed] });
+ }
+
+ // Guard: moonlink must be ready before we can play anything
+ if (!this.moonlink) {
+ const embed = new EmbedBuilder().setColor(getGlobalColor())
+ .setDescription("⚠️ Audio node is still connecting — please try again in a few seconds.")
+ .toJSON();
+ ecb();
+ return message.replyEmbed({ embeds: [embed] });
+ }
+
+ const p = new Player(this.config.token, {
+ client: this.client,
+ config: this.config,
+ nodelink: this.config.nodelink,
+ moonlink: this.moonlink ?? null,
+ messageChannel: message.channel,
+ settingsMgr: this.settingsMgr ?? this.settings ?? null,
+ observedVoiceUsers: this.observedVoiceUsers ?? null,
+ });
+
+ p.on("autoleave", () => {
+ const guildId = message.channel?.guildId
+ ?? message.channel?.guild?.id
+ ?? message.message?.guildId
+ ?? message.channel?.server_id
+ ?? message.channel?.serverId;
+ const is247 = (() => {
+ try {
+ const raw = this.settingsMgr?.getServer?.(guildId)?.get?.("stay_247");
+ return raw && raw !== "none";
+ } catch (_) { return false; }
+ })();
+ const prefix = (() => {
+ try {
+ return this._commands?.getPrefix?.(message.channel?.guild?.id) ?? "%";
+ } catch (_) { return "%"; }
+ })();
+ const desc = is247
+ ? `Left channel <#${cid}> because of inactivity.`
+ : `Left channel <#${cid}> because of inactivity.\nIf you want me to stay in voice, use \`${prefix}247 on/auto\``;
+ const embed = new EmbedBuilder().setColor(getGlobalColor())
+ .setDescription(desc)
+ .toJSON();
+ message.channel.sendEmbed({ embeds: [embed] });
+ this.players.playerMap.delete(cid);
+ p.destroy();
+ });
+
+ p.on("message", m => {
+ const guildId = message.channel?.guild?.id ?? message.channel?.server_id ?? message.channel?.serverId;
+ const raw = this.settingsMgr?.getServer?.(guildId)?.get("songAnnouncements");
+ const disabled = raw === false || raw === 0 ||
+ ["false","0","no","off","disable"].includes(String(raw).toLowerCase().trim());
+ if (disabled) return;
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(m).toJSON();
+ message.channel.sendEmbed({ embeds: [embed] });
+ });
+
+ this.players.playerMap.set(cid, p);
+
+ const joiningEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("⏳ Joining Channel...").toJSON();
+ const statusMsg = await message.replyEmbed({ embeds: [joiningEmbed] });
+ try {
+ await p.join(cid);
+ const okEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(`✅ Successfully joined <#${cid}>`).toJSON();
+ await statusMsg.editEmbed({ embeds: [okEmbed] });
+ cb(p);
+ } catch (e) {
+ this.players.playerMap.delete(cid);
+ p.destroy();
+ const errEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(`❌ Failed to join: ${e.message}`).toJSON();
+ await statusMsg.editEmbed({ embeds: [errEmbed] });
+ ecb(e);
+ }
+}
+
+export const command = new CommandBuilder()
+ .setName("join")
+ .setDescription("Make the bot join your voice channel, or specify one.", "commands.join")
+ .setId("join")
+ .setCategory("music");
+
+export function run(message) {
+ // @fluxerjs/core Message has no .member property — voice channel detection
+ // is handled entirely by checkVoiceChannels() via the VoiceManager state map.
+ const cid = this.players.checkVoiceChannels(message);
+
+ if (!cid) {
+ const embed = new EmbedBuilder().setColor(getGlobalColor())
+ .setDescription("❌ You're not in a voice channel. Please join one first.")
+ .toJSON();
+ return message.replyEmbed({ embeds: [embed] });
+ }
+
+ this.players.initPlayer(message, cid);
+}
+
+export const exportDef = {
+ name: "joinChannel",
+ object: joinChannel
+};
diff --git a/commands/leave.mjs b/commands/leave.mjs
new file mode 100644
index 0000000..e7220a7
--- /dev/null
+++ b/commands/leave.mjs
@@ -0,0 +1,71 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { logger } from "../src/constants/Logger.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("leave")
+ .setDescription("Make the bot leave your current voice channel", "commands.leave")
+ .addAliases("l", "stop")
+ .setCategory("music");
+
+function embed(desc) {
+ return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] };
+}
+
+export async function run(msg) {
+ const guildId = msg.channel?.guild?.id ?? msg.message?.guildId;
+
+ const userChannelId = this.players.checkVoiceChannels(msg);
+ if (!userChannelId) return msg.replyEmbed(embed("⚠️ Please join a voice channel first."));
+
+ const cid = String(userChannelId).replace(/\D/g, "");
+
+ if (!this.players.playerMap.has(cid)) {
+ const guildChannels = [...this.players.playerMap.entries()]
+ .filter(([chId, p]) => p._guildId === guildId)
+ .map(([chId]) => `<#${chId}>`);
+
+ if (guildChannels.length === 0) return msg.replyEmbed(embed("I'm not in a voice channel."));
+ if (guildChannels.length === 1) return msg.replyEmbed(embed(`⚠️ Please join ${guildChannels[0]} to use this command.`));
+ return msg.replyEmbed(embed(
+ `⚠️ I'm playing in multiple channels! Please join one of them:\n` +
+ guildChannels.map(c => `• ${c}`).join("\n")
+ ));
+ }
+
+ const player = this.players.playerMap.get(cid);
+ if (!player?.connection) return msg.replyEmbed(embed("Player not initialized."));
+
+ const set = this.getSettings(msg);
+ const raw = set?.get("stay_247");
+ const ch247 = (!raw || raw === "none")
+ ? new Set()
+ : Array.isArray(raw)
+ ? new Set(raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean))
+ : new Set([String(raw).replace(/\D/g, "")]);
+
+ if (ch247.has(cid)) {
+ const mode = set?.get("stay_247_mode") ?? "auto";
+ this.markIntentionalLeave(cid);
+ this.players.playerMap.delete(cid);
+ await player.leave().catch(() => {});
+ player.destroy();
+
+ if (mode === "auto") {
+ msg.replyEmbed(embed(`✅ Successfully Left — rejoining <#${cid}> in 5 seconds.\nTo disable 24/7 mode permanently, use \`%247 off\`.`));
+ const leave247Delay = this.config?.timers?.leave247RejoinDelay ?? 5000;
+ setTimeout(() => {
+ if (this._spawnPlayer) {
+ this._spawnPlayer(guildId, cid).catch(e =>
+ logger.warn("[leave] 247 rejoin failed for", cid, e.message)
+ );
+ }
+ }, leave247Delay);
+ } else {
+ msg.replyEmbed(embed(`✅ Successfully Left.\nℹ️ 24/7 mode is **on** — bot won't rejoin automatically. Use \`%play\` to bring it back, or \`%247 off\` to fully disable.`));
+ }
+ } else {
+ await this.leaveChannel(cid, guildId, msg);
+ }
+}
diff --git a/commands/list.mjs b/commands/list.mjs
new file mode 100644
index 0000000..1058413
--- /dev/null
+++ b/commands/list.mjs
@@ -0,0 +1,91 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { QueuePaginator, getGlobalColor } from "../src/MessageHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+
+const PAGE_SIZE = 10;
+const SESSION_MS = 30 * 1000;
+
+export const command = new CommandBuilder()
+ .setName("list")
+ .setDescription("List the songs in the queue of your current voice channel.", "commands.list")
+ .setCategory("music")
+ .addAliases("queue", "q")
+ .addNumberOption(o =>
+ o.setName("page")
+ .setDescription("Page number to jump to.")
+ .setRequired(false)
+ );
+
+export async function run(message, data) {
+ const p = await this.getPlayer(message);
+ if (!p) return;
+
+ const current = p.queue.getCurrent();
+ const totalTracks = p.queue.size();
+
+ if (!current && totalTracks === 0) {
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("📭 The queue is empty. Use `%play` to add songs!").toJSON();
+ return message.replyEmbed({ embeds: [embed] });
+ }
+
+ const totalPages = totalTracks > 0
+ ? Math.max(1, Math.ceil(totalTracks / PAGE_SIZE))
+ : 1;
+
+ const pageVal = data.get("page")?.value;
+ const startPage = Math.max(1, Math.min((!pageVal || isNaN(pageVal)) ? 1 : pageVal, totalPages));
+
+ const buildEmbed = (page) => {
+ const safePage = (isNaN(page) || page < 1) ? 1 : Math.min(Math.floor(page), totalPages);
+ const loopState = p.queue.songLoop ? "🔂 Song" : p.queue.loop ? "🔁 Queue" : "🛑 Off";
+
+ let desc = "";
+
+ // ── Header: track count + remaining time ──────────────────────────────
+ const remaining = p.getQueueRemainingTime();
+ desc += `📋 **${totalTracks} track${totalTracks !== 1 ? "s" : ""} in queue** • ⏱️ \`${remaining}\`\n`;
+
+ // ── Now Playing block ─────────────────────────────────────────────────
+ if (current) {
+ const elapsed = p.getCurrentElapsedDuration();
+ const total = p.getCurrentDuration();
+ const link = current.spotifyUrl || current.url || "";
+ let title = current.title;
+ if (title.length > 50) title = title.slice(0, 47) + "...";
+ const titleFmt = link ? `[${title}](${link})` : title;
+
+ desc += `\n🎵 **Now Playing**\n`;
+ desc += `${titleFmt} • \`${elapsed} / ${total}\`\n`;
+ }
+
+ desc += `\n`;
+
+ // ── Queue list ────────────────────────────────────────────────────────
+ if (totalTracks === 0) {
+ desc += "_Queue is empty._";
+ } else {
+ const { items, start } = p.queue.getPage(safePage, PAGE_SIZE);
+
+ items.forEach((vid, i) => {
+ const index = String(start + i + 1).padStart(2, " ");
+ const dur = vid.duration ? p.getDuration(vid.duration) : "?:??";
+ const link = vid.spotifyUrl || vid.url || "";
+ let title = vid.title;
+ if (title.length > 45) title = title.slice(0, 42) + "...";
+ title = link ? `[${title}](${link})` : title;
+ desc += `\`${index}.\` ${title} • \`${dur}\`\n`;
+ });
+ }
+
+ return new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setAuthor({ name: "🎧 Queue" })
+ .setDescription(desc.trim())
+ .setFooter({ text: `Page ${safePage}/${totalPages} • ${loopState}` })
+ .toJSON();
+ };
+
+ new QueuePaginator(message, this.messages, this.client)
+ .setTimeout(SESSION_MS)
+ .send(buildEmbed, totalPages, startPage);
+}
diff --git a/commands/login.mjs b/commands/login.mjs
new file mode 100644
index 0000000..1ae26b3
--- /dev/null
+++ b/commands/login.mjs
@@ -0,0 +1,24 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("login")
+ .setDescription("Confirm a login of your account on the website", "commands.login")
+ .setCategory("util")
+ .addStringOption(o =>
+ o.setName("id")
+ .setDescription("The id you got from logging in at the dashboard.", "options.login.id")
+ .setRequired(true));
+
+export async function run(msg, data) {
+ const log = data.get("id").value;
+ const verified = await this.loadedModules.get("wb-dashboard").instance.login(log, msg.author);
+ const desc = (typeof verified === "string")
+ ? "❌ Login failed! Reason: `" + verified + "`. If this is an error and the issue persists, please contact a team member through the server in my description."
+ : (verified === true)
+ ? "✅ Login succeeded! You can continue to the webpage now."
+ : "⚠️ An unknown error occurred. Please contact a team member if this issue persists!";
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON();
+ msg.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/loop.mjs b/commands/loop.mjs
new file mode 100644
index 0000000..cbadbea
--- /dev/null
+++ b/commands/loop.mjs
@@ -0,0 +1,24 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("loop")
+ .setDescription("Toggle the looping of your queue/song.", "commands.loop")
+ .setCategory("music")
+ .addChoiceOption(opt =>
+ opt.setName("type")
+ .addChoices("queue", "song")
+ .setDescription("Specifies what loop should be toggled.", "options.loop.type")
+ .setRequired(true));
+
+export async function run(message, data) {
+ const p = await this.getPlayer(message);
+ if (!p) return;
+ const res = p.loop(data.get("type").value);
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(res)
+ .toJSON();
+ message.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/lyrics.mjs b/commands/lyrics.mjs
new file mode 100644
index 0000000..96010af
--- /dev/null
+++ b/commands/lyrics.mjs
@@ -0,0 +1,176 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { logger } from "../src/constants/Logger.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+import { Utils } from "../src/Utils.mjs";
+
+export const command = new CommandBuilder()
+ .setName("lyrics")
+ .setDescription("Display synced lyrics from NodeLink", "commands.lyrics")
+ .addAliases("lyric", "ly")
+ .setCategory("music");
+
+const LOADING_FRAMES = ["◐", "◓", "◑", "◒"];
+const EMOJI_REMOVE_TIMEOUT = 60_000;
+const SESSION_MS = 180_000;
+
+export async function run(message) {
+ const p = await this.getPlayer(message, false, false, false);
+ if (!p) return;
+
+ const current = p.queue.getCurrent();
+ if (!current) {
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("❌ There's nothing playing at the moment.").toJSON();
+ return message.replyEmbed({ embeds: [embed] });
+ }
+
+ // Animated loading spinner
+ let frame = 0;
+ const loadingMsg = await message.replyEmbed({ embeds: [
+ new EmbedBuilder().setColor(getGlobalColor())
+ .setDescription(`${LOADING_FRAMES[0]} Searching lyrics for **${Utils.truncate(current.title, 40)}**...`)
+ .toJSON()
+ ] });
+
+ const loadingInterval = setInterval(() => {
+ frame = (frame + 1) % LOADING_FRAMES.length;
+ loadingMsg.editEmbed({ embeds: [
+ new EmbedBuilder().setColor(getGlobalColor())
+ .setDescription(`${LOADING_FRAMES[frame]} Searching lyrics for **${Utils.truncate(current.title, 40)}**...`)
+ .toJSON()
+ ] }).catch(() => {});
+ }, 800);
+
+ try {
+ const result = await p.lyrics();
+
+ clearInterval(loadingInterval);
+
+ if (!result || !result.text) {
+ return loadingMsg.editEmbed({ embeds: [
+ new EmbedBuilder().setColor(getGlobalColor())
+ .setDescription(
+ `❌ No lyrics available for **${Utils.truncate(current.title, 40)}**.\n\n` +
+ `💡 NodeLink lyrics plugin may not have this track. Try a popular song!`
+ ).toJSON()
+ ] });
+ }
+
+ try { await loadingMsg.message.delete(); } catch {}
+
+ const syncIndicator = result.synced ? " ⏱️ Synced" : "";
+ const displayTitle = Utils.cleanTitle(current.title);
+ const artist = current.artists?.[0]?.name || current.author?.name || "Unknown Artist";
+ const lines = result.text.split("\n").filter(l => l.trim());
+ const totalLines = lines.length;
+
+ const LINES_PER_PAGE = 25;
+ const totalPages = Math.ceil(totalLines / LINES_PER_PAGE);
+
+ // Single page — no pagination needed
+ if (totalPages === 1) {
+ const singleEmbed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle(`🎵 ${Utils.truncate(displayTitle, 50)}`)
+ .setDescription([
+ `by *${artist}*${syncIndicator}`,
+ ``,
+ "```",
+ lines.join("\n"),
+ "```"
+ ].join("\n"))
+ .setFooter({ text: `NodeLink • ${totalLines} lines` });
+ if (current.thumbnail) singleEmbed.setThumbnail(current.thumbnail);
+ return message.replyEmbed({ embeds: [singleEmbed.toJSON()] });
+ }
+
+ // Multi-page
+ const pages = [];
+ for (let i = 0; i < totalLines; i += LINES_PER_PAGE) {
+ pages.push(lines.slice(i, i + LINES_PER_PAGE).join("\n"));
+ }
+
+ let currentPage = 0;
+ let emojiRemoveTimeout;
+
+ const buildContent = (pageIdx, expired = false) => {
+ const b = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle(`🎵 ${Utils.truncate(displayTitle, 50)}`)
+ .setDescription([
+ `by *${artist}*${syncIndicator} • Page ${pageIdx + 1}/${totalPages}`,
+ ``,
+ "```",
+ pages[pageIdx],
+ "```"
+ ].join("\n"))
+ .setFooter({ text: expired
+ ? `⌛ Controls expired • NodeLink • ${totalLines} lines`
+ : `NodeLink • ${totalLines} lines total` });
+ if (current.thumbnail) b.setThumbnail(current.thumbnail);
+ return { embeds: [b.toJSON()] };
+ };
+
+ const msg = await message.replyEmbed(buildContent(0));
+ if (!msg?.message) return;
+
+ const emojis = ["⬅️", "➡️"];
+ for (const emoji of emojis) {
+ await msg.message.react(emoji).catch(() => {});
+ }
+
+ const clearReactions = async () => {
+ try {
+ await msg.message.removeAllReactions();
+ } catch {
+ for (const emoji of emojis) {
+ await msg.message.removeReaction(emoji).catch(() => {});
+ }
+ }
+ };
+
+ const resetEmojiTimer = () => {
+ clearTimeout(emojiRemoveTimeout);
+ emojiRemoveTimeout = setTimeout(async () => {
+ await clearReactions();
+ msg.editEmbed(buildContent(currentPage, true)).catch(() => {});
+ }, EMOJI_REMOVE_TIMEOUT);
+ };
+
+ const unobserve = msg.onReaction(emojis, async (e) => {
+ resetEmojiTimer();
+ if (e.emoji_id === "⬅️") {
+ currentPage = currentPage > 0 ? currentPage - 1 : totalPages - 1;
+ } else if (e.emoji_id === "➡️") {
+ currentPage = currentPage < totalPages - 1 ? currentPage + 1 : 0;
+ }
+ msg.editEmbed(buildContent(currentPage)).catch(() => {});
+ });
+
+ resetEmojiTimer();
+
+ // Full session close after SESSION_MS
+ setTimeout(() => {
+ clearTimeout(emojiRemoveTimeout);
+ unobserve();
+ const closedEmbed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle(`🎵 ${Utils.truncate(displayTitle, 50)}`)
+ .setDescription([
+ `by *${artist}*${syncIndicator} • Page ${currentPage + 1}/${totalPages}`,
+ ``,
+ "```",
+ pages[currentPage],
+ "```"
+ ].join("\n"))
+ .setFooter({ text: `Session closed • NodeLink • ${totalLines} lines` });
+ if (current.thumbnail) closedEmbed.setThumbnail(current.thumbnail);
+ msg.editEmbed({ embeds: [closedEmbed.toJSON()] }).catch(() => {});
+ }, SESSION_MS);
+
+ } catch (err) {
+ clearInterval(loadingInterval);
+ logger.error("[Lyrics Command] Error:", err);
+ loadingMsg.editEmbed({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(`❌ Error: ${Utils.truncate(err.message, 100)}`).toJSON()] }).catch(() => {});
+ }
+}
\ No newline at end of file
diff --git a/commands/np.mjs b/commands/np.mjs
new file mode 100644
index 0000000..00286b5
--- /dev/null
+++ b/commands/np.mjs
@@ -0,0 +1,28 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("np")
+ .setDescription("Request the name and url of the currently playing song.", "commands.np")
+ .addAliases("current", "nowplaying");
+
+export async function run(msg) {
+ const p = await this.getPlayer(msg);
+ if (!p) return;
+
+ const loadingEmbed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription("⏳ Loading...")
+ .toJSON();
+ const loadingMsg = await msg.replyEmbed({ embeds: [loadingEmbed] });
+
+ const data = await p.nowPlaying();
+
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(data.msg);
+ if (data.image) embed.setThumbnail(data.image);
+
+ loadingMsg.editEmbed({ embeds: [embed.toJSON()] }).catch(() => {});
+}
diff --git a/commands/pause.mjs b/commands/pause.mjs
new file mode 100644
index 0000000..e4871cf
--- /dev/null
+++ b/commands/pause.mjs
@@ -0,0 +1,19 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("pause")
+ .setDescription("Pause the playback in your voice channel", "commands.pause")
+ .setCategory("music");
+
+export async function run(message) {
+ const p = await this.getPlayer(message);
+ if (!p) return;
+ const res = p.pause();
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(res)
+ .toJSON();
+ message.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/play.mjs b/commands/play.mjs
new file mode 100644
index 0000000..2497ebc
--- /dev/null
+++ b/commands/play.mjs
@@ -0,0 +1,68 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+import { PROVIDER_CHOICES } from "../src/constants/providers.mjs";
+
+function parseInlineProvider(raw) {
+ const match = raw.match(/^([a-z]+):\s*(.+)$/i);
+ if (!match) return { provider: null, query: raw.trim() };
+ const maybeProvider = match[1].toLowerCase();
+ if (PROVIDER_CHOICES.includes(maybeProvider)) {
+ return { provider: maybeProvider, query: match[2].trim() };
+ }
+ return { provider: null, query: raw.trim() };
+}
+
+export const command = new CommandBuilder()
+ .setName("play")
+ .setId("play")
+ .setCategory("music")
+ .setDescription(
+ "Play a song or playlist from a URL or search query.\n" +
+ "Supports YouTube, Spotify, SoundCloud, Deezer, Apple Music, Tidal, and more.\n" +
+ "Default search: YouTube Music. Use `-p ` or inline prefix e.g. `sp: blinding lights`.",
+ "commands.play"
+ )
+ .addExamples(
+ "$prefixplay take over league of legends",
+ "$prefixplay sp: blinding lights",
+ "$prefixplay dz: get lucky",
+ "$prefixplay -p yt take over league of legends",
+ "$prefixplay https://open.spotify.com/track/...",
+ "$prefixp take over league of legends"
+ )
+ .addTextOption(option =>
+ option.setName("query")
+ .setDescription("A search query, URL, or provider-prefixed query like `sp: song name`.", "options.play.query")
+ .setRequired(true)
+ )
+ .addChoiceOption(o =>
+ o.setName("provider")
+ .setDescription("The search provider. Default: YouTube Music. Or use inline prefix: sp:, dz:, am:, yt:, sc: etc.", "options.play.provider")
+ .addFlagAliases("p", "u", "use")
+ .addChoices(...PROVIDER_CHOICES)
+ .setDefault("yt")
+ , true)
+ .addAlias("p");
+
+export async function run(message, data) {
+ const p = await this.getPlayer(message, true, true, true);
+ if (!p) return;
+
+ const rawQuery = data.get("query").value;
+ const flagProvider = data.get("provider")?.value;
+ const { provider: inlineProvider, query } = parseInlineProvider(rawQuery);
+ const provider = inlineProvider ?? flagProvider ?? "ytm";
+
+ const searchEmbed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription("🔍 Searching...")
+ .toJSON();
+ const statusMsg = await message.replyEmbed({ embeds: [searchEmbed] });
+
+ const messages = p.play(query, false, provider);
+ messages.on("message", d => {
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(d).toJSON();
+ statusMsg.editEmbed({ embeds: [embed] }).catch(() => {});
+ });
+}
diff --git a/commands/player.mjs b/commands/player.mjs
new file mode 100644
index 0000000..e2ed8fb
--- /dev/null
+++ b/commands/player.mjs
@@ -0,0 +1,490 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { Utils } from "../src/Utils.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("player")
+ .setDescription("Create an interactive player control panel with live progress", "commands.player")
+ .setCategory("music");
+
+// Visual states
+const STATES = {
+ playing: "🎵",
+ paused: "⏸️",
+ stopped: "🔇",
+ loading: "⏳"
+};
+
+// Control layout
+const CONTROLS = {
+ prev: { emoji: "⏮️", action: "previous", desc: "Previous" },
+ play: { emoji: "▶️", action: "resume", desc: "Play" },
+ pause: { emoji: "⏸️", action: "pause", desc: "Pause" },
+ stop: { emoji: "⏹️", action: "stop", desc: "Stop" },
+ next: { emoji: "⏭️", action: "skip", desc: "Skip" },
+ loop: { emoji: "🔁", action: "loop", desc: "Loop" },
+ shuffle: { emoji: "🔀", action: "shuffle", desc: "Shuffle" },
+ volDown: { emoji: "🔉", action: "voldown", desc: "Volume Down" },
+ volUp: { emoji: "🔊", action: "volup", desc: "Volume Up" },
+ lyrics: { emoji: "📜", action: "lyrics", desc: "Lyrics" },
+ close: { emoji: "❌", action: "close", desc: "Close" }
+};
+
+// Progress bar characters
+const PROGRESS = {
+ filled: "▰",
+ empty: "▱",
+ indicator: "●",
+ start: "▏",
+ end: "▕"
+};
+
+// Auto-remove timer: 1 minute
+const EMOJI_REMOVE_TIMEOUT = 60000;
+
+export async function run(msg) {
+ const player = await this.getPlayer(msg, false, false, false);
+ if (!player) return;
+
+ const timeout = this.config?.timers?.playerSessionTimeout ?? this.config.playerAFKTimeout ?? 300000;
+ const controlsLayout = [
+ [CONTROLS.prev, CONTROLS.play, CONTROLS.pause, CONTROLS.stop, CONTROLS.next],
+ [CONTROLS.loop, CONTROLS.shuffle, CONTROLS.volDown, CONTROLS.volUp, CONTROLS.lyrics],
+ [CONTROLS.close]
+ ];
+
+ const allControls = controlsLayout.flat();
+ const controlEmojis = allControls.map(c => c.emoji);
+
+ const buildEmbed = (state = {}) => {
+ const current = player.queue.getCurrent();
+ const isPlaying = !player.paused && current;
+ const statusEmoji = isPlaying ? STATES.playing : player.paused ? STATES.paused : STATES.stopped;
+
+ let progressBar = "";
+ let timeDisplay = "`0:00 / 0:00`";
+
+ if (current?.duration && player.startedPlaying) {
+ const elapsed = Date.now() - player.startedPlaying;
+ const totalMs = typeof current.duration === "object"
+ ? (current.duration.seconds ?? 0) * 1000
+ : current.duration;
+
+ const progress = Math.min(elapsed / totalMs, 1);
+ const barLength = 20;
+ const filled = Math.floor(progress * barLength);
+ const position = Math.min(Math.max(filled, 0), barLength - 1);
+ const emptyCount = Math.max(barLength - position - 1, 0);
+
+ progressBar = PROGRESS.start +
+ PROGRESS.filled.repeat(position) +
+ (isPlaying ? PROGRESS.indicator : PROGRESS.filled) +
+ PROGRESS.empty.repeat(emptyCount) +
+ PROGRESS.end;
+
+ // Use Utils.prettifyMS instead of local formatTime
+ const elapsedStr = Utils.prettifyMS(elapsed);
+ const totalStr = Utils.prettifyMS(totalMs);
+ timeDisplay = `\`${elapsedStr} / ${totalStr}\``;
+ } else {
+ progressBar = PROGRESS.start + PROGRESS.empty.repeat(20) + PROGRESS.end;
+ }
+
+ const volPercent = Math.round((player.preferredVolume || 1) * 100);
+ const volBars = Math.ceil(volPercent / 10);
+ const volumeBar = "█".repeat(volBars) + "░".repeat(10 - volBars);
+
+ const queueSize = player.queue.size();
+ const loopStatus = player.queue.songLoop ? "🔂 Song" : player.queue.loop ? "🔁 Queue" : "❌ Off";
+
+ const nowPlaying = current
+ // Use Utils.truncate instead of local truncate
+ ? `[${Utils.truncate(current.title, 45)}](${current.spotifyUrl || current.url})`
+ : "*Nothing playing*";
+
+ const description = [
+ `${statusEmoji} **Now Playing**`,
+ `${nowPlaying}`,
+ ``,
+ `${progressBar}`,
+ `${timeDisplay}`,
+ ``,
+ `🔊 Volume: \`${volPercent}%\` ${volumeBar}`,
+ `📋 Queue: \`${queueSize}\` tracks | Loop: ${loopStatus}`,
+ ``,
+ state.message ? `💬 *${state.message}*` : "💡 *React to control playback*",
+ ``,
+ `⏱️ Session expires in ${Math.ceil(timeout / 60000)}m of inactivity`
+ ].join("\n");
+
+ const builder = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle("🎧 Music Player Controls")
+ .setDescription(description)
+ .setFooter({
+ text: `Requested by ${msg.author?.username || "Unknown"} • Controls active`,
+ iconURL: msg.author?.avatarURL
+ })
+ .setTimestamp();
+ if (current?.thumbnail) builder.setThumbnail(current.thumbnail);
+ return builder.toJSON();
+ };
+
+ const message = await msg.replyEmbed({ embeds: [buildEmbed()] });
+ if (!message?.message) return;
+
+ // Add reactions with staggered animation
+ for (const row of controlsLayout) {
+ for (const control of row) {
+ try {
+ await message.message.react(control.emoji);
+ await Utils.sleep(200); // Use Utils.sleep instead of inline Promise
+ } catch (_) {}
+ }
+ }
+
+ let sessionTimeout;
+ let updateInterval;
+ let emojiRemoveTimeout;
+ let lastState = {};
+
+ // Track active lyrics message
+ let activeLyricsMsg = null;
+ let lyricsUnobserve = null;
+ let lyricsEmojiTimeout = null;
+
+ // Helper: Clear all reactions
+ const clearReactions = async () => {
+ try {
+ await message.message.removeAllReactions();
+ } catch (e) {
+ for (const emoji of controlEmojis) {
+ try {
+ await message.message.removeReaction(emoji);
+ } catch (_) {}
+ }
+ }
+ };
+
+ // Helper: Reset emoji removal timer
+ const resetEmojiTimer = () => {
+ clearTimeout(emojiRemoveTimeout);
+ emojiRemoveTimeout = setTimeout(async () => {
+ await clearReactions();
+ const disabledEmbed = buildEmbed({ message: "⌛ Controls disabled (react to re-enable)" });
+ disabledEmbed.footer = { text: "Controls expired • React to refresh" };
+ await message.editEmbed({ embeds: [disabledEmbed] }).catch(() => {});
+ }, EMOJI_REMOVE_TIMEOUT);
+ };
+
+ // Helper: Clear lyrics reactions
+ const clearLyricsReactions = async (lyricsMsg) => {
+ if (!lyricsMsg?.message) return;
+ try {
+ await lyricsMsg.message.removeAllReactions();
+ } catch (e) {
+ for (const emoji of ["⬅️", "➡️", "❌"]) {
+ try {
+ await lyricsMsg.message.removeReaction(emoji);
+ } catch (_) {}
+ }
+ }
+ };
+
+ const refresh = (extra = {}) => {
+ const embed = buildEmbed(extra);
+ message.editEmbed({ embeds: [embed] }).catch(() => {});
+ lastState = extra;
+ };
+
+ const closeSession = async (reason = "timeout") => {
+ clearTimeout(sessionTimeout);
+ clearTimeout(emojiRemoveTimeout);
+ clearInterval(updateInterval);
+ unobserve?.();
+
+ // Remove all player event listeners added by this session
+ player.off("startplay", onStartPlay);
+ player.off("playback", onPlayback);
+ player.off("stopplay", onStopPlay);
+ player.off("queue", onQueue);
+ player.off("volume", onVolume);
+ player.off("autoleave", onAutoLeave);
+
+ // Cleanup any active lyrics
+ if (lyricsUnobserve) {
+ lyricsUnobserve();
+ clearTimeout(lyricsEmojiTimeout);
+ }
+ if (activeLyricsMsg) {
+ await clearLyricsReactions(activeLyricsMsg);
+ }
+
+ await clearReactions();
+
+ const closedEmbed = buildEmbed({
+ message: `Session closed${reason !== "timeout" ? ` • ${reason}` : " due to inactivity"}`
+ });
+ // Override title and footer on the plain object returned by toJSON()
+ closedEmbed.color = getGlobalColor();
+ closedEmbed.footer = { text: "Session ended" };
+ closedEmbed.title = "🎧 Music Player (Inactive)";
+
+ await message.editEmbed({
+ embeds: [closedEmbed],
+ content: reason === "user" ? "👋 Player controls closed" : undefined
+ }).catch(() => {});
+ };
+
+ const resetTimeout = () => {
+ clearTimeout(sessionTimeout);
+ sessionTimeout = setTimeout(() => closeSession("timeout"), timeout);
+ };
+
+ // Live progress updates
+ updateInterval = setInterval(() => {
+ if (!player.paused && player.queue.getCurrent()) {
+ refresh(lastState);
+ }
+ }, this.config?.timers?.playerUpdateInterval ?? 5000);
+
+ // Player events — store named handlers so we can remove them on closeSession
+ const onStartPlay = () => refresh({ message: "▶️ Started playing" });
+ const onPlayback = (playing) => refresh({ message: playing ? "▶️ Resumed" : "⏸️ Paused" });
+ const onStopPlay = () => refresh({ message: "⏹️ Stopped" });
+ const onQueue = (e) => {
+ if (e.type === "shuffle") refresh({ message: "🔀 Queue shuffled" });
+ if (e.type === "add") refresh({ message: `➕ Added: ${Utils.truncate(e.data.data.title, 30)}` });
+ };
+ const onVolume = (v) => refresh({ message: `🔊 Volume: ${Math.round(v * 100)}%` });
+ const onAutoLeave = () => closeSession("disconnected");
+
+ player.on("startplay", onStartPlay);
+ player.on("playback", onPlayback);
+ player.on("stopplay", onStopPlay);
+ player.on("queue", onQueue);
+ player.on("volume", onVolume);
+ player.on("autoleave", onAutoLeave);
+
+ // Reaction handler
+ const unobserve = message.onReaction(controlEmojis, async (e) => {
+ const control = allControls.find(c => c.emoji === e.emoji_id);
+ if (!control) return;
+
+ resetEmojiTimer();
+ resetTimeout();
+
+ let reply = "";
+ let shouldUpdate = true;
+
+ try {
+ switch (control.action) {
+ case "previous":
+ reply = "⏮️ Previous track (not implemented)";
+ break;
+
+ case "resume":
+ if (player.paused) {
+ reply = player.resume();
+ } else if (!player.queue.getCurrent() && !player.queue.isEmpty()) {
+ player.playNext();
+ reply = "▶️ Starting playback";
+ } else {
+ reply = "▶️ Already playing";
+ }
+ break;
+
+ case "pause":
+ reply = player.pause();
+ break;
+
+ case "stop":
+ await player._stopMediaPlayer();
+ player.queue.reset();
+ reply = "⏹️ Stopped and cleared";
+ break;
+
+ case "skip":
+ reply = player.skip();
+ break;
+
+ case "loop": {
+ const currentLoop = player.queue.loop;
+ const currentSongLoop = player.queue.songLoop;
+ if (!currentLoop && !currentSongLoop) {
+ player.queue.setSongLoop(true);
+ reply = "🔂 Song loop enabled";
+ } else if (currentSongLoop) {
+ player.queue.setSongLoop(false);
+ player.queue.setLoop(true);
+ reply = "🔁 Queue loop enabled";
+ } else {
+ player.queue.setLoop(false);
+ reply = "❌ Loop disabled";
+ }
+ break;
+ }
+
+ case "shuffle":
+ reply = player.shuffle();
+ break;
+
+ case "voldown": {
+ const newVolDown = Utils.clamp((player.preferredVolume || 1) - 0.1, 0, 1);
+ reply = player.setVolume(newVolDown);
+ break;
+ }
+
+ case "volup": {
+ const newVolUp = Utils.clamp((player.preferredVolume || 1) + 0.1, 0, 1);
+ reply = player.setVolume(newVolUp);
+ break;
+ }
+
+ case "lyrics":
+ reply = "📜 Fetching lyrics...";
+ refresh({ message: reply });
+
+ try {
+ // Cleanup previous lyrics
+ if (lyricsUnobserve) {
+ lyricsUnobserve();
+ clearTimeout(lyricsEmojiTimeout);
+ if (activeLyricsMsg) await clearLyricsReactions(activeLyricsMsg);
+ }
+
+ const lyricsResult = await player.lyrics();
+ if (!lyricsResult) {
+ reply = "❌ No lyrics found in NodeLink";
+ shouldUpdate = true;
+ break;
+ }
+
+ const syncBadge = lyricsResult.synced ? " ⏱️ Synced" : "";
+ const lines = lyricsResult.text.split('\n');
+ const totalLines = lines.length;
+ const LINES_PER_PAGE = 25;
+ const totalPages = Math.ceil(totalLines / LINES_PER_PAGE);
+
+ // Build pages
+ const pages = [];
+ for (let i = 0; i < totalLines; i += LINES_PER_PAGE) {
+ pages.push(lines.slice(i, i + LINES_PER_PAGE).join('\n'));
+ }
+
+ let currentPage = 0;
+
+ const buildLyricsContent = (pageIdx, expired = false, closed = false) => {
+ const title = Utils.truncate(
+ player.queue.getCurrent()?.title?.replace(/\(Official.*?\)/gi, '').trim() ?? '',
+ 50
+ );
+ const footerText = closed
+ ? `👋 Lyrics closed • NodeLink • ${totalLines} lines`
+ : expired
+ ? `⌛ Controls expired • NodeLink • ${totalLines} lines`
+ : `NodeLink • ${totalLines} lines total${lyricsResult.synced ? ' • Synced' : ''}`;
+ const desc = [
+ `**${title}**${syncBadge} • Page ${pageIdx + 1}/${totalPages}`,
+ ``,
+ '```',
+ pages[pageIdx],
+ totalPages > 1 && !expired && !closed ? `\n\n💡 ⬅️ ➡️ Navigate • ❌ Close` : '',
+ '```'
+ ].join('\n');
+ return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).setFooter({ text: footerText }).toJSON()] };
+ };
+
+ // Send initial lyrics
+ activeLyricsMsg = await msg.replyEmbed(buildLyricsContent(0));
+
+ // Add pagination and close button if needed
+ if (activeLyricsMsg?.message && totalPages > 1) {
+ const navEmojis = ["⬅️", "➡️", "❌"];
+ for (const emoji of navEmojis) {
+ await activeLyricsMsg.message.react(emoji).catch(() => {});
+ }
+
+ // Reset timer helper
+ const resetLyricsTimer = () => {
+ clearTimeout(lyricsEmojiTimeout);
+ lyricsEmojiTimeout = setTimeout(async () => {
+ await clearLyricsReactions(activeLyricsMsg);
+ await activeLyricsMsg.editEmbed(buildLyricsContent(currentPage, true, false)).catch(() => {});
+ }, EMOJI_REMOVE_TIMEOUT);
+ };
+
+ // Navigation handler
+ lyricsUnobserve = activeLyricsMsg.onReaction(navEmojis, async (e) => {
+ // Close button
+ if (e.emoji_id === "❌") {
+ lyricsUnobserve();
+ clearTimeout(lyricsEmojiTimeout);
+ await clearLyricsReactions(activeLyricsMsg);
+ await activeLyricsMsg.editEmbed(buildLyricsContent(currentPage, false, true)).catch(() => {});
+ return;
+ }
+
+ // Reset timer on navigation
+ resetLyricsTimer();
+
+ if (e.emoji_id === "⬅️") {
+ currentPage = currentPage > 0 ? currentPage - 1 : totalPages - 1;
+ } else if (e.emoji_id === "➡️") {
+ currentPage = currentPage < totalPages - 1 ? currentPage + 1 : 0;
+ }
+
+ await activeLyricsMsg.editEmbed(buildLyricsContent(currentPage));
+ });
+
+ // Start 1 minute timer
+ resetLyricsTimer();
+ } else if (activeLyricsMsg?.message) {
+ // Single page - just add close button
+ await activeLyricsMsg.message.react("❌").catch(() => {});
+
+ const resetLyricsTimer = () => {
+ clearTimeout(lyricsEmojiTimeout);
+ lyricsEmojiTimeout = setTimeout(async () => {
+ await clearLyricsReactions(activeLyricsMsg);
+ await activeLyricsMsg.editEmbed(buildLyricsContent(0, true, false)).catch(() => {});
+ }, EMOJI_REMOVE_TIMEOUT);
+ };
+
+ lyricsUnobserve = activeLyricsMsg.onReaction(["❌"], async (e) => {
+ if (e.emoji_id === "❌") {
+ lyricsUnobserve();
+ clearTimeout(lyricsEmojiTimeout);
+ await clearLyricsReactions(activeLyricsMsg);
+ await activeLyricsMsg.editEmbed(buildLyricsContent(0, false, true)).catch(() => {});
+ }
+ });
+
+ resetLyricsTimer();
+ }
+
+ reply = `Lyrics displayed (${totalLines} lines, ${totalPages} pages)`;
+
+ } catch (err) {
+ // Use Utils.truncate instead of local truncate
+ reply = `⚠️ Lyrics error: ${Utils.truncate(err.message, 50)}`;
+ }
+ shouldUpdate = true;
+ break;
+
+ case "close":
+ await closeSession("user");
+ return;
+ }
+ } catch (err) {
+ reply = `⚠️ Error: ${err.message}`;
+ }
+
+ if (shouldUpdate) refresh({ message: reply });
+ });
+
+ // Start timers
+ resetTimeout();
+ resetEmojiTimer();
+}
diff --git a/commands/playnext.mjs b/commands/playnext.mjs
new file mode 100644
index 0000000..9e7acfd
--- /dev/null
+++ b/commands/playnext.mjs
@@ -0,0 +1,60 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+import { PROVIDER_CHOICES } from "../src/constants/providers.mjs";
+
+function parseInlineProvider(raw) {
+ const match = raw.match(/^([a-z]+):\s*(.+)$/i);
+ if (!match) return { provider: null, query: raw.trim() };
+ const maybeProvider = match[1].toLowerCase();
+ if (PROVIDER_CHOICES.includes(maybeProvider)) {
+ return { provider: maybeProvider, query: match[2].trim() };
+ }
+ return { provider: null, query: raw.trim() };
+}
+
+export const command = new CommandBuilder()
+ .setName("playnext")
+ .setId("playnext")
+ .setDescription("Same as %play but adds the result to the top of the queue.", "commands.playnext")
+ .setCategory("music")
+ .addExamples(
+ "$prefixplaynext blinding lights",
+ "$prefixplaynext sp: blinding lights",
+ "$prefixplaynext -p dz get lucky"
+ )
+ .addTextOption(option =>
+ option.setName("query")
+ .setDescription("A search query, URL, or provider-prefixed query like `sp: song name`.", "options.playnext.query")
+ .setRequired(true)
+ )
+ .addChoiceOption(o =>
+ o.setName("provider")
+ .setDescription("The search provider. Default: YouTube Music.", "options.playnext.provider")
+ .addFlagAliases("p", "u", "use")
+ .addChoices(...PROVIDER_CHOICES)
+ .setDefault("yt")
+ , true)
+ .addAlias("pn");
+
+export async function run(message, data) {
+ const p = await this.getPlayer(message, true, true, true);
+ if (!p) return;
+
+ const rawQuery = data.get("query").value;
+ const flagProvider = data.get("provider")?.value;
+ const { provider: inlineProvider, query } = parseInlineProvider(rawQuery);
+ const provider = inlineProvider ?? flagProvider ?? "ytm";
+
+ const searchEmbed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription("🔍 Searching...")
+ .toJSON();
+ const statusMsg = await message.replyEmbed({ embeds: [searchEmbed] });
+
+ const messages = p.playFirst(query, provider);
+ messages.on("message", d => {
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(d).toJSON();
+ statusMsg.editEmbed({ embeds: [embed] }).catch(() => {});
+ });
+}
diff --git a/commands/radio.mjs b/commands/radio.mjs
new file mode 100644
index 0000000..2e54666
--- /dev/null
+++ b/commands/radio.mjs
@@ -0,0 +1,153 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+const NUMBER_EMOJIS = ["1️⃣","2️⃣","3️⃣","4️⃣","5️⃣","6️⃣","7️⃣","8️⃣","9️⃣"];
+const CANCEL_EMOJI = "❌";
+const PREV_EMOJI = "⬅️";
+const NEXT_EMOJI = "➡️";
+
+function mkEmbed(desc, title) {
+ const b = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc);
+ if (title) b.setTitle(title);
+ return { embeds: [b.toJSON()] };
+}
+
+export const command = function() {
+ if (!this.config.radio?.length) return null;
+ return new CommandBuilder()
+ .setName("radio")
+ .setDescription("Play a radio station. Use `%radio list` to browse all stations.", "commands.radio")
+ .addAliases("r")
+ .setCategory("music")
+ .addTextOption(o =>
+ o.setName("station")
+ .setDescription("Station name, 'list' to browse, or leave blank for default.")
+ .setRequired(false)
+ );
+};
+
+export async function run(msg, data) {
+ const radios = this.config.radio;
+ if (!radios?.length) return msg.replyEmbed(mkEmbed("❌ No radio stations are configured."));
+
+ const input = (data.get("station")?.value ?? "").trim().toLowerCase();
+
+ if (input === "list") {
+ let page = 0;
+ const perPage = NUMBER_EMOJIS.length;
+ const totalPages = Math.ceil(radios.length / perPage);
+
+ const buildPage = () => {
+ const start = page * perPage;
+ const pickable = radios.slice(start, start + perPage);
+
+ let desc = `📻 **Radio Stations (Page ${page + 1}/${totalPages})**\n\n`;
+ pickable.forEach((r, i) => {
+ desc += `${NUMBER_EMOJIS[i]} **${r.detailedName}** (\`${r.name}\`)\n`;
+ desc += ` ${r.description.replaceAll("\n", "\n ")}\n\n`;
+ });
+ desc += `━━━━━━━━━━━━━━━━━━━━━━\n`;
+ desc += `${PREV_EMOJI} Previous ${NEXT_EMOJI} Next ${CANCEL_EMOJI} Cancel`;
+
+ return { payload: mkEmbed(desc), pickable };
+ };
+
+ let { payload, pickable } = buildPage();
+ const listMsg = await msg.replyEmbed(payload);
+ if (!listMsg) return;
+
+ const baseEmojis = [...NUMBER_EMOJIS, PREV_EMOJI, NEXT_EMOJI, CANCEL_EMOJI];
+ for (const e of baseEmojis) await listMsg.message.react(e).catch(() => {});
+
+ let settled = false;
+
+ const clearReactions = async () => {
+ const rawMsg = listMsg.message;
+ try {
+ await rawMsg.removeAllReactions();
+ } catch (_) {
+ for (const emoji of baseEmojis) {
+ try { await rawMsg.removeReaction(emoji); } catch (_) {}
+ }
+ }
+ };
+
+ const timeout = setTimeout(() => {
+ if (settled) return;
+ settled = true;
+ unobserve();
+ clearReactions().catch(() => {});
+ listMsg.editEmbed(mkEmbed("📻 Radio selection timed out.")).catch(() => {});
+ }, 60_000);
+
+ const normalize = (s) => s.replace(/\uFE0F/g, "");
+
+ const unobserve = listMsg.onReaction(baseEmojis, async (e) => {
+ if (settled) return;
+ const emoji = normalize(e.emoji_id);
+
+ if (emoji === normalize(CANCEL_EMOJI)) {
+ settled = true;
+ clearTimeout(timeout);
+ unobserve();
+ await clearReactions();
+ listMsg.editEmbed(mkEmbed("❌ Radio selection cancelled.")).catch(() => {});
+ return;
+ }
+ if (emoji === normalize(NEXT_EMOJI)) page = (page + 1) % totalPages;
+ else if (emoji === normalize(PREV_EMOJI)) page = (page - 1 + totalPages) % totalPages;
+ else {
+ const idx = NUMBER_EMOJIS.findIndex(x => normalize(x) === emoji);
+ if (idx !== -1 && idx < pickable.length) {
+ settled = true;
+ clearTimeout(timeout);
+ unobserve();
+ await clearReactions();
+ const selected = radios[page * perPage + idx];
+ return playStation(this, msg, selected, listMsg);
+ }
+ }
+
+ const next = buildPage();
+ pickable = next.pickable;
+ await listMsg.editEmbed(next.payload).catch(() => {});
+ }, msg.author);
+
+ return;
+ }
+
+ if (input) {
+ const radio = radios.find(r => r.name.toLowerCase() === input);
+ if (!radio) {
+ const names = radios.map(r => `\`${r.name}\``).join(", ");
+ return msg.replyEmbed(mkEmbed(`❌ Unknown station \`${input}\`. Available: ${names}\n\nUse \`%radio list\` to browse.`));
+ }
+ return playStation(this, msg, radio);
+ }
+
+ return playStation(this, msg, radios[0]);
+}
+
+async function playStation(ctx, msg, radio, editTarget = null) {
+ const p = await ctx.getPlayer(msg, true, true, true);
+ if (!p) return;
+
+ const current = p.queue.getCurrent();
+ const hasRadioQueued = p.queue.data.some(t => t.type === "radio");
+ if (current?.type === "radio" || hasRadioQueued) await p.switchRadio(radio);
+ else p.playRadio(radio);
+
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle(`📻 ${radio.detailedName}`)
+ .setDescription(
+ `**[${radio.detailedName}](${radio.author.url})**\n\n` +
+ `${radio.description}\n\n` +
+ `_Use \`%skip\` to stop the radio, or \`%radio list\` to switch stations._`
+ )
+ .toJSON();
+
+ if (editTarget) editTarget.editEmbed({ embeds: [embed] }).catch(() => {});
+ else msg.replyEmbed({ embeds: [embed] }).catch(() => {});
+}
diff --git a/commands/reload.mjs b/commands/reload.mjs
new file mode 100644
index 0000000..b3033ae
--- /dev/null
+++ b/commands/reload.mjs
@@ -0,0 +1,204 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+import fs from "node:fs";
+import path from "node:path";
+import { pathToFileURL } from "node:url";
+
+export const command = new CommandBuilder()
+ .setName("reload")
+ .setDescription("Reload commands, src modules, or audio modules. Leave blank to see all targets.")
+ .setCategory("util")
+ .addStringOption(o =>
+ o.setName("target")
+ .setDescription("Command/module name, or: all | commands | src | audio")
+ .setRequired(false)
+ )
+ .setRequirement(r => r.setOwnerOnly(true));
+
+function embed(desc) {
+ return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] };
+}
+
+const __dirname = path.dirname(new URL(import.meta.url).pathname);
+const ROOT = path.resolve(__dirname, "..");
+
+// ── Reload a single command ───────────────────────────────────────────────────
+async function reloadCommand(ctx, name) {
+ if (name === "index")
+ return { ok: false, msg: "❌ `index.mjs` cannot be hot-reloaded — do a full restart." };
+
+ const command = ctx.handler.commands.find(c => c.name === name);
+ if (!command) return { ok: false, msg: `❌ Unknown command \`${name}\`` };
+
+ const file = ctx.commandFiles.get(command.uid);
+ if (!file) return { ok: false, msg: `❌ No file tracked for \`${name}\`` };
+
+ // Unregister old
+ command.subcommands.forEach(sub => ctx.runnables.delete(sub.uid));
+ ctx.handler.removeCommand(command);
+ ctx.runnables.delete(command.uid);
+ ctx.commandFiles.delete(command.uid);
+
+ // Re-import with cache-buster
+ const url = "file://" + file + "?t=" + Date.now();
+ const cData = await import(url);
+
+ const raw = cData.command ?? cData.default?.command;
+ const builder = typeof raw === "function" ? raw.call(ctx) : raw;
+ if (!builder) return { ok: false, msg: `❌ No builder returned from \`${name}\`` };
+
+ const runFn = cData.run ?? cData.default?.run;
+ const exportDef = cData.exportDef ?? cData.export ?? cData.default?.exportDef ?? cData.default?.export;
+ if (exportDef) ctx[exportDef.name] = exportDef.object;
+
+ ctx.handler.addCommand(builder);
+ ctx.commandFiles.set(builder.uid, file);
+ if (runFn) {
+ ctx.runnables.set(builder.uid, runFn);
+ builder.subcommands.forEach(sub => ctx.runnables.set(sub.uid, runFn));
+ }
+
+ return { ok: true, msg: `✅ \`${name}\`` };
+}
+
+// ── Reload a src/ or audio/ module ───────────────────────────────────────────
+async function reloadModule(ctx, filePath, label) {
+ if (!fs.existsSync(filePath))
+ return { ok: false, msg: `❌ File not found: \`${label}\`` };
+ try {
+ await import(pathToFileURL(filePath).href + "?t=" + Date.now());
+ return { ok: true, msg: `✅ \`${label}\`` };
+ } catch (e) {
+ return { ok: false, msg: `❌ \`${label}\`: ${e.message}` };
+ }
+}
+
+// ── List all module files in a subdirectory ───────────────────────────────────
+function allModuleFiles(subdir) {
+ const dir = path.join(ROOT, subdir);
+ if (!fs.existsSync(dir)) return [];
+ return fs.readdirSync(dir)
+ .filter(f => f.endsWith(".mjs") || f.endsWith(".js"))
+ .map(f => ({ file: path.join(dir, f), label: `${subdir}/${f}` }));
+}
+
+// ── Paginated embed helper ────────────────────────────────────────────────────
+async function showPaged(msg, title, lines, pageSize = 14) {
+ const pages = [];
+ for (let i = 0; i < lines.length; i += pageSize)
+ pages.push(lines.slice(i, i + pageSize));
+
+ if (pages.length === 0) pages.push(["*(nothing)*"]);
+
+ const arrows = ["⬅️", "➡️"];
+ const curr = { n: 0 };
+
+ const mkEmbed = (n) => ({
+ embeds: [
+ new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle(title)
+ .setDescription(pages[n].join("\n") + (pages.length > 1 ? `\n\nPage **${n + 1}** / **${pages.length}**` : ""))
+ .toJSON()
+ ]
+ });
+
+ const m = await msg.replyEmbed(mkEmbed(0));
+ if (!m || pages.length <= 1) return;
+
+ m.message.react(arrows[0]).catch(() => {});
+ m.message.react(arrows[1]).catch(() => {});
+
+ const unsub = m.onReaction(arrows, (e) => {
+ if (e.emoji_id === arrows[0]) curr.n = Math.max(0, curr.n - 1);
+ else curr.n = Math.min(pages.length - 1, curr.n + 1);
+ m.editEmbed(mkEmbed(curr.n)).catch(() => {});
+ });
+
+ setTimeout(() => { unsub?.(); }, 5 * 60_000);
+}
+
+// ── Batch results → paginated display ────────────────────────────────────────
+async function showResults(msg, results, label) {
+ const ok = results.filter(r => r.ok).length;
+ const bad = results.filter(r => !r.ok).length;
+ const header = `✅ **${ok}** reloaded · ❌ **${bad}** failed`;
+ await showPaged(msg, `🔄 Reload — ${label}`, [header, "", ...results.map(r => r.msg)]);
+}
+
+// ── Main ──────────────────────────────────────────────────────────────────────
+export async function run(msg, data) {
+ const target = (data.get("target")?.value ?? "").trim().toLowerCase();
+
+ // No target — show paginated list of everything reloadable
+ if (!target) {
+ const cmdLines = this.handler.commands.map(c => `📦 \`${c.name}\` *(command)*`);
+ const srcLines = allModuleFiles("src").map(m => `🔧 \`${m.label}\` *(src)*`);
+ const audLines = allModuleFiles("audio").map(m => `🎵 \`${m.label}\` *(audio)*`);
+
+ const lines = [
+ "Run `%reload ` or use a batch keyword:",
+ "`all` · `commands` · `src` · `audio`",
+ "",
+ ...cmdLines,
+ ...srcLines,
+ ...audLines,
+ ];
+
+ return showPaged(msg, "🔄 Reload — Available Targets", lines);
+ }
+
+ // Batch keywords
+ if (target === "commands") {
+ const results = await Promise.all(
+ this.handler.commands.map(c => reloadCommand(this, c.name))
+ );
+ return showResults(msg, results, "Commands");
+ }
+
+ if (target === "src") {
+ const results = await Promise.all(
+ allModuleFiles("src").map(m => reloadModule(this, m.file, m.label))
+ );
+ return showResults(msg, results, "src/");
+ }
+
+ if (target === "audio") {
+ const results = await Promise.all(
+ allModuleFiles("audio").map(m => reloadModule(this, m.file, m.label))
+ );
+ return showResults(msg, results, "audio/");
+ }
+
+ if (target === "all") {
+ const results = await Promise.all([
+ ...this.handler.commands.map(c => reloadCommand(this, c.name)),
+ ...allModuleFiles("src").map(m => reloadModule(this, m.file, m.label)),
+ ...allModuleFiles("audio").map(m => reloadModule(this, m.file, m.label)),
+ ]);
+ return showResults(msg, results, "Everything");
+ }
+
+ // Single command by name
+ if (this.handler.commands.some(c => c.name === target)) {
+ const res = await reloadCommand(this, target);
+ return msg.replyEmbed(embed(res.msg));
+ }
+
+ // Single src/ or audio/ module by filename (with or without extension/subdir)
+ const allMods = [...allModuleFiles("src"), ...allModuleFiles("audio")];
+ const mod = allMods.find(m =>
+ m.label.toLowerCase() === target ||
+ path.basename(m.file).replace(/\.m?js$/, "").toLowerCase() === target
+ );
+
+ if (mod) {
+ const res = await reloadModule(this, mod.file, mod.label);
+ return msg.replyEmbed(embed(res.msg));
+ }
+
+ return msg.replyEmbed(embed(
+ `❌ Unknown target \`${target}\`.\nRun \`%reload\` with no arguments to see all reloadable targets.`
+ ));
+}
diff --git a/commands/remove.mjs b/commands/remove.mjs
new file mode 100644
index 0000000..7c28ff0
--- /dev/null
+++ b/commands/remove.mjs
@@ -0,0 +1,23 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("remove")
+ .setDescription("Remove a specific song from the queue.", "commands.remove")
+ .setCategory("music")
+ .addNumberOption(opt =>
+ opt.setName("index")
+ .setDescription("The position of the song in the queue. You can view the indices with the 'list' command", "options.remove.index")
+ .setRequired(true));
+
+export async function run(message, data) {
+ const p = await this.getPlayer(message, false, false, false);
+ if (!p) return;
+ const res = p.remove(data.options[0].value);
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(res)
+ .toJSON();
+ message.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/resume.mjs b/commands/resume.mjs
new file mode 100644
index 0000000..7b2dfc1
--- /dev/null
+++ b/commands/resume.mjs
@@ -0,0 +1,19 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("resume")
+ .setDescription("Resume the playback in your voice channel", "commands.resume")
+ .setCategory("music");
+
+export async function run(message) {
+ const p = await this.getPlayer(message, false, false, false);
+ if (!p) return;
+ const res = p.resume();
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(res)
+ .toJSON();
+ message.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/search.mjs b/commands/search.mjs
new file mode 100644
index 0000000..96a7b41
--- /dev/null
+++ b/commands/search.mjs
@@ -0,0 +1,168 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { Message, getGlobalColor } from "../src/MessageHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { PROVIDER_CHOICES, PROVIDER_NAMES } from "../src/constants/providers.mjs";
+
+const NUMBER_EMOJIS = ["1️⃣","2️⃣","3️⃣","4️⃣","5️⃣","6️⃣","7️⃣","8️⃣","9️⃣"];
+const CANCEL_EMOJI = "❌";
+// SESSION_MS is now read from config.timers.searchSessionTimeout (fallback: 30s)
+
+function parseInlineProvider(raw) {
+ const match = raw.match(/^([a-z]+):\s*(.+)$/i);
+ if (!match) return { provider: null, query: raw.trim() };
+ const maybeProvider = match[1].toLowerCase();
+ if (PROVIDER_CHOICES.includes(maybeProvider))
+ return { provider: maybeProvider, query: match[2].trim() };
+ return { provider: null, query: raw.trim() };
+}
+
+export const command = new CommandBuilder()
+ .setName("search")
+ .setDescription(
+ "Display search results for a query and pick one to play.\n" +
+ "Supports all providers — use inline prefix e.g. `sp: song` or `-p dz`.",
+ "commands.search"
+ )
+ .setCategory("music")
+ .addExamples(
+ "$prefixsearch never gonna give you up",
+ "$prefixsearch sp: blinding lights",
+ "$prefixsearch -p dz get lucky"
+ )
+ .addChoiceOption(o =>
+ o.setName("provider")
+ .setDescription("The search provider. Default: YouTube Music.", "options.search.provider")
+ .addChoices(...PROVIDER_CHOICES)
+ .setDefault("ytm")
+ .addFlagAliases("p", "u", "use")
+ , true)
+ .addTextOption(o =>
+ o.setName("query")
+ .setDescription("The query to search for, or a provider-prefixed query like `sp: song name`.", "options.search.query")
+ .setRequired(true)
+ );
+
+export async function run(msg, data) {
+ const p = await this.getPlayer(msg, true, true, true);
+ if (!p) return;
+
+ const rawQuery = data.get("query").value;
+ const flagProvider = data.get("provider")?.value;
+ const { provider: inlineProvider, query } = parseInlineProvider(rawQuery);
+ const provider = inlineProvider ?? flagProvider ?? "ytm";
+
+ const name = PROVIDER_NAMES[provider] ?? "YouTube Music";
+
+ // Send loading embed
+ const channel = msg.channel?.channel ?? msg.message?.channel;
+ if (!channel?.send) return;
+
+ /**
+ * Build a search-result embed using EmbedBuilder.
+ * @param {string} description
+ * @param {string} [footerText]
+ * @param {string} [authorLabel] - defaults to `name` (provider name)
+ */
+ const makeEmbed = (description, footerText, authorLabel = name) => {
+ const b = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setAuthor({ name: authorLabel })
+ .setDescription(description);
+ if (footerText) b.setFooter({ text: footerText });
+ return b.toJSON();
+ };
+
+ const nativeMsg = msg.message ?? msg;
+ const rawMsg = await nativeMsg.reply(
+ { embeds: [makeEmbed("⏳ Loading results...", null, `Searching ${name}...`)] },
+ { ping: false }
+ ).catch(() => null);
+ if (!rawMsg) return;
+
+ // Fetch results
+ const res = await p.fetchResults(query, msg.authorId, provider);
+ if (!res?.count) {
+ rawMsg.edit({ embeds: [makeEmbed("❌ No results found.")] }).catch(() => {});
+ return;
+ }
+
+ // Build results embed
+ const results = p.searches.get(msg.authorId) ?? [];
+ const reactions = NUMBER_EMOJIS.slice(0, res.count);
+
+ let desc = "";
+ results.forEach((v, i) => {
+ const dur = v.duration ? p.getDuration(v.duration) : "?:??";
+ const title = v.title || "Unknown";
+ const url = v.url || "";
+ desc += `${NUMBER_EMOJIS[i]} [${title}](${url}) — \`${dur}\`\n`;
+ });
+ desc += `\n${CANCEL_EMOJI} Cancel`;
+
+ await rawMsg.edit({
+ embeds: [makeEmbed(
+ desc,
+ "React with a number to add to queue • ❌ to cancel • 30s timeout",
+ `${name} — Search Results`
+ )]
+ }).catch(() => {});
+
+ // Add reactions
+ for (const emoji of [...reactions, CANCEL_EMOJI]) {
+ await rawMsg.react(emoji).catch(() => {});
+ }
+
+ const allReactions = [...reactions, CANCEL_EMOJI];
+ const client = this.client;
+ const channelId = rawMsg.channelId ?? rawMsg.channel_id ?? rawMsg.channel?.id;
+ const msgId = rawMsg.id;
+
+ const clearReactions = async () => {
+ try {
+ await rawMsg.removeAllReactions();
+ } catch (_) {}
+ };
+
+ const wrapped = new Message(rawMsg, this.messages);
+ const authorId = msg.message?.author?.id ?? msg.authorId;
+
+ const unobserve = wrapped.onReaction(allReactions, async (e, reactionMsg) => {
+ // Only react to the command author
+ if (e.user_id && e.user_id !== authorId) return;
+
+ clearTimeout(timer);
+ unobserve();
+ await clearReactions();
+
+ if (e.emoji_id === CANCEL_EMOJI) {
+ rawMsg.edit({
+ embeds: [makeEmbed("❌ Cancelled.", null, `${name} — Search Results`)]
+ }).catch(() => {});
+ return;
+ }
+
+ const idx = reactions.indexOf(e.emoji_id);
+ if (idx === -1) return;
+
+ const v = p.playResult(msg.authorId, idx);
+ if (!v) return;
+
+ rawMsg.edit({
+ embeds: [makeEmbed(
+ `✅ Added [${v.title}](${v.url}) to the queue!`,
+ null,
+ `${name} — Search Results`
+ )]
+ }).catch(() => {});
+ });
+
+ // Read session timeout from config (fallback 30 s)
+ const SESSION_MS = this.config?.timers?.searchSessionTimeout ?? 30_000;
+ const timer = setTimeout(() => {
+ unobserve();
+ clearReactions().catch(() => {});
+ rawMsg.edit({
+ embeds: [makeEmbed("⏰ Search timed out.", "Session closed", `${name} — Search Results`)]
+ }).catch(() => {});
+ }, SESSION_MS); // configurable via config.timers.searchSessionTimeout
+}
diff --git a/commands/servers.mjs b/commands/servers.mjs
new file mode 100644
index 0000000..aa25115
--- /dev/null
+++ b/commands/servers.mjs
@@ -0,0 +1,115 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("servers")
+ .setDescription("Fetch a list of servers the bot is in")
+ .setRequirement(r => r.setOwnerOnly(true))
+ .setCategory("util");
+
+// Auto-remove timer: 1 minute
+const EMOJI_REMOVE_TIMEOUT = 60000;
+
+export async function run(msg) {
+ const guilds = [...this.client.guilds.cache.values()];
+
+ // Fallback if the bot is in 0 servers
+ if (guilds.length === 0) {
+ const emptyEmbed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle("🌐 Servers (0)")
+ .setDescription("_No servers found._")
+ .toJSON();
+ return msg.replyEmbed({ embeds: [emptyEmbed] });
+ }
+
+ const itemsPerPage = 50;
+ const totalPages = Math.ceil(guilds.length / itemsPerPage);
+ const pages = [];
+
+ // Build the content for each page
+ for (let i = 0; i < guilds.length; i += itemsPerPage) {
+ const chunk = guilds.slice(i, i + itemsPerPage);
+ const list = chunk.map((g, index) => `${i + index + 1}. **${g.name}** (\`${g.id}\`)`).join("\n");
+ pages.push(list);
+ }
+
+ let currentPage = 0;
+
+ // Helper function to generate the embed for a specific page
+ const buildPageContent = (pageIdx, expired = false) => {
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle(`🌐 Servers (${guilds.length}) - Page ${pageIdx + 1}/${totalPages}`)
+ .setDescription(pages[pageIdx])
+ .setFooter({
+ text: expired
+ ? "⌛ Controls expired"
+ : totalPages > 1
+ ? "💡 ⬅️ ➡️ Navigate"
+ : "List complete"
+ })
+ .toJSON();
+
+ return { embeds: [embed] };
+ };
+
+ // Send the initial message using the framework's wrapper
+ const replyMsg = await msg.replyEmbed(buildPageContent(0));
+
+ // Safety check and single-page exit
+ if (!replyMsg?.message) return;
+ if (totalPages <= 1) return;
+
+ const navEmojis = ["⬅️", "➡️"];
+ let unobserve = null;
+ let emojiTimeout = null;
+
+ // Add reactions
+ for (const emoji of navEmojis) {
+ await replyMsg.message.react(emoji).catch(() => {});
+ }
+
+ // Helper: Clear all reactions (matches player.mjs fallback logic)
+ const clearReactions = async () => {
+ try {
+ await replyMsg.message.removeAllReactions();
+ } catch (e) {
+ for (const emoji of navEmojis) {
+ try {
+ await replyMsg.message.removeReaction(emoji);
+ } catch (_) {}
+ }
+ }
+ };
+
+ // Helper: Reset the expiration timer
+ const resetTimer = () => {
+ clearTimeout(emojiTimeout);
+ emojiTimeout = setTimeout(async () => {
+ if (unobserve) unobserve();
+ await clearReactions();
+ await replyMsg.editEmbed(buildPageContent(currentPage, true)).catch(() => {});
+ }, EMOJI_REMOVE_TIMEOUT);
+ };
+
+ // Start listening for reactions using the framework's native listener
+ unobserve = replyMsg.onReaction(navEmojis, async (e) => {
+ resetTimer(); // Reset the 1-minute timer when interacting
+
+ if (e.emoji_id === "⬅️") {
+ // Go backward (loops to the end if on the first page)
+ currentPage = currentPage > 0 ? currentPage - 1 : totalPages - 1;
+ } else if (e.emoji_id === "➡️") {
+ // Go forward (loops to the beginning if on the last page)
+ currentPage = currentPage < totalPages - 1 ? currentPage + 1 : 0;
+ }
+
+ // Update the embed using the framework's native edit method
+ await replyMsg.editEmbed(buildPageContent(currentPage)).catch(() => {});
+ });
+
+ // Start the initial countdown
+ resetTimer();
+}
\ No newline at end of file
diff --git a/commands/settings.mjs b/commands/settings.mjs
new file mode 100644
index 0000000..0960976
--- /dev/null
+++ b/commands/settings.mjs
@@ -0,0 +1,511 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+import runnables from "../settings/runnables.mjs";
+
+function embed(desc, opts = {}) {
+ const b = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc);
+ if (opts.title) b.setTitle(opts.title);
+ if (opts.iconURL) b.setAuthor({ name: opts.title || "\u200b", iconURL: opts.iconURL });
+ return { embeds: [b.toJSON()] };
+}
+
+// ── Constants ─────────────────────────────────────────────────────────────────
+
+const SHORTCUTS = {
+ prefix: "prefix",
+ pfx: "prefix",
+ "247": "stay_247",
+};
+
+/** Aliases accepted for boolean settings */
+const BOOL_TRUE = new Set(["true", "1", "yes", "on", "enable", "enabled"]);
+const BOOL_FALSE = new Set(["false", "0", "no", "off", "disable", "disabled"]);
+
+/** Settings whose values should be displayed as booleans */
+const BOOL_SETTINGS = new Set(["songAnnouncements"]);
+
+/** Valid locale codes */
+const VALID_LOCALES = new Set(["en", "ar-SA", "ckb", "de-DE", "pt-BR"]);
+
+/** Volume constraints */
+const VOLUME_MIN = 1;
+const VOLUME_MAX = 200;
+
+// ── Helpers ───────────────────────────────────────────────────────────────────
+
+/** Extract clean numeric channel ID from any format */
+function cleanId(raw) {
+ return String(raw).replace(/\D/g, "");
+}
+
+/** Parse "true/false" and their aliases → boolean | null */
+function parseBool(str) {
+ const s = String(str).toLowerCase().trim();
+ if (BOOL_TRUE.has(s)) return true;
+ if (BOOL_FALSE.has(s)) return false;
+ return null;
+}
+
+/** Format a setting value for display */
+function displayValue(key, value) {
+ if (BOOL_SETTINGS.has(key)) return value ? "✅ enabled" : "❌ disabled";
+ if (value === null || value === undefined || value === "none") return "none";
+ return `\`${value}\``;
+}
+
+/** Resolve guild ID from a message context */
+function getGuildId(message) {
+ return message.message?.guild?.id ?? message.channel?.guild?.id ?? null;
+}
+
+/** Resolve guild name from a message context */
+function getGuildName(message) {
+ return message.message?.guild?.name ?? message.channel?.guild?.name ?? "this server";
+}
+
+// ── 24/7 helpers ──────────────────────────────────────────────────────────────
+
+function get247Channels(set) {
+ const raw = set.get("stay_247");
+ if (!raw || raw === "none") return new Set();
+ if (typeof raw === "string") {
+ const id = cleanId(raw);
+ return id ? new Set([id]) : new Set();
+ }
+ if (Array.isArray(raw)) {
+ return new Set(raw.map(id => cleanId(id)).filter(Boolean));
+ }
+ return new Set();
+}
+
+function save247Channels(set, channels) {
+ const arr = [...channels];
+ set.set("stay_247", arr.length > 0 ? arr : "none");
+}
+
+function format247Status(set) {
+ const channels = get247Channels(set);
+ const mode = set.get("stay_247_mode") ?? "off";
+ if (channels.size === 0) return "❌ disabled";
+ const channelList = [...channels].map(id => `<#${id}>`).join(", ");
+ const modeLabel = mode === "auto" ? "🔄 auto" : mode === "on" ? "✅ on" : "❌ off";
+ return `${modeLabel} — ${channelList}`;
+}
+
+async function handle247(ctx, message, value) {
+ const set = ctx.getSettings(message);
+ const guildId = getGuildId(message);
+ const mode = value.toLowerCase().trim();
+
+ // Normalise legacy true/false
+ const resolved = mode === "true" ? "auto" : mode === "false" ? "off" : mode;
+
+ if (!["off", "on", "auto"].includes(resolved)) {
+ return message.replyEmbed(embed(
+ `❌ Invalid value \`${value}\` for 24/7 mode.\n\n` +
+ `**Valid options:**\n` +
+ `• \`off\` — bot leaves after inactivity\n` +
+ `• \`on\` — bot stays, but won't rejoin after restart or force-kick\n` +
+ `• \`auto\` — bot stays and always rejoins after restart or force-kick`
+ ));
+ }
+
+ // ── OFF ───────────────────────────────────────────────────────────────────
+ if (resolved === "off") {
+ if (!guildId) return message.replyEmbed(embed("❌ Could not detect your server."));
+
+ const channelId = ctx.players.checkVoiceChannels(message);
+ const channels = get247Channels(set);
+
+ if (channelId) {
+ const id = cleanId(channelId);
+ channels.delete(id);
+ save247Channels(set, channels);
+ ctx.markIntentionalLeave?.(id);
+ const player = ctx.players.playerMap.get(id);
+ if (player) {
+ ctx.players.playerMap.delete(id);
+ await player.leave().catch(() => {});
+ player.destroy();
+ }
+ if (channels.size === 0) set.set("stay_247_mode", "off");
+ return message.replyEmbed(embed(`✅ 24/7 mode **disabled** for <#${id}>. Bot has left.`));
+ }
+
+ // Not in a channel — disable all for this guild
+ save247Channels(set, new Set());
+ set.set("stay_247_mode", "off");
+ for (const [chId, player] of [...ctx.players.playerMap.entries()]) {
+ const ch = ctx.handler.client.channels.cache.get(chId);
+ if (ch?.guild?.id === guildId || ch?.guildId === guildId) {
+ ctx.markIntentionalLeave?.(chId);
+ ctx.players.playerMap.delete(chId);
+ await player.leave().catch(() => {});
+ player.destroy();
+ }
+ }
+ return message.replyEmbed(embed("✅ 24/7 mode **disabled** for all channels in this server."));
+ }
+
+ // ── ON / AUTO ─────────────────────────────────────────────────────────────
+ if (!guildId) return message.replyEmbed(embed("❌ Could not detect your server."));
+
+ const channelId = ctx.players.checkVoiceChannels(message);
+ if (!channelId) {
+ return message.replyEmbed(embed(
+ `❌ You're not in a voice channel. Join one first, then run \`%247 ${resolved}\` again.`
+ ));
+ }
+
+ const id = cleanId(channelId);
+ const channels = get247Channels(set);
+ channels.add(id);
+ save247Channels(set, channels);
+ set.set("stay_247_mode", resolved);
+
+ const modeLabel = resolved === "auto"
+ ? "**auto** (stays and rejoins automatically)"
+ : "**on** (stays but won't rejoin if kicked)";
+
+ if (ctx.players.playerMap.has(id)) {
+ return message.replyEmbed(embed(`✅ 24/7 mode set to ${modeLabel} for <#${id}>.`));
+ }
+
+ try {
+ await ctx._spawnPlayer(guildId, id);
+ return message.replyEmbed(embed(`✅ 24/7 mode set to ${modeLabel} for <#${id}>. Bot joined!`));
+ } catch (e) {
+ return message.replyEmbed(embed(`✅ 24/7 mode saved, but failed to join: ${e.message}`));
+ }
+}
+
+// ── Per-setting validation & apply ───────────────────────────────────────────
+
+/**
+ * Validate and save a setting value.
+ * @returns {string|null} Error message string, or null on success.
+ * For stay_247, replies directly and always returns null.
+ */
+async function applySet(ctx, message, set, key, rawValue) {
+ // Boolean settings
+ if (BOOL_SETTINGS.has(key)) {
+ const bool = parseBool(rawValue);
+ if (bool === null) {
+ return (
+ `❌ \`${key}\` must be a boolean.\n` +
+ `Accepted: \`true\`, \`false\`, \`on\`, \`off\`, \`enable\`, \`disable\``
+ );
+ }
+ set.set(key, bool);
+ return null;
+ }
+
+ // 24/7 mode — replies on its own
+ if (key === "stay_247") {
+ await handle247(ctx, message, rawValue);
+ return null;
+ }
+
+ // Volume
+ if (key === "volume") {
+ const num = parseInt(rawValue, 10);
+ if (isNaN(num) || num < VOLUME_MIN || num > VOLUME_MAX) {
+ return `❌ Volume must be a number between **${VOLUME_MIN}** and **${VOLUME_MAX}**.`;
+ }
+ set.set(key, num);
+ return null;
+ }
+
+ // Locale
+ if (key === "locale") {
+ if (!VALID_LOCALES.has(rawValue)) {
+ return (
+ `❌ \`${rawValue}\` is not a supported locale.\n` +
+ `Available locales: ${[...VALID_LOCALES].map(l => `\`${l}\``).join(", ")}`
+ );
+ }
+ set.set(key, rawValue);
+ return null;
+ }
+
+ // Prefix
+ if (key === "prefix") {
+ if (!rawValue || rawValue.length > 5) {
+ return `❌ Prefix must be between **1** and **5** characters.`;
+ }
+ if (/\s/.test(rawValue)) {
+ return `❌ Prefix cannot contain spaces.`;
+ }
+ }
+
+ // General: run the runnable hook if present
+ if (runnables[key]) {
+ const err = runnables[key].call(ctx, rawValue, { msg: message });
+ if (err) return `❌ ${err}`;
+ }
+
+ set.set(key, rawValue);
+ return null;
+}
+
+// ── Shortcut handler (%prefix, %pfx, %247) ───────────────────────────────────
+
+async function handleShortcut(ctx, message, settingKey, valueTokens) {
+ const set = ctx.getSettings(message);
+
+ // GET (no value provided)
+ if (valueTokens.length === 0) {
+ if (settingKey === "stay_247") {
+ return message.replyEmbed(embed(`24/7 mode: ${format247Status(set)}`));
+ }
+ const val = set.get(settingKey);
+ return message.replyEmbed(embed(`\`${settingKey}\` → ${displayValue(settingKey, val)}`));
+ }
+
+ // SET
+ const rawValue = valueTokens.join(" ");
+ const err = await applySet(ctx, message, set, settingKey, rawValue);
+ if (err) return message.replyEmbed(embed(err));
+
+ // handle247 replies on its own
+ if (settingKey !== "stay_247") {
+ const val = set.get(settingKey);
+ return message.replyEmbed(embed(`✅ \`${settingKey}\` set to ${displayValue(settingKey, val)}`));
+ }
+}
+
+// ── Command definition ────────────────────────────────────────────────────────
+
+export const command = function() {
+ if (this.loader) {
+ for (const [alias, settingKey] of Object.entries(SHORTCUTS)) {
+ const builder = new CommandBuilder()
+ .setName(alias)
+ .setDescription(`Shortcut for \`${settingKey}\`. Usage: %${alias} [value]`)
+ .setId(`shortcut_${alias}`)
+ .setCategory("util")
+ .setRequirement(e => e.addPermission("ManageGuild"))
+ .addTextOption(o =>
+ o.setName("value")
+ .setDescription(`New value for ${settingKey}`)
+ .setRequired(false)
+ );
+ this.loader.commands.addCommand(builder);
+ this.loader.runnables.set(builder.uid, run);
+ }
+ }
+
+ const settingKeys = Object.keys(this.settingsMgr.defaults);
+
+ return new CommandBuilder()
+ .setName("settings")
+ .setDescription("Change/Get settings in the current server.", "commands.settings")
+ .addExamples(
+ "$prefixsettings get",
+ "$prefixsettings get prefix",
+ "$prefixsettings set prefix !",
+ "$prefixsettings set locale de-DE",
+ "$prefixsettings set songAnnouncements off",
+ "$prefixsettings set stay_247 auto",
+ "$prefixsettings set volume 80",
+ "$prefixsettings reset prefix",
+ "$prefixsettings help"
+ )
+ .setCategory("util")
+ .setRequirement(e => e.addPermission("ManageGuild"))
+
+ .addSubcommand(cmd =>
+ cmd.setName("set")
+ .setId("setSettings")
+ .setDescription("Set the value of a specific setting.", "subcommands.settings.set")
+ .addChoiceOption(c =>
+ c.addChoices(...settingKeys)
+ .setName("setting")
+ .setDescription("Which setting to change.", "options.settings.set.setting")
+ .setRequired(true)
+ )
+ .addTextOption(c =>
+ c.setName("value")
+ .setDescription("The new value.", "options.settings.set.value")
+ .setRequired(true)
+ )
+ )
+
+ .addSubcommand(cmd =>
+ cmd.setName("get")
+ .setDescription("Get a setting's value, or list all settings.", "subcommands.settings.get")
+ .setId("getSettings")
+ .addChoiceOption(c =>
+ c.addChoices(...settingKeys)
+ .setName("setting")
+ .setDescription("Omit to list all settings.", "options.settings.get.setting")
+ .setRequired(false)
+ )
+ )
+
+ .addSubcommand(cmd =>
+ cmd.setName("reset")
+ .setDescription("Reset a setting to its default value.", "subcommands.settings.reset")
+ .setId("resetSettings")
+ .addChoiceOption(c =>
+ c.addChoices(...settingKeys)
+ .setName("setting")
+ .setDescription("Which setting to reset.", "options.settings.reset.setting")
+ .setRequired(true)
+ )
+ )
+
+ .addSubcommand(cmd =>
+ cmd.setName("help")
+ .setDescription("Show help for the settings system, or explain a specific setting.", "subcommands.settings.help")
+ .setId("helpSettings")
+ .addChoiceOption(c =>
+ c.addChoices(...settingKeys)
+ .setName("setting")
+ .setDescription("Omit to see all available settings.", "options.settings.help.setting")
+ .setRequired(false)
+ )
+ );
+};
+
+// ── Command runner ────────────────────────────────────────────────────────────
+
+export async function run(message, data) {
+ const set = this.getSettings(message);
+ const cmd = data.commandId;
+
+ // ── Shortcut commands (%prefix, %pfx, %247) ───────────────────────────────
+ if (cmd?.startsWith("shortcut_")) {
+ const alias = cmd.replace("shortcut_", "");
+ const settingKey = SHORTCUTS[alias];
+ const raw = (message.content ?? message.message?.content ?? "").trim();
+ const prefix = set.get("prefix") ?? "%";
+ const body = raw.startsWith(prefix) ? raw.slice(prefix.length).trim() : raw;
+ const tokens = body.split(/\s+/).slice(1);
+ return handleShortcut(this, message, settingKey, tokens);
+ }
+
+ // ── Inline shortcut: %settings [value] ────────────────────────────
+ const raw = (message.content ?? message.message?.content ?? "").trim();
+ const prefix = set.get("prefix") ?? "%";
+ const body = raw.startsWith(prefix) ? raw.slice(prefix.length).trim() : raw;
+ const args = body.split(/\s+/);
+ const inlineShortcut = SHORTCUTS[args[1]?.toLowerCase()];
+ if (inlineShortcut) {
+ return handleShortcut(this, message, inlineShortcut, args.slice(2));
+ }
+
+ const settingKey = data.get("setting")?.value;
+
+ // ── set ───────────────────────────────────────────────────────────────────
+ if (cmd === "setSettings") {
+ const rawValue = data.get("value")?.value;
+
+ if (!this.settingsMgr.isOption(settingKey)) {
+ const available = Object.keys(this.settingsMgr.defaults).join("`, `");
+ return message.replyEmbed(embed(
+ `❌ Unknown setting \`${settingKey}\`.\nAvailable: \`${available}\``
+ ));
+ }
+
+ const err = await applySet(this, message, set, settingKey, rawValue);
+ if (err) return message.replyEmbed(embed(err));
+
+ if (settingKey === "stay_247") return; // handle247 replied already
+
+ const newVal = set.get(settingKey);
+ return message.replyEmbed(embed(`✅ \`${settingKey}\` set to ${displayValue(settingKey, newVal)}`));
+ }
+
+ // ── get ───────────────────────────────────────────────────────────────────
+ if (cmd === "getSettings") {
+ if (settingKey) {
+ if (settingKey === "stay_247") {
+ return message.replyEmbed(embed(`24/7 mode: ${format247Status(set)}`));
+ }
+ const val = set.get(settingKey);
+ const description = this.settingsMgr.descriptions?.[settingKey];
+ let reply = `**${settingKey}** → ${displayValue(settingKey, val)}`;
+ if (description) reply += `\n\n*${description}*`;
+ return message.replyEmbed(embed(reply));
+ }
+
+ // List all settings
+ const d = set.getAll();
+ const guildName = getGuildName(message);
+ const iconUrl = message.message?.guild?.iconURL?.() ?? null;
+
+ const lines = Object.entries(d)
+ .filter(([k]) => k !== "stay_247_mode") // surfaced inline with stay_247
+ .map(([k]) => {
+ if (k === "stay_247") {
+ return `• **stay_247** — ${format247Status(set)}`;
+ }
+ return `• **${k}** — ${displayValue(k, d[k])}`;
+ });
+
+ return message.replyEmbed(embed(
+ `Settings for **${guildName}**\n\n${lines.join("\n")}\n\n` +
+ `Use \`${prefix}settings help \` to learn about any setting.`,
+ { title: "⚙️ Server Settings", iconURL: iconUrl }
+ ));
+ }
+
+ // ── reset ─────────────────────────────────────────────────────────────────
+ if (cmd === "resetSettings") {
+ if (!this.settingsMgr.isOption(settingKey)) {
+ return message.replyEmbed(embed(`❌ Unknown setting \`${settingKey}\`.`));
+ }
+ set.reset(settingKey);
+ const def = set.get(settingKey);
+ return message.replyEmbed(embed(
+ `🔄 \`${settingKey}\` has been reset to its default: ${displayValue(settingKey, def)}`
+ ));
+ }
+
+ // ── help ──────────────────────────────────────────────────────────────────
+ if (cmd === "helpSettings") {
+ const pfx = set.get("prefix") ?? "%";
+
+ if (!settingKey) {
+ const keys = Object.keys(this.settingsMgr.defaults);
+ const keyList = keys.map(k => `\`${k}\``).join(", ");
+ return message.replyEmbed(embed(
+ `**⚙️ Settings Help**\n\n` +
+ `**Available settings:** ${keyList}\n\n` +
+ `**Subcommands:**\n` +
+ `• \`${pfx}settings get\` — list all current values\n` +
+ `• \`${pfx}settings get \` — view a single setting\n` +
+ `• \`${pfx}settings set \` — change a setting\n` +
+ `• \`${pfx}settings reset \` — restore default value\n` +
+ `• \`${pfx}settings help \` — describe a setting\n\n` +
+ `**Shortcuts:** \`${pfx}prefix\`, \`${pfx}247\``,
+ { title: "⚙️ Settings Help" }
+ ));
+ }
+
+ const description = this.settingsMgr.descriptions?.[settingKey] ?? "No description available.";
+ const currentVal = set.get(settingKey);
+ const defaultVal = this.settingsMgr.defaults?.[settingKey];
+
+ let extra = "";
+ if (settingKey === "locale") {
+ extra = `\n**Valid values:** ${[...VALID_LOCALES].map(l => `\`${l}\``).join(", ")}`;
+ } else if (settingKey === "volume") {
+ extra = `\n**Valid range:** ${VOLUME_MIN}–${VOLUME_MAX}`;
+ } else if (BOOL_SETTINGS.has(settingKey)) {
+ extra = `\n**Valid values:** \`true\`, \`false\`, \`on\`, \`off\``;
+ } else if (settingKey === "stay_247") {
+ extra = `\n**Valid values:** \`off\`, \`on\`, \`auto\``;
+ }
+
+ return message.replyEmbed(embed(
+ `**⚙️ Setting: \`${settingKey}\`**\n\n` +
+ `${description}${extra}\n\n` +
+ `**Current value:** ${displayValue(settingKey, currentVal)}\n` +
+ `**Default:** ${displayValue(settingKey, defaultVal)}`,
+ { title: `⚙️ ${settingKey}` }
+ ));
+ }
+}
diff --git a/commands/shuffle.mjs b/commands/shuffle.mjs
new file mode 100644
index 0000000..1de6114
--- /dev/null
+++ b/commands/shuffle.mjs
@@ -0,0 +1,19 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("shuffle")
+ .setDescription("Re-orders the queue randomly.", "commands.shuffle")
+ .setCategory("music");
+
+export async function run(message) {
+ const p = await this.getPlayer(message, false, false, false);
+ if (!p) return;
+ const res = p.shuffle();
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(res)
+ .toJSON();
+ message.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/skip.mjs b/commands/skip.mjs
new file mode 100644
index 0000000..f021e64
--- /dev/null
+++ b/commands/skip.mjs
@@ -0,0 +1,34 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("skip")
+ .setDescription("Skip the current playing song.", "commands.skip")
+ .addAliases("s")
+ .setCategory("music");
+
+export async function run(message) {
+ const p = await this.getPlayer(message);
+ if (!p) return;
+
+ const current = p.queue.getCurrent();
+ const skippedTitle = current?.title ?? null;
+ const skippedLink = current ? (current.spotifyUrl || current.url || "") : "";
+
+ const err = p.skip();
+ if (err && err.includes("nothing playing")) {
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(err).toJSON();
+ return message.replyEmbed({ embeds: [embed] });
+ }
+
+ const desc = skippedTitle
+ ? `⏭️ Skipped [${skippedTitle}](${skippedLink})`
+ : "⏭️ Skipped";
+
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(desc)
+ .toJSON();
+ message.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/stats.mjs b/commands/stats.mjs
new file mode 100644
index 0000000..a15a587
--- /dev/null
+++ b/commands/stats.mjs
@@ -0,0 +1,90 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { Utils } from "../src/Utils.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("stats")
+ .setDescription("Display stats about the bot like the uptime.", "commands.stats")
+ .addAliases("info")
+ .setCategory("util");
+
+// ── User count ────────────────────────────────────────────────────────────────
+
+async function fetchUserCount(client) {
+ const guildIds = Array.from(client.guilds.cache.keys());
+ if (guildIds.length === 0) return 0;
+ try {
+ const counts = await Promise.all(guildIds.map(async (id) => {
+ let total = 0, after = "0", done = false;
+ try {
+ while (!done) {
+ const batch = await client.rest?.get(`/guilds/${id}/members?limit=1000&after=${after}`);
+ if (!batch?.length) { done = true; }
+ else {
+ total += batch.length;
+ done = batch.length < 1000;
+ if (!done) after = batch[batch.length - 1].user.id;
+ }
+ }
+ return total;
+ } catch { return 0; }
+ }));
+ return counts.reduce((a, b) => a + b, 0);
+ } catch { return 0; }
+}
+
+// ── Embed builder ─────────────────────────────────────────────────────────────
+
+function buildEmbed({ guildCount, userCount, playerCount, ping, uptime, comHash, comLink, reason, footer, loading }) {
+ const num = (v) => Number(v).toLocaleString();
+ const ld = (v) => loading ? "..." : v;
+
+ const description = [
+ `📂 **Servers** — \`${num(guildCount)}\``,
+ `👥 **Users** — \`${ld(num(userCount))}\``,
+ `🎧 **Players** — \`${num(playerCount)}\``,
+ `🏓 **Ping** — \`${ld(`${ping}ms`)}\``,
+ `⏱️ **Uptime** — \`${uptime}\``,
+ `🔧 **Build** — [\`${comHash}\`](${comLink})`,
+ reason ? `🪛 **Last restart** — \`${reason}\`` : null,
+ ``,
+ `☕ [Support us on Ko-fi](https://ko-fi.com/remixbot)`,
+ `💬 [Community](https://fluxer.gg/Remix)`,
+ ].filter(l => l !== null).join("\n");
+
+ return new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setAuthor({ name: "Remix Music Bot" })
+ .setDescription(description)
+ .setFooter({ text: footer || "Remix Music Bot" })
+ .setTimestamp()
+ .toJSON();
+}
+
+// ── Runner ────────────────────────────────────────────────────────────────────
+
+export async function run(message) {
+ const shared = {
+ guildCount: this.client.guilds.cache.size,
+ playerCount: this.players.playerMap.size,
+ uptime: Utils.prettifyMS(Math.round(process.uptime()) * 1000),
+ comHash: this.comHash,
+ comLink: this.comLink,
+ reason: this.config.restart ?? null,
+ footer: this.config.customStatsFooter || null,
+ };
+
+ const start = Date.now();
+
+ const msg = await message.replyEmbed({
+ embeds: [buildEmbed({ ...shared, userCount: 0, ping: 0, loading: true })]
+ });
+
+ const ping = Date.now() - start;
+ const users = await fetchUserCount(this.client);
+
+ await msg.editEmbed({
+ embeds: [buildEmbed({ ...shared, userCount: users, ping, loading: false })]
+ }).catch(() => {});
+}
diff --git a/commands/support.mjs b/commands/support.mjs
new file mode 100644
index 0000000..ba0f228
--- /dev/null
+++ b/commands/support.mjs
@@ -0,0 +1,22 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("support")
+ .setDescription("The support server for Remix. Feel free to ask help, report bugs or just chat :)", "commands.support")
+ .addAliases("server")
+ .setCategory("util");
+
+export function run(msg) {
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle("💬 Support")
+ .setDescription(
+ "For anything regarding Remix, head over to our server:\n" +
+ "[Remix HQ](https://fluxer.gg/remix)\n\n" +
+ "If you don't want to join, feel free to contact the team members listed in the server."
+ )
+ .toJSON();
+ msg.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/test.mjs b/commands/test.mjs
new file mode 100644
index 0000000..203db6e
--- /dev/null
+++ b/commands/test.mjs
@@ -0,0 +1,63 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("test")
+ .setDescription("Shows how many people are in each voice channel.")
+ .setRequirement(r => r.setOwnerOnly(true));
+
+export async function run(msg, data) {
+ const guild = msg.channel?.channel?.guild ?? msg.message?.guild;
+ if (!guild) {
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("❌ Must be used in a server.").toJSON();
+ return msg.replyEmbed({ embeds: [embed] });
+ }
+
+ const channelCounts = new Map();
+
+ for (const [, state] of this.observedVoiceUsers) {
+ if (state.guildId !== guild.id) continue;
+ channelCounts.set(state.channelId, (channelCounts.get(state.channelId) ?? 0) + 1);
+ }
+ for (const [, state] of this.observedVoiceBots) {
+ if (state.guildId !== guild.id) continue;
+ channelCounts.set(state.channelId, (channelCounts.get(state.channelId) ?? 0) + 1);
+ }
+
+ if (channelCounts.size === 0) {
+ const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("No one is in voice.").toJSON();
+ return msg.replyEmbed({ embeds: [embed] });
+ }
+
+ const getChannelName = async (channelId) => {
+ const cached = this.client.channels.cache.get(channelId);
+ if (cached?.name) return cached.name;
+ const guildCached = guild.channels?.cache?.get?.(channelId) ?? guild.channels?.get?.(channelId);
+ if (guildCached?.name) return guildCached.name;
+ if (guild.channels) {
+ const all = typeof guild.channels.values === "function"
+ ? [...guild.channels.values()] : Object.values(guild.channels);
+ const found = all.find(c => (c.id ?? c.channel_id) === channelId);
+ if (found?.name) return found.name;
+ }
+ try {
+ const fetched = await this.client.channels.fetch(channelId);
+ if (fetched?.name) return fetched.name;
+ } catch (_) {}
+ return `Unknown (${channelId})`;
+ };
+
+ let desc = "";
+ for (const [channelId, total] of channelCounts) {
+ const name = await getChannelName(channelId);
+ desc += `🔊 **${name}**: ${total} member${total !== 1 ? "s" : ""}\n`;
+ }
+
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setTitle("🎙️ Voice Channel Members")
+ .setDescription(desc.trim())
+ .toJSON();
+ msg.replyEmbed({ embeds: [embed] });
+}
diff --git a/commands/thumbnail.mjs b/commands/thumbnail.mjs
new file mode 100644
index 0000000..f58e7e7
--- /dev/null
+++ b/commands/thumbnail.mjs
@@ -0,0 +1,22 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+export const command = new CommandBuilder()
+ .setName("thumbnail")
+ .setDescription("Request the thumbnail of the currently playing song.", "commands.thumbnail")
+ .addAliases("thumb")
+ .setCategory("music");
+
+export async function run(msg) {
+ const p = await this.getPlayer(msg);
+ if (!p) return;
+ const data = await p.getThumbnail();
+
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(data.msg);
+ if (data.image) embed.setImage(data.image);
+
+ msg.replyEmbed({ embeds: [embed.toJSON()] });
+}
diff --git a/commands/volume.mjs b/commands/volume.mjs
new file mode 100644
index 0000000..ff97665
--- /dev/null
+++ b/commands/volume.mjs
@@ -0,0 +1,41 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+
+const MAX_VOLUME = 200;
+
+export const command = new CommandBuilder()
+ .setName("volume")
+ .setDescription("Get or change the current volume.", "commands.volume")
+ .setCategory("music")
+ .addNumberOption(o =>
+ o.setName("volume")
+ .setDescription(`New volume in % (0–${MAX_VOLUME}). Omit to see the current volume.`)
+ .setRequired(false)
+ )
+ .addAliases("v", "vol");
+
+export async function run(message, data) {
+ const p = await this.getPlayer(message, false, false, false);
+ if (!p) return;
+
+ const volOption = data.get("volume");
+ const raw = volOption?.value;
+
+ const embed = new EmbedBuilder().setColor(getGlobalColor());
+
+ if (!volOption || raw == null || isNaN(Number(raw))) {
+ const current = Math.round((p.preferredVolume ?? 1) * 100);
+ embed.setDescription(`🔊 Current volume: \`${current}%\``);
+ } else {
+ const pct = Number(raw);
+ if (pct < 0 || pct > MAX_VOLUME) {
+ embed.setDescription(`❌ Volume must be between \`0\` and \`${MAX_VOLUME}%\`.`);
+ } else {
+ p.setVolume(pct / 100);
+ embed.setDescription(`🔊 Volume changed to \`${pct}%\` for this session.`);
+ }
+ }
+
+ message.replyEmbed({ embeds: [embed.toJSON()] });
+}
diff --git a/commands/volumedefault.mjs b/commands/volumedefault.mjs
new file mode 100644
index 0000000..a4593a0
--- /dev/null
+++ b/commands/volumedefault.mjs
@@ -0,0 +1,64 @@
+import { CommandBuilder } from "../src/CommandHandler.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "../src/MessageHandler.mjs";
+import { PermissionFlags } from "@fluxerjs/core";
+
+const MAX_VOLUME = 200;
+
+export const command = new CommandBuilder()
+ .setName("volumedefault")
+ .setDescription("View or set the server default volume. (Requires Manage Server to set)", "commands.volumedefault")
+ .setCategory("music")
+ .addNumberOption(o =>
+ o.setName("volume")
+ .setDescription(`New volume in % (0–${MAX_VOLUME}) to save as server default. Leave empty to view current.`)
+ .setRequired(false)
+ )
+ .addAliases("vd");
+
+export async function run(message, data) {
+ const p = await this.getPlayer(message, false, false, false);
+ if (!p) return;
+
+ const set = this.getSettings(message);
+ const authorId = message.message?.author?.id;
+ const guild = message.message?.guild ?? null;
+ const member = guild?.members?.get(authorId) ?? message.message?.member ?? null;
+ const isOwner = (this.handler?.owners ?? []).includes(authorId);
+
+ const hasManage = isOwner
+ || member?.permissions?.has(PermissionFlags["Administrator"])
+ || member?.permissions?.has(PermissionFlags["ManageGuild"]);
+
+ const volOption = data.get("volume");
+ const raw = volOption?.value;
+
+ const embed = new EmbedBuilder().setColor(getGlobalColor());
+
+ if (!volOption || raw === null || raw === undefined || isNaN(Number(raw))) {
+ const currentDefault = set?.get("volume") ?? 100;
+ const currentPlayerVol = Math.round((p.preferredVolume ?? 1) * 100);
+ embed
+ .setTitle("🔊 Volume Settings")
+ .setDescription(
+ `• Server default: \`${currentDefault}%\`\n` +
+ `• Current player volume: \`${currentPlayerVol}%\`\n\n` +
+ (hasManage
+ ? `To change the default, use: \`${set?.get("prefix") ?? "%"}volumedefault <0-${MAX_VOLUME}>\``
+ : `⚠️ You need **Manage Server** permission to change the default.`)
+ );
+ } else if (!hasManage) {
+ embed.setDescription("❌ You need **Manage Server** permission to set the server default volume.");
+ } else {
+ const pct = Number(raw);
+ if (pct < 0 || pct > MAX_VOLUME) {
+ embed.setDescription(`❌ Volume must be between \`0\` and \`${MAX_VOLUME}%\`.`);
+ } else {
+ p.setVolume(pct / 100);
+ if (set) set.set("volume", pct);
+ embed.setDescription(`🔊 Server default volume saved as \`${pct}%\`.`);
+ }
+ }
+
+ message.replyEmbed({ embeds: [embed.toJSON()] });
+}
diff --git a/config_example.json b/config_example.json
new file mode 100644
index 0000000..77218c0
--- /dev/null
+++ b/config_example.json
@@ -0,0 +1,98 @@
+{
+ "token": "your bot token",
+ "fluxer.js": {
+ "Comment": "Configuration data for @fluxerjs/core Client options. See: https://github.com/fluxerjs/core"
+ },
+ "fluxer-api": {
+ "Comment": "Configuration options for a fluxer REST client if self-hosting. See: https://docs.fluxer.app"
+ },
+ "prefix": "your desired prefix (such as %)",
+ "presenceInterval": null,
+ "presenceContents": [],
+ "spotify": {
+ "clientId": "your spotify client id",
+ "clientSecret": "your spotify client secret"
+ },
+ "nodelink": {
+ "host": "localhost",
+ "port": 3000,
+ "password": "youshallnotpass"
+ },
+ "comment-radio": {
+ "message": "If you have radio stations you'd like to connect, add them to the array below. Radio stations must be rendered like following:",
+ "station": {
+ "name": "zamrock",
+ "detailedName": "ᘔᗩᗰᘔᗩᗰᖴOᖴᒪIᖴE",
+ "thumbnail": "https://zamrock.net/wp-content/uploads/2024/06/Zamrock_rd_logo_0004-1.gif",
+ "url": "url to stream from; this will be kept private",
+ "description": "Genre: Zamrock, provided by [Zamrock.net](https://zamrock.net/)",
+ "author": {
+ "name": "Zamrock",
+ "url": "https://zamrock.net"
+ },
+ "keyWords": ["radio", "zamrock", "psychedelic", "blues", "rock"]
+ }
+ },
+ "radio": [],
+ "cache": {
+ "guilds": {
+ "enabled": true,
+ "max": 5000
+ },
+ "members": {
+ "enabled": true,
+ "max": 10000
+ }
+ },
+ "helpCatalog": true,
+ "helpPagination": true,
+ "mysql": {
+ "host": "your-mysql-host.com",
+ "port": 3306,
+ "user": "youruser",
+ "password": "password of your user",
+ "database": "name of the target database"
+ },
+ "webPort": 80,
+ "dashboardUrl": "The url the dashboard is accessible with.",
+ "ssl": {
+ "private": "path-to-private-key.pem",
+ "cert": "path-to-certificate.pem",
+ "useSSL": false,
+ "httpPort": 80
+ },
+ "sessionSecret": "secret for the expressjs session middleware; https://www.npmjs.com/package/express-session#user-content-secret",
+ "geniusToken": "Genius access token (Used for lyrics); optional",
+ "owners": ["user id for owner-only commands", "another user id"],
+ "playerAFKTimeout": 60000,
+ "Comment": "The above specifies the time in ms after which a player goes inactive; Optional.",
+ "customStatsFooter": "Text shown in the footer of the %stats embed; optional.",
+ "embedColor": "0xe9196c",
+ "logging": {
+ "Comment": "Control which log categories appear in the console. Set 'enabled' to false to silence everything except errors. Set any category to false to silence just that group.",
+ "enabled": true,
+ "player": true,
+ "inactivity": true,
+ "voiceState": true,
+ "voice247": true,
+ "mediaplayer": true,
+ "commands": true,
+ "guild": true,
+ "recovery": true,
+ "settings": true,
+ "worker": true,
+ "moonlink": true
+ },
+ "timers": {
+ "Comment": "All timing values in milliseconds (ms). 1000ms = 1 second, 60000ms = 1 minute.",
+ "inactivityTimeout": 180000,
+ "aloneCheckInterval": 30000,
+ "aloneCheckDebounce": 500,
+ "rejoin247Delay": 3000,
+ "leave247RejoinDelay": 5000,
+ "playerUpdateInterval": 5000,
+ "searchSessionTimeout": 30000,
+ "playerSessionTimeout": 300000,
+ "intentionalLeaveTTL": 10000
+ }
+}
\ No newline at end of file
diff --git a/index.mjs b/index.mjs
new file mode 100644
index 0000000..a82b2ea
--- /dev/null
+++ b/index.mjs
@@ -0,0 +1,1012 @@
+import * as fs from "fs";
+import path from "path";
+import { initLogger, logger } from "./src/constants/Logger.mjs";
+import { Client, Events, GatewayOpcodes, EmbedBuilder } from "@fluxerjs/core";
+import { CommandHandler, CommandLoader, PrefixManager } from "./src/CommandHandler.mjs";
+import { MessageHandler, PageBuilder, HelpCommand, setGlobalColor, getGlobalColor } from "./src/MessageHandler.mjs";
+import { RemoteSettingsManager, ServerSettings } from "./src/Settings.mjs";
+import { PlayerManager } from "./src/PlayerManager.mjs";
+import Player from "./src/Player.mjs";
+import childProcess from "node:child_process";
+import { getVoiceManager } from "@fluxerjs/voice";
+import { MoonlinkManager } from "./src/MoonlinkManager.mjs";
+import mysql from "mysql";
+
+class Remix {
+ constructor() {
+ const config = JSON.parse(fs.readFileSync("config.json"));
+ this.config = config;
+
+ // Apply embed color from config globally
+ setGlobalColor(config.embedColor);
+
+ const presenceContents = config.presenceContents ?? [];
+ const presenceInterval = config.presenceInterval ?? 30_000;
+
+ // ── Timers config ─────────────────────────────────────────────────────────
+ const timers = config.timers ?? {};
+ const T = {
+ aloneCheckInterval: timers.aloneCheckInterval ?? 30_000,
+ aloneCheckDebounce: timers.aloneCheckDebounce ?? 500,
+ rejoin247Delay: timers.rejoin247Delay ?? 3_000,
+ leave247RejoinDelay: timers.leave247RejoinDelay ?? 5_000,
+ intentionalLeaveTTL: timers.intentionalLeaveTTL ?? 10_000,
+ };
+
+ const client = new Client({
+ intents: 0,
+ ...config["fluxer.js"],
+ presence: presenceContents.length > 0 ? {
+ status: "online",
+ mobile: false,
+ afk: false,
+ custom_status: { text: presenceContents[0] },
+ } : undefined,
+ });
+
+ client.setMaxListeners(50);
+
+ this.client = client;
+
+ const messages = new MessageHandler(this.client);
+ this.messages = messages;
+
+ const settings = new RemoteSettingsManager(config.mysql, "./storage/defaults.json");
+ this.settingsMgr = settings;
+
+ const commands = new CommandHandler(messages);
+ this.handler = commands;
+
+ commands.setPrefixManager(new PrefixManager(settings));
+
+ // ── Help command ──────────────────────────────────────────────────────────
+ new HelpCommand(commands, messages, (msg) => this.getSettings(msg)).register();
+
+ commands.onPing = (msg) => {
+ msg.replyEmbed(
+ this.handler.format(
+ "My prefix in this server is `$prefix`\n\nRun `$prefix$helpCmd` to get started!",
+ msg.message.guildId
+ ),
+ false,
+ {
+ icon_url: msg.channel.channel.guild?.icon
+ ? `https://cdn.fluxer.app/icons/${msg.channel.channel.guild.id}/${msg.channel.channel.guild.icon}.webp`
+ : null,
+ title: msg.channel.channel.guild?.name ?? null,
+ }
+ );
+ };
+ commands.owners = config.owners ?? [];
+
+ // ── MoonlinkManager ───────────────────────────────────────────────────────
+ this.moonlink = null;
+
+ // Guards for one-time setup inside Events.Ready (which fires on every reconnect).
+ // Without these, each reconnect stacks another listener / interval.
+ let wsListenerAttached = false;
+ let moonlinkInitialised = false;
+ let presenceTimer = null;
+
+ // track presence rotation index outside the Ready handler so it
+ // persists across reconnects instead of resetting to 0 each time.
+ let presenceIndex = 0;
+
+ // Per-channel spawn mutex — prevents two rapid calls both passing the
+ // playerMap.has() guard before either has inserted, creating zombie players.
+ const pendingSpawns = new Set();
+
+ // ── spawnPlayer ───────────────────────────────────────────────────────────
+ const spawnPlayer = async (guildId, channelId, delayMs = 0, recoveryData = null) => {
+ if (delayMs > 0) await new Promise(r => setTimeout(r, delayMs));
+
+ const cleanChannelId = String(channelId).replace(/\D/g, "");
+ if (!cleanChannelId) return;
+
+ // Only enforce 24/7 check if we are NOT recovering from a reboot
+ if (!recoveryData) {
+ const set = this.settingsMgr.getServer(guildId);
+ const raw = set.get("stay_247");
+ if (!raw || raw === "none") return;
+
+ const channels = Array.isArray(raw)
+ ? new Set(raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean))
+ : new Set([String(raw).replace(/\D/g, "")]);
+ if (!channels.has(cleanChannelId)) return;
+ }
+
+ // Atomic mutex check — blocks concurrent spawns for the same channel.
+ if (this.players.playerMap.has(cleanChannelId) || pendingSpawns.has(cleanChannelId)) return;
+ pendingSpawns.add(cleanChannelId);
+
+ try {
+ let channel = client.channels.cache.get(cleanChannelId);
+ if (!channel || typeof channel.guild?.voiceAdapterCreator !== "function") {
+ try {
+ channel = await client.channels.fetch(cleanChannelId);
+ } catch (e) {
+ logger.warn("[PlayerSpawn] Could not fetch channel", cleanChannelId, e.message);
+ return;
+ }
+ }
+ if (!channel) { logger.warn("[PlayerSpawn] Channel not found:", cleanChannelId); return; }
+ client.channels.cache.set(cleanChannelId, channel);
+
+ const p = new Player(this.config.token, {
+ client: client,
+ config: config,
+ nodelink: config.nodelink,
+ moonlink: this.moonlink,
+ settingsMgr: this.settingsMgr,
+ observedVoiceUsers: this.observedVoiceUsers,
+ });
+
+ p.on("autoleave", async () => {
+ this.players.playerMap.delete(cleanChannelId);
+ p.destroy();
+ const raw2 = this.settingsMgr.getServer(guildId).get("stay_247");
+ const channels2 = (!raw2 || raw2 === "none")
+ ? []
+ : Array.isArray(raw2)
+ ? raw2.map(id => String(id).replace(/\D/g, "")).filter(Boolean)
+ : [String(raw2).replace(/\D/g, "")].filter(Boolean);
+ if (channels2.includes(cleanChannelId)) {
+ const mode = this.settingsMgr.getServer(guildId).get("stay_247_mode") ?? "auto";
+ if (mode === "auto") await spawnPlayer(guildId, cleanChannelId, T.rejoin247Delay);
+ } else {
+ // 24/7 is off — send inactivity message with hint to enable 247
+ try {
+ const prefix = this.handler?.getPrefix?.(guildId) ?? "%";
+ const guild = this.client.guilds.cache.get(guildId);
+ const ch = guild?.channels?.cache?.find(c =>
+ c.isTextBased?.() && c.permissionsFor?.(this.client.user)?.has?.("SendMessages")
+ );
+ if (ch) {
+ const embed = new EmbedBuilder()
+ .setColor(getGlobalColor())
+ .setDescription(
+ `Left channel <#${cleanChannelId}> because of inactivity.\n` +
+ `If you want me to stay in voice, use \`${prefix}247 on/auto\``
+ )
+ .toJSON();
+ ch.send({ embeds: [embed] }).catch(() => {});
+ }
+ } catch (_) {}
+ }
+ });
+
+ p.on("message", (m) => {
+ const raw = this.settingsMgr.getServer(guildId).get("songAnnouncements");
+ // Centralised falsy check — mirrors the canonical list in settings/runnables.mjs
+ // so both places stay in sync if valid values ever change.
+ const disabled = raw === false || raw === 0 ||
+ ["false", "0", "no", "off", "disable"].includes(String(raw).toLowerCase().trim());
+ if (disabled) return;
+ const guild = this.client.guilds.cache.get(guildId);
+ // _announcementChannelCache is always a Map — no null check needed.
+ const cachedChId = this._announcementChannelCache.get(guildId);
+ let ch = cachedChId ? guild?.channels?.cache?.get(cachedChId) : null;
+ // if cached channel is gone (deleted/uncached), clear the stale
+ // entry immediately so we don't re-scan on every subsequent message event.
+ if (cachedChId && !ch) {
+ this._announcementChannelCache.delete(guildId);
+ }
+ if (!ch) {
+ ch = guild?.channels?.cache?.find(c =>
+ c.isTextBased?.() && c.permissionsFor?.(this.client.user)?.has?.("SendMessages")
+ );
+ if (ch) this._announcementChannelCache.set(guildId, ch.id);
+ }
+ ch?.send({ embeds: [{ description: String(m), color: getGlobalColor() }] }).catch(() => {});
+ });
+
+ this.players.playerMap.set(cleanChannelId, p);
+
+ try {
+ await p.join(cleanChannelId);
+
+ // ==== RESTORE STATE IF RECOVERING ====
+ if (recoveryData) {
+ if (recoveryData.textChannelId) {
+ p.textChannel = client.channels.cache.get(recoveryData.textChannelId);
+ }
+ if (recoveryData.loopQueue) p.queue.setLoop(true);
+ if (recoveryData.loopSong) p.queue.setSongLoop(true);
+
+ if (recoveryData.queue && recoveryData.queue.length > 0) {
+ p.queue.addMany(recoveryData.queue);
+ p.playNext();
+ }
+ logger.recovery(`[Recovery] Restored session in ${cleanChannelId}.`);
+ }
+ } catch (e) {
+ this.players.playerMap.delete(cleanChannelId);
+ logger.warn("[PlayerSpawn] Failed to join channel", cleanChannelId, "guild", guildId, e.message);
+ }
+
+ return p;
+ } finally {
+ // Always release the mutex so future spawns aren't permanently blocked.
+ pendingSpawns.delete(cleanChannelId);
+ }
+ };
+
+ this._spawnPlayer = spawnPlayer;
+
+ // ── Auto-join & Recovery ──────────────────────────────────────────────────
+ let botReady = false;
+ let settingsReady = false;
+
+ const tryAutoJoin = async () => {
+ if (!botReady || !settingsReady) return;
+ await new Promise(r => setTimeout(r, 2000));
+
+ // 1. Recover standard reboots first
+ const recoveryPath = "./storage/recovery.json";
+ if (fs.existsSync(recoveryPath)) {
+ logger.recovery("[Recovery] Found previous session data, restoring...");
+ try {
+ const data = JSON.parse(fs.readFileSync(recoveryPath, "utf8"));
+ for (const session of data) {
+ await spawnPlayer(session.guildId, session.channelId, 500, session);
+ }
+ fs.unlinkSync(recoveryPath);
+ } catch (e) {
+ logger.error("[Recovery] Failed to recover sessions:", e);
+ }
+ }
+
+ // 2. Check traditional 24/7 channels
+ for (const [guildId, serverSettings] of this.settingsMgr.guilds) {
+ const raw = serverSettings.get("stay_247");
+ if (!raw || raw === "none") continue;
+ const mode = serverSettings.get("stay_247_mode") ?? "auto";
+
+ if (mode !== "auto" && mode !== "on") continue;
+
+ const channelIds = Array.isArray(raw)
+ ? raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean)
+ : [String(raw).replace(/\D/g, "")].filter(Boolean);
+ for (const channelId of channelIds) await spawnPlayer(guildId, channelId);
+ }
+ };
+
+ settings.on("ready", () => {
+ initLogger(config);
+ logger.settings("[settings] Loaded from DB.");
+ for (const [guildId, serverSettings] of settings.guilds) {
+ const val = serverSettings.get("stay_247");
+ if (!val || val === "none") continue;
+ if (Array.isArray(val)) {
+ const cleaned = val.map(id => String(id).replace(/\D/g, "")).filter(Boolean);
+ if (JSON.stringify(cleaned) !== JSON.stringify(val)) {
+ serverSettings.set("stay_247", cleaned.length > 0 ? cleaned : "none");
+ }
+ } else {
+ const clean = String(val).replace(/\D/g, "");
+ serverSettings.set("stay_247", clean ? [clean] : "none");
+ }
+ }
+ settingsReady = true;
+ tryAutoJoin();
+ });
+
+ // ── Bot ready ─────────────────────────────────────────────────────────────
+ client.on(Events.Ready, async () => {
+ logger.player("Logged in as " + (client.user?.username ?? "bot"));
+
+ try {
+ getVoiceManager(client);
+ logger.player("VoiceManager initialized.");
+ } catch (e) {
+ logger.warn("[VoiceManager] Init failed:", e.message);
+ }
+
+ const botId = client.user?.id ?? "0";
+
+ // Guard Moonlink creation exactly like wsListenerAttached guards the WS listener.
+ // Previously new MoonlinkManager() + .on("ready") ran on every gateway reconnect,
+ // creating a fresh instance each time and stacking an extra "ready" listener on it.
+ // The old orphaned instance kept its listener alive → duplicate session updates + memory leak.
+ if (!moonlinkInitialised) {
+ moonlinkInitialised = true;
+ this.moonlink = new MoonlinkManager(config.nodelink ?? {}, client);
+
+ this.moonlink.on("ready", (sessionId) => {
+ logger.moonlink(`[Moonlink] Session ready: ${sessionId}`);
+ for (const player of this.players?.playerMap?.values() ?? []) {
+ player._nl.sessionId = sessionId;
+ }
+ this.playerContext.moonlink = this.moonlink;
+ });
+
+ try {
+ await this.moonlink.init(botId);
+ } catch (e) {
+ logger.error("[Moonlink] Init failed:", e.message);
+ }
+ } else {
+ // On reconnect, re-announce the node so Moonlink re-establishes its WS session.
+ logger.moonlink("[Moonlink] Reconnected — re-initialising node session.");
+ try {
+ await this.moonlink.init(botId);
+ } catch (e) {
+ logger.error("[Moonlink] Re-init failed:", e.message);
+ }
+ }
+
+ for (const [gId, guild] of client.guilds.cache) {
+ const voiceStatesRaw =
+ guild.voice_states ??
+ guild.voiceStates?.cache ??
+ guild.voiceStates ??
+ null;
+ if (!voiceStatesRaw) continue;
+ const entries = Array.isArray(voiceStatesRaw)
+ ? voiceStatesRaw
+ : typeof voiceStatesRaw.values === "function"
+ ? [...voiceStatesRaw.values()]
+ : Object.values(voiceStatesRaw);
+ for (const state of entries) {
+ const userId = state.userId ?? state.user_id ?? state.id;
+ const channelId = state.channelId ?? state.channel_id;
+ if (!userId || !channelId) continue;
+ const isBot = state.member?.user?.bot ?? false;
+ const target = isBot ? this.observedVoiceBots : this.observedVoiceUsers;
+ target.set(userId, { channelId, guildId: gId });
+ }
+ }
+
+ // Guard WS listener registration so it only runs once across all reconnects.
+ // Without this, each reconnect stacks a new listener on the same socket, causing
+ // every WS frame to be processed N times after N reconnects.
+ if (!wsListenerAttached) {
+ wsListenerAttached = true;
+ try {
+ const shard0 = client.ws?.shards?.get?.(0);
+ const wsObj = shard0?.ws ?? null;
+
+ const handleRaw = (data) => {
+ try {
+ const payload = typeof data === "string" ? JSON.parse(data) : data;
+
+ if (payload?.op === GatewayOpcodes.GatewayError || payload?.op === 12) {
+ logger.warn("[Gateway] GatewayError (12) received from Fluxer:", payload.d);
+ }
+
+ if (payload?.op !== 0) return;
+
+ if (payload.t === "GUILD_CREATE") {
+ const d = payload.d;
+ const gId = d?.id;
+ const voiceStates = d?.voice_states;
+ if (gId && Array.isArray(voiceStates) && voiceStates.length > 0) {
+ for (const state of voiceStates) {
+ const userId = state.user_id;
+ const channelId = state.channel_id;
+ if (!userId || !channelId) continue;
+ const isBot = state.member?.user?.bot ?? false;
+ const target = isBot ? this.observedVoiceBots : this.observedVoiceUsers;
+ target.set(userId, { channelId, guildId: gId });
+ }
+ }
+ }
+
+ if (payload.t === "VOICE_STATE_UPDATE") {
+ const d = payload.d;
+ const userId = d?.user_id;
+ const channelId = d?.channel_id ?? null;
+ const guildId = d?.guild_id;
+ const isBot = d?.member?.user?.bot ?? false;
+ if (!userId) return;
+ const target = isBot ? this.observedVoiceBots : this.observedVoiceUsers;
+ // WS path correctly deletes on channelId=null,
+ // keeping observedVoice* from growing unbounded.
+ if (channelId) target.set(userId, { channelId, guildId });
+ else target.delete(userId);
+ }
+ } catch (_) {}
+ };
+
+ if (typeof wsObj?.addEventListener === "function") {
+ wsObj.addEventListener("message", (event) => handleRaw(event.data));
+ } else if (typeof wsObj?.on === "function") {
+ wsObj.on("message", handleRaw);
+ }
+ } catch (_) {}
+ }
+
+ botReady = true;
+ tryAutoJoin();
+
+ if (presenceContents.length > 0) {
+ // setPresence now uses the outer presenceIndex so rotation
+ // continues from where it left off after a reconnect instead of
+ // restarting from 0 each time.
+ const setPresence = () => {
+ const presence = {
+ status: "online",
+ mobile: false,
+ afk: false,
+ custom_status: { text: presenceContents[presenceIndex] },
+ };
+ const shard = client.ws.shards.get(0);
+ if (shard) {
+ shard.options.presence = presence;
+ shard.send({ op: GatewayOpcodes.PresenceUpdate, d: presence });
+ }
+ presenceIndex = (presenceIndex + 1) % presenceContents.length;
+ };
+ setPresence();
+ // Clear any existing interval before creating a new one.
+ // Without this, each reconnect stacks another setInterval, eventually
+ // spamming the gateway with duplicate presence updates.
+ if (presenceTimer) clearInterval(presenceTimer);
+ presenceTimer = setInterval(setPresence, presenceInterval);
+ }
+ });
+
+ // ── Voice state tracking ──────────────────────────────────────────────────
+ // Both maps are cleaned up in the WS handleRaw VOICE_STATE_UPDATE path
+ // (channelId=null → delete) and in GuildDelete, so they don't grow unbounded.
+ this.observedVoiceUsers = new Map();
+ this.observedVoiceBots = new Map();
+ // initialise announcement channel cache eagerly alongside other caches
+ // so the hot path never needs a null-check allocation.
+ this._announcementChannelCache = new Map();
+
+ /**
+ * Channels the bot is intentionally leaving.
+ * @type {Map>}
+ */
+ this.intentionalLeaves = new Map();
+
+ // Merged the two separate GuildCreate handlers into one.
+ // Previously there were two client.on(Events.GuildCreate) registrations.
+ // Every GuildCreate event was firing both handlers — doubling voice-state work and
+ // triggering a burst of parallel DB queries on startup for every guild.
+ client.on(Events.GuildCreate, async (guild) => {
+ const guildId = guild?.id ?? guild?._id;
+ if (!guildId) return;
+
+ // ── Part 1: Voice state population ──────────────────────────────────────
+ const voiceStatesRaw =
+ guild.voice_states ??
+ guild.voiceStates?.cache ??
+ guild.voiceStates ??
+ null;
+ if (voiceStatesRaw) {
+ const entries = Array.isArray(voiceStatesRaw)
+ ? voiceStatesRaw
+ : typeof voiceStatesRaw.values === "function"
+ ? [...voiceStatesRaw.values()]
+ : Object.values(voiceStatesRaw);
+
+ for (const state of entries) {
+ const channelId = state.channelId ?? state.channel_id;
+ const userId = state.userId ?? state.user_id ?? state.id;
+ const sgid = state.guildId ?? state.guild_id ?? guildId;
+ const isBot = state.member?.user?.bot ?? false;
+ if (!channelId || !userId) continue;
+ const target = isBot ? this.observedVoiceBots : this.observedVoiceUsers;
+ target.set(userId, { channelId, guildId: sgid });
+ }
+ }
+
+ // ── Part 2: Settings init for new/re-joined servers ──────────────────────
+ // GuildCreate fires on initial join AND on gateway resume for existing servers.
+ // Only act when the guild is missing from our cache (new join or post-GuildDelete).
+ if (!this.settingsMgr.guilds.has(guildId)) {
+ logger.guild(`[GuildCreate] (Re-)joined server ${guildId} — initialising settings.`);
+ try {
+ const res = await this.settingsMgr.query(
+ `SELECT * FROM settings WHERE id=${mysql.escape(guildId)}`
+ );
+ if (res?.results?.length) {
+ const row = res.results[0];
+ const server = new ServerSettings(guildId, this.settingsMgr);
+ server.deserialize(JSON.parse(row.data));
+ server.checkDefaults(this.settingsMgr.defaults);
+ this.settingsMgr.guilds.set(guildId, server);
+ logger.guild(`[GuildCreate] Restored existing settings for server ${guildId}.`);
+ } else {
+ const server = new ServerSettings(guildId, this.settingsMgr);
+ server.checkDefaults(this.settingsMgr.defaults);
+ this.settingsMgr.guilds.set(guildId, server);
+ // Persist the new row so settings survive restarts from the first join.
+ await this.settingsMgr.create(guildId, server);
+ logger.guild(`[GuildCreate] Fresh settings initialised for server ${guildId}.`);
+ }
+ } catch (err) {
+ logger.warn("[GuildCreate] Settings init failed for", guildId, err.message);
+ }
+ }
+ });
+
+ // ── Bot kicked / banned / server deleted ─────────────────────────────────
+ client.on(Events.GuildDelete, (guild) => {
+ const guildId = guild?.id ?? guild?._id;
+ if (!guildId) return;
+
+ logger.guild(`[GuildDelete] Removed from server ${guildId} — cleaning up.`);
+
+ // Use player._guildId directly instead of resolving the channel from
+ // client.channels.cache (which may already be evicted at this point).
+ // The old approach fell through 4 property-chain guesses and silently leaked the
+ // player when all of them were undefined (e.g. after a partial cache eviction).
+ for (const [channelId, player] of this.players.playerMap) {
+ if (!player._guildId || player._guildId === guildId) {
+ this.players.playerMap.delete(channelId);
+ try { player.leave().catch(() => {}); } catch (_) {}
+ try { player.destroy(); } catch (_) {}
+ logger.guild(`[GuildDelete] Destroyed player for channel ${channelId}.`);
+ }
+ }
+
+ // Clear voice-state tracking for this server
+ for (const [userId, info] of [...this.observedVoiceUsers]) {
+ if (info.guildId === guildId) this.observedVoiceUsers.delete(userId);
+ }
+ for (const [userId, info] of [...this.observedVoiceBots]) {
+ if (info.guildId === guildId) this.observedVoiceBots.delete(userId);
+ }
+
+ // Drop the cached settings so stale data can't be read back
+ this.settingsMgr.removeServer(guildId);
+
+ // Clear announcement channel cache for this guild
+ this._announcementChannelCache.delete(guildId);
+
+ logger.guild(`[GuildDelete] Cleanup complete for server ${guildId}.`);
+ });
+
+ // Track previous voice state per-user so we can detect channel moves.
+ // @fluxerjs/core fires VoiceStateUpdate with ONE arg (raw gateway data),
+ // not two args (oldState, newState) like discord.js. We maintain prev state manually.
+ const _prevVoiceState = new Map(); // userId → { channelId, guildId }
+
+ client.on(Events.VoiceStateUpdate, (data) => {
+ // data is the raw GatewayVoiceStateUpdateDispatchData — always snake_case
+ const userId = data?.user_id;
+ if (!userId) return;
+
+ const channelId = data?.channel_id ?? null;
+ const guildId = data?.guild_id;
+ const isBot = data?.member?.user?.bot ?? null;
+
+ // Capture old channel BEFORE updating prev state
+ const prev = _prevVoiceState.get(userId);
+ const oldChannelId = prev?.channelId ?? null;
+
+ // Update prev state
+ if (channelId) {
+ _prevVoiceState.set(userId, { channelId, guildId });
+ } else {
+ _prevVoiceState.delete(userId);
+ }
+
+ // Always update/delete the voice maps so they never accumulate stale entries
+ const target = isBot === true ? this.observedVoiceBots : this.observedVoiceUsers;
+ if (channelId) {
+ target.set(userId, { channelId, guildId });
+ } else {
+ // On leave, delete from BOTH maps — isBot can be null/inconsistent
+ // between join and leave events, so the user may be in either map.
+ this.observedVoiceUsers.delete(userId);
+ this.observedVoiceBots.delete(userId);
+ }
+
+ const isBotUser = isBot === true && userId === client.user?.id;
+
+ if (!isBotUser) {
+ // Resolve guildId from prev state too — leave events may have null guild_id
+ const resolvedGuildId = guildId ?? prev?.guildId;
+ if (!resolvedGuildId) return;
+
+ if (channelId) {
+ try {
+ const raw = this.settingsMgr.getServer(resolvedGuildId)?.get("stay_247");
+ if (raw && raw !== "none") {
+ const cleanId = String(channelId).replace(/\D/g, "");
+ const channels = Array.isArray(raw)
+ ? new Set(raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean))
+ : new Set([String(raw).replace(/\D/g, "")]);
+ if (channels.has(cleanId)) return;
+ }
+ } catch (_) {}
+ }
+
+ // Human LEFT a voice channel → check if bot is now alone
+ if (oldChannelId && oldChannelId !== channelId) {
+ try {
+ const cleanOld = String(oldChannelId).replace(/\D/g, "");
+ const player = this.players.playerMap.get(cleanOld);
+ if (player && typeof player._startInactivityTimer === "function") {
+ setTimeout(() => {
+ if (!player._hasHumansInChannel()) {
+ logger.voiceState(`[VoiceState] Last human left ${cleanOld}, starting inactivity timer`);
+ player._startInactivityTimer();
+ }
+ }, T.aloneCheckDebounce);
+ }
+ } catch (_) {}
+ }
+
+ // Human JOINED the bot's channel → cancel inactivity timer
+ if (channelId) {
+ try {
+ const cleanId = String(channelId).replace(/\D/g, "");
+ const player = this.players.playerMap.get(cleanId);
+ if (player && typeof player._stopInactivityTimer === "function") {
+ logger.voiceState(`[VoiceState] Human joined ${cleanId}, stopping inactivity timer`);
+ player._stopInactivityTimer();
+ }
+ } catch (_) {}
+ }
+
+ return;
+ }
+
+ // ── Bot-only logic below ─────────────────────────────────────────────
+
+ // Auto-save channel when bot moves (247 active)
+ if (channelId && guildId && oldChannelId && oldChannelId !== channelId) {
+ try {
+ const set = this.settingsMgr.getServer(guildId);
+ const raw = set.get("stay_247");
+ if (raw && raw !== "none") {
+ const cleanId = String(channelId).replace(/\D/g, "");
+ const cleanOld = String(oldChannelId).replace(/\D/g, "");
+ const channels = Array.isArray(raw)
+ ? new Set(raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean))
+ : new Set([String(raw).replace(/\D/g, "")]);
+ if (channels.has(cleanOld) && cleanOld !== cleanId) {
+ channels.delete(cleanOld);
+ channels.add(cleanId);
+ set.set("stay_247", [...channels]);
+ }
+ }
+ } catch (e) {
+ logger.warn("[247] Failed to auto-save channel:", e.message);
+ }
+ }
+
+ // Bot disconnected unexpectedly — rejoin if 247 active
+ if (!channelId && oldChannelId && guildId) {
+ try {
+ const cleanOld = String(oldChannelId).replace(/\D/g, "");
+ if (this.intentionalLeaves.has(cleanOld)) {
+ logger.voice247(`[247] Skipping rejoin for ${cleanOld} — intentional leave.`);
+ } else {
+ const set = this.settingsMgr.getServer(guildId);
+ const raw = set.get("stay_247");
+ if (raw && raw !== "none") {
+ const channels = Array.isArray(raw)
+ ? new Set(raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean))
+ : new Set([String(raw).replace(/\D/g, "")]);
+ if (channels.has(cleanOld)) {
+ const mode = set.get("stay_247_mode") ?? "auto";
+ if (mode === "auto") {
+ const player = this.players.playerMap.get(cleanOld);
+ if (player && !player.leaving) {
+ logger.voice247("[247] Fluxer gateway disconnected us. Forcing player recovery...");
+ if (typeof player._recoverConnection === "function") {
+ player._recoverConnection();
+ }
+ } else {
+ spawnPlayer(guildId, cleanOld, T.rejoin247Delay);
+ }
+ } else {
+ logger.voice247(`[247] stay_247_mode='${mode}' — not rejoining. Removing from 24/7.`);
+ channels.delete(cleanOld);
+ set.set("stay_247", channels.size > 0 ? [...channels] : "none");
+ if (channels.size === 0) set.set("stay_247_mode", "off");
+ }
+ }
+ }
+ }
+ } catch (e) {
+ logger.warn("[247] Rejoin on disconnect failed:", e.message);
+ }
+ }
+ });
+
+ // ── Commands ──────────────────────────────────────────────────────────────
+ const loader = new CommandLoader(commands, this);
+ const __dirname = import.meta.dirname;
+ const dir = path.join(__dirname, "commands");
+ logger.commands("Started loading commands.");
+ loader.loadFromDir(dir)
+ .then(() => logger.commands("Commands loaded."))
+ .catch(e => logger.error("Failed to load commands:", e));
+
+ // ── Modules ───────────────────────────────────────────────────────────────
+ logger.commands("Loading Modules.");
+ this.loadedModules = new Map();
+ this.modules = JSON.parse(fs.readFileSync("./storage/modules.json"));
+ Promise.all(this.modules.map(async m => {
+ if (!m.enabled) return;
+ const exported = await import(m.index);
+ const ModClass = exported.default;
+ this.loadedModules.set(m.name, { instance: new ModClass(this), c: ModClass });
+ }))
+ .then(() => logger.commands("Modules loaded."))
+ .catch(e => logger.error("Failed to load modules:", e));
+
+ // ── Git commit hash ───────────────────────────────────────────────────────
+ try {
+ this.comHash = childProcess.execSync("git rev-parse --short HEAD", { cwd: __dirname, timeout: 3000 }).toString().trim();
+ this.comHashLong = childProcess.execSync("git rev-parse HEAD", { cwd: __dirname, timeout: 3000 }).toString().trim();
+ } catch {
+ logger.warn("[Git] comhash error");
+ this.comHash = "Newest";
+ this.comHashLong = null;
+ }
+
+ // ── Player ────────────────────────────────────────────────────────────────
+ this.playerContext = {
+ client: this.client,
+ config,
+ nodelink: config.nodelink,
+ moonlink: null,
+ };
+ this.players = new PlayerManager(settings, commands, { config, player: this.playerContext });
+ this.players.observedVoiceUsers = this.observedVoiceUsers;
+
+ // ── Periodic alone-check ───────────────────────────────────────────────────
+ // Every 30 seconds, scan all active players. If the bot is alone in a voice
+ // channel (no humans) and 247 is NOT on/auto, leave immediately.
+ // This is the authoritative leave mechanism — does not rely on voice state events.
+ const ALONE_CHECK_INTERVAL = T.aloneCheckInterval;
+ setInterval(() => {
+ for (const [channelId, player] of this.players.playerMap) {
+ try {
+ const guildId = player._guildId;
+ if (!guildId) continue;
+
+ // Skip if 247 is on or auto
+ if (player._is247Enabled()) continue;
+
+ // Read directly from observedVoiceUsers — bypass any cache issues
+ // Normalize both sides to digits-only to avoid format mismatch
+ const cleanChanId = String(channelId).replace(/\D/g, "");
+ const cleanGuildId = String(guildId).replace(/\D/g, "");
+ let hasHuman = false;
+ for (const [, info] of this.observedVoiceUsers) {
+ const infoChannel = String(info.channelId ?? "").replace(/\D/g, "");
+ const infoGuild = String(info.guildId ?? "").replace(/\D/g, "");
+ if (infoGuild === cleanGuildId && infoChannel === cleanChanId) {
+ hasHuman = true;
+ break;
+ }
+ }
+
+ logger.aloneCheck(`[AloneCheck] channel=${channelId} guild=${guildId} hasHuman=${hasHuman} paused=${player._paused}`);
+
+ if (!hasHuman && !player._paused) {
+ logger.aloneCheck(`[AloneCheck] Bot alone in ${channelId} (guild ${guildId}), leaving.`);
+ // Stop inactivity timer first to prevent double-autoleave
+ player._stopInactivityTimer?.();
+ player.emit("autoleave");
+ }
+ } catch (e) {
+ logger.warn("[AloneCheck] Error checking channel", channelId, e.message);
+ }
+ }
+ }, ALONE_CHECK_INTERVAL);
+
+ const self = this;
+ this.players.checkVoiceChannels = function (message) {
+ const userId = message?.author?.id ?? message?.message?.author?.id;
+ const guildId = message?.channel?.server_id ??
+ message?.channel?.serverId ??
+ message?.channel?.guild?.id ??
+ message?.message?.server_id ??
+ message?.message?.serverId ??
+ message?.message?.guildId;
+ if (!userId || !guildId) return null;
+
+ const seed = (channelId) => {
+ // Only seed if no entry exists — never overwrite fresh gateway voice state
+ // with potentially stale member-cache data.
+ if (!self.observedVoiceUsers.has(userId)) {
+ self.observedVoiceUsers.set(userId, { channelId, guildId });
+ }
+ return self.observedVoiceUsers.get(userId)?.channelId ?? channelId;
+ };
+
+ const observed = self.observedVoiceUsers.get(userId);
+ if (observed && observed.guildId === guildId) return observed.channelId;
+
+ try {
+ const vm = getVoiceManager(client);
+ const channelId = vm?.getVoiceChannelId?.(guildId, userId);
+ if (channelId) return seed(channelId);
+ } catch (_) {}
+
+ const memberVoice =
+ message?.member?.voice?.channelId ??
+ message?.message?.member?.voice?.channelId ??
+ null;
+ if (memberVoice) return seed(memberVoice);
+
+ try {
+ const guild = client.guilds.cache.get(guildId);
+ const voiceStates = guild?.voiceStates?.cache ?? guild?.voiceStates ?? null;
+ if (voiceStates) {
+ const entries = typeof voiceStates.values === "function"
+ ? voiceStates.values()
+ : Object.values(voiceStates);
+ for (const state of entries) {
+ const sid = state.userId ?? state.user_id ?? state.id;
+ const sch = state.channelId ?? state.channel_id;
+ const sgid = state.guildId ?? state.guild_id ?? guildId;
+ if (sid === userId && sgid === guildId && sch) return seed(sch);
+ }
+ }
+ } catch (_) {}
+
+ return null;
+ };
+
+ this.comLink = "https://github.com/remix-bot/fluxer/commit/" + (this.comHashLong ?? "");
+
+ client.login(config.token);
+ }
+
+ // ─── Helpers ──────────────────────────────────────────────────────────────
+
+ markIntentionalLeave(channelId, ttlMs = null) {
+ const clean = String(channelId).replace(/\D/g, "");
+ if (!clean) return;
+ if (ttlMs === null) ttlMs = this.config?.timers?.intentionalLeaveTTL ?? 10_000;
+ const existing = this.intentionalLeaves.get(clean);
+ if (existing) clearTimeout(existing);
+ this.intentionalLeaves.set(clean, setTimeout(() => {
+ this.intentionalLeaves.delete(clean);
+ }, ttlMs));
+ }
+
+ async leaveChannel(channelId, guildId, message, force = false) {
+ const cleanId = String(channelId).replace(/\D/g, "");
+ const set = this.settingsMgr.getServer(guildId);
+ const raw = set.get("stay_247");
+ const mode = set.get("stay_247_mode") ?? "auto";
+
+ const channels = (!raw || raw === "none")
+ ? new Set()
+ : Array.isArray(raw)
+ ? new Set(raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean))
+ : new Set([String(raw).replace(/\D/g, "")]);
+
+ // If mode is auto, block the leave command
+ if (channels.has(cleanId) && !force) {
+ if (mode === "auto") {
+ if (message) {
+ message.replyEmbed(
+ `⚠️ 24/7 mode is enabled (auto) — I'll rejoin <#${cleanId}> in a few seconds.\n` +
+ `To permanently remove me, disable 24/7 mode first: \`%247 off\``
+ );
+ }
+ return false;
+ }
+ }
+
+ // If mode is 'on' or it's forced, allow leaving & remove from 24/7 list
+ if (channels.has(cleanId)) {
+ channels.delete(cleanId);
+ set.set("stay_247", channels.size > 0 ? [...channels] : "none");
+ if (channels.size === 0) set.set("stay_247_mode", "off");
+ }
+
+ this.markIntentionalLeave(cleanId);
+
+ const player = this.players.playerMap.get(cleanId);
+ if (player) {
+ this.players.playerMap.delete(cleanId);
+ await player.leave().catch(() => {});
+ player.destroy();
+ }
+
+ if (message) message.replyEmbed("✅ Successfully Left");
+ return true;
+ }
+
+ /** @param {Message} message */
+ getSettings(message) {
+ const guildId = message?.channel?.channel?.guildId ?? message?.guildId ?? null;
+ return this.settingsMgr.getServer(guildId);
+ }
+
+ getPlayer(message, promptJoin, verifyUser, shouldJoin) {
+ return this.players.getPlayer(message, promptJoin, verifyUser, shouldJoin);
+ }
+
+ getSharedServers(user) {
+ // guild.members.cache.has() only works for cached members (requires privileged intents).
+ // Instead, use the settings guilds map — any guild the bot is in and has settings for
+ // is one we actually serve, which is a reliable proxy for "shared server".
+ const mutualGuilds = this.client.guilds.cache.filter(g =>
+ this.settingsMgr.guilds.has(g.id)
+ );
+ return Promise.resolve([...mutualGuilds.values()].map(guild => ({
+ name: guild.name,
+ id: guild.id,
+ icon: guild.icon
+ ? `https://cdn.fluxer.app/icons/${guild.id}/${guild.icon}.webp`
+ : null,
+ voiceChannels: guild.channels.cache
+ .filter(c => c.isVoiceBased())
+ .map(c => ({ name: c.name, id: c.id, icon: null })),
+ })));
+ }
+
+ pagination(form, content, msg, linesPerPage) {
+ this.messages.initPagination(
+ new PageBuilder(content).setForm(form).setMaxLines(linesPerPage),
+ msg
+ );
+ }
+}
+
+const remix = new Remix();
+
+process.on("unhandledRejection", (reason, p) => {
+ if (reason?.message?.includes("AudioSource is closed")) return;
+ logger.error("[Error_Handling] Unhandled Rejection/Catch");
+ logger.error("Reason:", reason, p);
+});
+process.on("uncaughtException", (err, origin) => {
+ logger.error("[Error_Handling] Uncaught Exception/Catch");
+ logger.error("Error:", err, origin);
+});
+process.on("uncaughtExceptionMonitor", (err, origin) => {
+ logger.error("[Error_Handling] Uncaught Exception/Catch (MONITOR)");
+ logger.error("Error:", err, origin);
+});
+
+// ── Session Reboot Recovery Hooks ───────────────────────────────────────────
+const saveAndExit = () => {
+ logger.recovery("\n[Shutdown] Saving active sessions for reboot recovery...");
+ try {
+ const state = [];
+ for (const [channelId, player] of remix.players.playerMap.entries()) {
+ const current = player.queue.getCurrent();
+ const queueData = player.queue.getQueue();
+ const tracksToSave = [];
+
+ if (current) tracksToSave.push(current);
+ tracksToSave.push(...queueData);
+
+ // Save ALL active sessions unconditionally so the bot always rejoins
+ // the channel it was in before rebooting (queue or not, 24/7 or not)
+ state.push({
+ guildId: player._guildId,
+ channelId: channelId,
+ textChannelId: player.textChannel?.id ?? player.textChannel?._id,
+ queue: tracksToSave,
+ loopQueue: player.queue.loop,
+ loopSong: player.queue.songLoop,
+ });
+ }
+
+ if (state.length > 0) {
+ // Write to a temp file then rename atomically to prevent partial writes
+ // if the OS sends SIGKILL before writeFileSync finishes on large queue states.
+ const recoveryPath = "./storage/recovery.json";
+ const tmpPath = recoveryPath + ".tmp";
+ fs.writeFileSync(tmpPath, JSON.stringify(state, null, 2));
+ fs.renameSync(tmpPath, recoveryPath);
+ logger.recovery(`[Shutdown] Saved ${state.length} active sessions to storage/recovery.json`);
+ } else {
+ logger.recovery("[Shutdown] No active sessions to save.");
+ }
+ } catch (e) {
+ logger.error("[Shutdown] Failed to save recovery state:", e.message);
+ }
+ process.exit(0);
+};
+
+process.once("SIGINT", saveAndExit);
+process.once("SIGTERM", saveAndExit);
+process.once("SIGUSR2", saveAndExit);
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..efc5e22
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,5352 @@
+{
+ "name": "fluxer",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "dependencies": {
+ "@fluxerjs/core": "^1.3.0",
+ "@fluxerjs/voice": "^1.3.0",
+ "@livekit/rtc-node": "^0.13.24",
+ "express": "^4.18.2",
+ "ffmpeg-static": "^5.1.0",
+ "ffprobe-static": "^3.1.0",
+ "follow-redirects": "^1.15.2",
+ "genius-lyrics": "^4.4.3",
+ "moonlink.js": "^5.2.0",
+ "mysql": "^2.18.1",
+ "revoice.js": "^0.2.1694",
+ "util": "^0.12.5",
+ "ws": "^8.19.0"
+ }
+ },
+ "node_modules/@babel/code-frame": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz",
+ "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-validator-identifier": "^7.28.5",
+ "js-tokens": "^4.0.0",
+ "picocolors": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/compat-data": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz",
+ "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/core": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
+ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.0",
+ "@babel/generator": "^7.29.0",
+ "@babel/helper-compilation-targets": "^7.28.6",
+ "@babel/helper-module-transforms": "^7.28.6",
+ "@babel/helpers": "^7.28.6",
+ "@babel/parser": "^7.29.0",
+ "@babel/template": "^7.28.6",
+ "@babel/traverse": "^7.29.0",
+ "@babel/types": "^7.29.0",
+ "@jridgewell/remapping": "^2.3.5",
+ "convert-source-map": "^2.0.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.2",
+ "json5": "^2.2.3",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/babel"
+ }
+ },
+ "node_modules/@babel/core/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@babel/core/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/@babel/generator": {
+ "version": "7.29.1",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz",
+ "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.29.0",
+ "@babel/types": "^7.29.0",
+ "@jridgewell/gen-mapping": "^0.3.12",
+ "@jridgewell/trace-mapping": "^0.3.28",
+ "jsesc": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz",
+ "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/compat-data": "^7.28.6",
+ "@babel/helper-validator-option": "^7.27.1",
+ "browserslist": "^4.24.0",
+ "lru-cache": "^5.1.1",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-globals": {
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz",
+ "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-imports": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz",
+ "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.28.6",
+ "@babel/types": "^7.28.6"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-transforms": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz",
+ "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-imports": "^7.28.6",
+ "@babel/helper-validator-identifier": "^7.28.5",
+ "@babel/traverse": "^7.28.6"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-string-parser": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
+ "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.28.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz",
+ "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-option": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz",
+ "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helpers": {
+ "version": "7.29.2",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz",
+ "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/template": "^7.28.6",
+ "@babel/types": "^7.29.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/parser": {
+ "version": "7.29.2",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.2.tgz",
+ "integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.29.0"
+ },
+ "bin": {
+ "parser": "bin/babel-parser.js"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@babel/runtime": {
+ "version": "7.29.2",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz",
+ "integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/template": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz",
+ "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.28.6",
+ "@babel/parser": "^7.28.6",
+ "@babel/types": "^7.28.6"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/traverse": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz",
+ "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.0",
+ "@babel/generator": "^7.29.0",
+ "@babel/helper-globals": "^7.28.0",
+ "@babel/parser": "^7.29.0",
+ "@babel/template": "^7.28.6",
+ "@babel/types": "^7.29.0",
+ "debug": "^4.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/traverse/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@babel/traverse/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/@babel/types": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz",
+ "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-string-parser": "^7.27.1",
+ "@babel/helper-validator-identifier": "^7.28.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@bcoe/v8-coverage": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
+ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
+ "license": "MIT"
+ },
+ "node_modules/@borewit/text-codec": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.2.tgz",
+ "integrity": "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ }
+ },
+ "node_modules/@bufbuild/protobuf": {
+ "version": "1.10.1",
+ "license": "(Apache-2.0 AND BSD-3-Clause)"
+ },
+ "node_modules/@datastructures-js/deque": {
+ "version": "1.0.8",
+ "license": "MIT"
+ },
+ "node_modules/@derhuerst/http-basic": {
+ "version": "8.2.4",
+ "license": "MIT",
+ "dependencies": {
+ "caseless": "^0.12.0",
+ "concat-stream": "^2.0.0",
+ "http-response-object": "^3.0.1",
+ "parse-cache-control": "^1.0.1"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@eshaz/web-worker": {
+ "version": "1.2.2",
+ "license": "Apache-2.0"
+ },
+ "node_modules/@fastify/busboy": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
+ "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/@fidm/asn1": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@fidm/asn1/-/asn1-1.0.4.tgz",
+ "integrity": "sha512-esd1jyNvRb2HVaQGq2Gg8Z0kbQPXzV9Tq5Z14KNIov6KfFD6PTaRIO8UpcsYiTNzOqJpmyzWgVTrUwFV3UF4TQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@fidm/x509": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@fidm/x509/-/x509-1.2.1.tgz",
+ "integrity": "sha512-nwc2iesjyc9hkuzcrMCBXQRn653XuAUKorfWM8PZyJawiy1QzLj4vahwzaI25+pfpwOLvMzbJ0uKpWLDNmo16w==",
+ "license": "MIT",
+ "dependencies": {
+ "@fidm/asn1": "^1.0.4",
+ "tweetnacl": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@fluxerjs/builders": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@fluxerjs/builders/-/builders-1.3.0.tgz",
+ "integrity": "sha512-EcgnttHauIqNoWC/ohcbtiC8ppkQC7eJlaNS4YT3ygvaBdRDR0v4gqUNlE4YSPTFafKJjKrCKtOvrkQ/wbixEw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@fluxerjs/types": "1.3.0",
+ "@fluxerjs/util": "1.3.0"
+ }
+ },
+ "node_modules/@fluxerjs/collection": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@fluxerjs/collection/-/collection-1.3.0.tgz",
+ "integrity": "sha512-a42tmtPlgVz25tJndmDQKz8btB1oEmxlYhOO/Prt1vbwn32dJR0Nxlksfn4U5X4lGSTKFfwKzEx3Ng8Nza0FLQ==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/@fluxerjs/core": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@fluxerjs/core/-/core-1.3.0.tgz",
+ "integrity": "sha512-sRoBEb0Lhtd0O+LR7GfE1tJOde0Q4Va64l0VE+OIO16y+l5sk5hRmQbwdcjbWftEPPKdcjLQstsZG63/a1aQqg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@fluxerjs/builders": "1.3.0",
+ "@fluxerjs/collection": "1.3.0",
+ "@fluxerjs/rest": "1.3.0",
+ "@fluxerjs/types": "1.3.0",
+ "@fluxerjs/util": "1.3.0",
+ "@fluxerjs/ws": "1.3.0"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/@fluxerjs/rest": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@fluxerjs/rest/-/rest-1.3.0.tgz",
+ "integrity": "sha512-iZC0ul0N/JUN6Sg4DgYcoLErutl2Q8UTaGlkyTt9UW/Q2pWGUTiG9XnjAs08u1Xt6KKEopzC1flpMlGC6gTE9w==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@fluxerjs/types": "1.3.0"
+ }
+ },
+ "node_modules/@fluxerjs/types": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@fluxerjs/types/-/types-1.3.0.tgz",
+ "integrity": "sha512-Vo7lW3+PCZgg8XnE7mux6iLcGp2J2w9HbT40VOAH4cPAD1tcIoQtaCwiahtBdgWa+97J3L3a7gjkcEo7L5DIYQ==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/@fluxerjs/util": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@fluxerjs/util/-/util-1.3.0.tgz",
+ "integrity": "sha512-/k8rcLDU+Vok45erKTP8j9Ib8+jyOzVkjV2ebUgtvmqGsbzx82LIOGzaJjOqJ+P2uAlo1lOTpDdvG/Bdr0+hqw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@fluxerjs/types": "1.3.0"
+ }
+ },
+ "node_modules/@fluxerjs/voice": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@fluxerjs/voice/-/voice-1.3.0.tgz",
+ "integrity": "sha512-hq82IIAMPdegPZFfW5pLxzF84q10MeHWfu37k/gl1miNU32bc+QqMvjZHQ4dZs8EUNMvszDAM4z6eFGsgrfmAw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@fluxerjs/collection": "1.3.0",
+ "@fluxerjs/core": "1.3.0",
+ "@fluxerjs/types": "1.3.0",
+ "@fluxerjs/util": "1.3.0",
+ "@livekit/rtc-node": "^0.13.24",
+ "mp4box": "^0.5.2",
+ "opus-decoder": "^0.7.0",
+ "prism-media": "^1.3.5",
+ "tweetnacl": "^1.0.3",
+ "ws": "^8.18.0"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "optionalDependencies": {
+ "livekit-server-sdk": "^2.15.0",
+ "node-webcodecs": "^1.0.0"
+ }
+ },
+ "node_modules/@fluxerjs/ws": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@fluxerjs/ws/-/ws-1.3.0.tgz",
+ "integrity": "sha512-bAFRystaX3vEZXzi+/h3OgCYR3QisvYVBfuezntkQQ37if5V6GJmhWUh+zL8XNosRBpWxjo8igf+0w1clyHqxQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@fluxerjs/types": "1.3.0",
+ "@fluxerjs/util": "1.3.0",
+ "ws": "^8.18.0"
+ }
+ },
+ "node_modules/@insertish/oapi": {
+ "version": "0.1.18",
+ "resolved": "https://registry.npmjs.org/@insertish/oapi/-/oapi-0.1.18.tgz",
+ "integrity": "sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA==",
+ "license": "MIT",
+ "dependencies": {
+ "typescript": "^4.6.2"
+ },
+ "bin": {
+ "oapilib": "cli.js"
+ },
+ "optionalDependencies": {
+ "axios": "^0.26.1",
+ "openapi-typescript": "^5.2.0"
+ }
+ },
+ "node_modules/@istanbuljs/schema": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
+ "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/remapping": {
+ "version": "2.3.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@livekit/mutex": {
+ "version": "1.1.1",
+ "license": "Apache-2.0"
+ },
+ "node_modules/@livekit/protocol": {
+ "version": "1.45.0",
+ "license": "Apache-2.0",
+ "optional": true,
+ "dependencies": {
+ "@bufbuild/protobuf": "^1.10.0"
+ }
+ },
+ "node_modules/@livekit/rtc-node": {
+ "version": "0.13.24",
+ "resolved": "https://registry.npmjs.org/@livekit/rtc-node/-/rtc-node-0.13.24.tgz",
+ "integrity": "sha512-06pF8YJlJk11R6J7kFXFpwV8etpbmCskoXFvwfwcDDixMqaP6qtS5srq3G23mDaRjx7ofz/PXg2GtiZbqNGT5A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@bufbuild/protobuf": "^1.10.1",
+ "@datastructures-js/deque": "1.0.8",
+ "@livekit/mutex": "^1.0.0",
+ "@livekit/typed-emitter": "^3.0.0",
+ "pino": "^9.0.0",
+ "pino-pretty": "^13.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "optionalDependencies": {
+ "@livekit/rtc-node-darwin-arm64": "0.13.24",
+ "@livekit/rtc-node-darwin-x64": "0.13.24",
+ "@livekit/rtc-node-linux-arm64-gnu": "0.13.24",
+ "@livekit/rtc-node-linux-x64-gnu": "0.13.24",
+ "@livekit/rtc-node-win32-x64-msvc": "0.13.24"
+ }
+ },
+ "node_modules/@livekit/rtc-node-darwin-arm64": {
+ "version": "0.13.24",
+ "resolved": "https://registry.npmjs.org/@livekit/rtc-node-darwin-arm64/-/rtc-node-darwin-arm64-0.13.24.tgz",
+ "integrity": "sha512-gm5xOpGu6Rj/mNU2jEijcGhQGN2GdxV2dNYQm3NCKN7ow0BmMFZvXSCAWOWf+9oTutPXHnrc7EN1mt2v+lfqhA==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@livekit/rtc-node-darwin-x64": {
+ "version": "0.13.24",
+ "resolved": "https://registry.npmjs.org/@livekit/rtc-node-darwin-x64/-/rtc-node-darwin-x64-0.13.24.tgz",
+ "integrity": "sha512-jZSK5lHDp7+u0jby7PEWMzbxc0F0nLx6FT3FVjuMlT13ZY6QWKDUUCFbfDOtbdhiOZJYc5A4SwvubY6woEJXTg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@livekit/rtc-node-linux-arm64-gnu": {
+ "version": "0.13.24",
+ "resolved": "https://registry.npmjs.org/@livekit/rtc-node-linux-arm64-gnu/-/rtc-node-linux-arm64-gnu-0.13.24.tgz",
+ "integrity": "sha512-I+IeZET2h+viZ48moEFF0EWDHa+kLii5yuEsw38ya4mHZaZtlfbzrYKGKdONqbI9M9ldvv8XXuD0wFPjuH5CZw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@livekit/rtc-node-linux-x64-gnu": {
+ "version": "0.13.24",
+ "resolved": "https://registry.npmjs.org/@livekit/rtc-node-linux-x64-gnu/-/rtc-node-linux-x64-gnu-0.13.24.tgz",
+ "integrity": "sha512-vKOxzN/SsrtV8zIVwZCi31bZUhlb6RhJZ0NnY5MwKGSRFPi7Dwt8fmr0Vh0YmsY/p+4eZjKxvFmy7L3WVE54zw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@livekit/rtc-node-win32-x64-msvc": {
+ "version": "0.13.24",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@livekit/typed-emitter": {
+ "version": "3.0.0",
+ "license": "MIT"
+ },
+ "node_modules/@minhducsun2002/leb128": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@minhducsun2002/leb128/-/leb128-1.0.0.tgz",
+ "integrity": "sha512-eFrYUPDVHeuwWHluTG1kwNQUEUcFjVKYwPkU8z9DR1JH3AW7JtJsG9cRVGmwz809kKtGfwGJj58juCZxEvnI/g==",
+ "license": "MIT"
+ },
+ "node_modules/@peculiar/asn1-cms": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.6.1.tgz",
+ "integrity": "sha512-vdG4fBF6Lkirkcl53q6eOdn3XYKt+kJTG59edgRZORlg/3atWWEReRCx5rYE1ZzTTX6vLK5zDMjHh7vbrcXGtw==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.6.0",
+ "@peculiar/asn1-x509": "^2.6.1",
+ "@peculiar/asn1-x509-attr": "^2.6.1",
+ "asn1js": "^3.0.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-csr": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.6.1.tgz",
+ "integrity": "sha512-WRWnKfIocHyzFYQTka8O/tXCiBquAPSrRjXbOkHbO4qdmS6loffCEGs+rby6WxxGdJCuunnhS2duHURhjyio6w==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.6.0",
+ "@peculiar/asn1-x509": "^2.6.1",
+ "asn1js": "^3.0.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-ecc": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.6.1.tgz",
+ "integrity": "sha512-+Vqw8WFxrtDIN5ehUdvlN2m73exS2JVG0UAyfVB31gIfor3zWEAQPD+K9ydCxaj3MLen9k0JhKpu9LqviuCE1g==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.6.0",
+ "@peculiar/asn1-x509": "^2.6.1",
+ "asn1js": "^3.0.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-pfx": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.6.1.tgz",
+ "integrity": "sha512-nB5jVQy3MAAWvq0KY0R2JUZG8bO/bTLpnwyOzXyEh/e54ynGTatAR+csOnXkkVD9AFZ2uL8Z7EV918+qB1qDvw==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-cms": "^2.6.1",
+ "@peculiar/asn1-pkcs8": "^2.6.1",
+ "@peculiar/asn1-rsa": "^2.6.1",
+ "@peculiar/asn1-schema": "^2.6.0",
+ "asn1js": "^3.0.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-pkcs8": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.6.1.tgz",
+ "integrity": "sha512-JB5iQ9Izn5yGMw3ZG4Nw3Xn/hb/G38GYF3lf7WmJb8JZUydhVGEjK/ZlFSWhnlB7K/4oqEs8HnfFIKklhR58Tw==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.6.0",
+ "@peculiar/asn1-x509": "^2.6.1",
+ "asn1js": "^3.0.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-pkcs9": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.6.1.tgz",
+ "integrity": "sha512-5EV8nZoMSxeWmcxWmmcolg22ojZRgJg+Y9MX2fnE2bGRo5KQLqV5IL9kdSQDZxlHz95tHvIq9F//bvL1OeNILw==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-cms": "^2.6.1",
+ "@peculiar/asn1-pfx": "^2.6.1",
+ "@peculiar/asn1-pkcs8": "^2.6.1",
+ "@peculiar/asn1-schema": "^2.6.0",
+ "@peculiar/asn1-x509": "^2.6.1",
+ "@peculiar/asn1-x509-attr": "^2.6.1",
+ "asn1js": "^3.0.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-rsa": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.6.1.tgz",
+ "integrity": "sha512-1nVMEh46SElUt5CB3RUTV4EG/z7iYc7EoaDY5ECwganibQPkZ/Y2eMsTKB/LeyrUJ+W/tKoD9WUqIy8vB+CEdA==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.6.0",
+ "@peculiar/asn1-x509": "^2.6.1",
+ "asn1js": "^3.0.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-schema": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.6.0.tgz",
+ "integrity": "sha512-xNLYLBFTBKkCzEZIw842BxytQQATQv+lDTCEMZ8C196iJcJJMBUZxrhSTxLaohMyKK8QlzRNTRkUmanucnDSqg==",
+ "license": "MIT",
+ "dependencies": {
+ "asn1js": "^3.0.6",
+ "pvtsutils": "^1.3.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-x509": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.6.1.tgz",
+ "integrity": "sha512-O9jT5F1A2+t3r7C4VT7LYGXqkGLK7Kj1xFpz7U0isPrubwU5PbDoyYtx6MiGst29yq7pXN5vZbQFKRCP+lLZlA==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.6.0",
+ "asn1js": "^3.0.6",
+ "pvtsutils": "^1.3.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/asn1-x509-attr": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.6.1.tgz",
+ "integrity": "sha512-tlW6cxoHwgcQghnJwv3YS+9OO1737zgPogZ+CgWRUK4roEwIPzRH4JEiG770xe5HX2ATfCpmX60gurfWIF9dcQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.6.0",
+ "@peculiar/asn1-x509": "^2.6.1",
+ "asn1js": "^3.0.6",
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/@peculiar/json-schema": {
+ "version": "1.1.12",
+ "resolved": "https://registry.npmjs.org/@peculiar/json-schema/-/json-schema-1.1.12.tgz",
+ "integrity": "sha512-coUfuoMeIB7B8/NMekxaDzLhaYmp0HZNPEjYRm9goRou8UZIC3z21s0sL9AWoCw4EG876QyO3kYrc61WNF9B/w==",
+ "license": "MIT",
+ "dependencies": {
+ "tslib": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/@peculiar/webcrypto": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@peculiar/webcrypto/-/webcrypto-1.5.0.tgz",
+ "integrity": "sha512-BRs5XUAwiyCDQMsVA9IDvDa7UBR9gAvPHgugOeGng3YN6vJ9JYonyDc0lNczErgtCWtucjR5N7VtaonboD/ezg==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.3.8",
+ "@peculiar/json-schema": "^1.1.12",
+ "pvtsutils": "^1.3.5",
+ "tslib": "^2.6.2",
+ "webcrypto-core": "^1.8.0"
+ },
+ "engines": {
+ "node": ">=10.12.0"
+ }
+ },
+ "node_modules/@peculiar/x509": {
+ "version": "1.14.3",
+ "resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",
+ "integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-cms": "^2.6.0",
+ "@peculiar/asn1-csr": "^2.6.0",
+ "@peculiar/asn1-ecc": "^2.6.0",
+ "@peculiar/asn1-pkcs9": "^2.6.0",
+ "@peculiar/asn1-rsa": "^2.6.0",
+ "@peculiar/asn1-schema": "^2.6.0",
+ "@peculiar/asn1-x509": "^2.6.0",
+ "pvtsutils": "^1.3.6",
+ "reflect-metadata": "^0.2.2",
+ "tslib": "^2.8.1",
+ "tsyringe": "^4.10.0"
+ },
+ "engines": {
+ "node": ">=20.0.0"
+ }
+ },
+ "node_modules/@pinojs/redact": {
+ "version": "0.4.0",
+ "license": "MIT"
+ },
+ "node_modules/@shinyoshiaki/ebml-builder": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/@shinyoshiaki/ebml-builder/-/ebml-builder-0.0.1.tgz",
+ "integrity": "sha512-rz1LklnlZ0yvVIt924yRGu+R87Fhfa06BdRIZR6GF6SXVSBTD9wCQmN6opXQLuSkoKXleWJwF3PW1ls8DGZjtw==",
+ "license": "MIT",
+ "dependencies": {
+ "lodash.memoize": "^4.1.2"
+ }
+ },
+ "node_modules/@tokenizer/inflate": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz",
+ "integrity": "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.3",
+ "token-types": "^6.1.1"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ }
+ },
+ "node_modules/@tokenizer/inflate/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@tokenizer/inflate/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/@tokenizer/token": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz",
+ "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==",
+ "license": "MIT"
+ },
+ "node_modules/@types/babel-types": {
+ "version": "7.0.16",
+ "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.16.tgz",
+ "integrity": "sha512-5QXs9GBFTNTmilLlWBhnsprqpjfrotyrnzUdwDrywEL/DA4LuCWQT300BTOXA3Y9ngT9F2uvmCoIxI6z8DlJEA==",
+ "license": "MIT"
+ },
+ "node_modules/@types/babylon": {
+ "version": "6.16.9",
+ "resolved": "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.9.tgz",
+ "integrity": "sha512-sEKyxMVEowhcr8WLfN0jJYe4gS4Z9KC2DGz0vqfC7+MXFbmvOF7jSjALC77thvAO2TLgFUPa9vDeOak+AcUrZA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/babel-types": "*"
+ }
+ },
+ "node_modules/@types/debug": {
+ "version": "4.1.13",
+ "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz",
+ "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/ms": "*"
+ }
+ },
+ "node_modules/@types/istanbul-lib-coverage": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
+ "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==",
+ "license": "MIT"
+ },
+ "node_modules/@types/ms": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
+ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "10.17.60",
+ "license": "MIT"
+ },
+ "node_modules/@wasm-audio-decoders/common": {
+ "version": "9.0.7",
+ "license": "MIT",
+ "dependencies": {
+ "@eshaz/web-worker": "1.2.2",
+ "simple-yenc": "^1.0.4"
+ }
+ },
+ "node_modules/accepts": {
+ "version": "1.3.8",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "~2.1.34",
+ "negotiator": "0.6.3"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/ace-builds": {
+ "version": "1.43.6",
+ "resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.43.6.tgz",
+ "integrity": "sha512-L1ddibQ7F3vyXR2k2fg+I8TQTPWVA6CKeDQr/h2+8CeyTp3W6EQL8xNFZRTztuP8xNOAqL3IYPqdzs31GCjDvg==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/acorn": {
+ "version": "4.0.13",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz",
+ "integrity": "sha512-fu2ygVGuMmlzG8ZeRJ0bvR41nsAkxxhbyk8bZ1SS521Z7vmgJFTQQlfz/Mp/nJexGBz+v8sC9bM6+lNgskt4Ug==",
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-globals": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz",
+ "integrity": "sha512-uWttZCk96+7itPxK8xCzY86PnxKTMrReKDqrHzv42VQY0K30PUO8WY13WMOuI+cOdX4EIdzdvQ8k6jkuGRFMYw==",
+ "license": "MIT",
+ "dependencies": {
+ "acorn": "^4.0.4"
+ }
+ },
+ "node_modules/aes-js": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz",
+ "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==",
+ "license": "MIT"
+ },
+ "node_modules/align-text": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
+ "integrity": "sha512-GrTZLRpmp6wIC2ztrWW9MjjTgSKccffgFagbNDOX95/dcjEcYZibYTeaOntySQLcdw1ztBoFkviiUvTMbb9MYg==",
+ "license": "MIT",
+ "dependencies": {
+ "kind-of": "^3.0.2",
+ "longest": "^1.0.1",
+ "repeat-string": "^1.5.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "license": "Python-2.0",
+ "optional": true
+ },
+ "node_modules/array-flatten": {
+ "version": "1.1.1",
+ "license": "MIT"
+ },
+ "node_modules/asap": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
+ "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==",
+ "license": "MIT"
+ },
+ "node_modules/asn1js": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.7.tgz",
+ "integrity": "sha512-uLvq6KJu04qoQM6gvBfKFjlh6Gl0vOKQuR5cJMDHQkmwfMOQeN3F3SHCv9SNYSL+CRoHvOGFfllDlVz03GQjvQ==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "pvtsutils": "^1.3.6",
+ "pvutils": "^1.1.3",
+ "tslib": "^2.8.1"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/ast-types": {
+ "version": "0.14.2",
+ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.14.2.tgz",
+ "integrity": "sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA==",
+ "license": "MIT",
+ "dependencies": {
+ "tslib": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/async": {
+ "version": "0.2.10",
+ "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz",
+ "integrity": "sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ=="
+ },
+ "node_modules/atomic-sleep": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/available-typed-arrays": {
+ "version": "1.0.7",
+ "license": "MIT",
+ "dependencies": {
+ "possible-typed-array-names": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/awaitqueue": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/awaitqueue/-/awaitqueue-2.4.0.tgz",
+ "integrity": "sha512-9nTnPxVuxiuKFTHslm9ltnekUECJidOQ5kE6JpZUH77KrKqStQuWUW7JPB2GJZ7rOwWLcbToHiIXle/nJe1VpQ==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/axios": {
+ "version": "0.26.1",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
+ "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
+ "license": "MIT",
+ "dependencies": {
+ "follow-redirects": "^1.14.8"
+ }
+ },
+ "node_modules/babel-runtime": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
+ "integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==",
+ "license": "MIT",
+ "dependencies": {
+ "core-js": "^2.4.0",
+ "regenerator-runtime": "^0.11.0"
+ }
+ },
+ "node_modules/babel-types": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz",
+ "integrity": "sha512-zhe3V/26rCWsEZK8kZN+HaQj5yQ1CilTObixFzKW1UWjqG7618Twz6YEsCnjfg5gBcJh02DrpCkS9h98ZqDY+g==",
+ "license": "MIT",
+ "dependencies": {
+ "babel-runtime": "^6.26.0",
+ "esutils": "^2.0.2",
+ "lodash": "^4.17.4",
+ "to-fast-properties": "^1.0.3"
+ }
+ },
+ "node_modules/babylon": {
+ "version": "6.18.0",
+ "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
+ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==",
+ "license": "MIT",
+ "bin": {
+ "babylon": "bin/babylon.js"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "license": "MIT"
+ },
+ "node_modules/baseline-browser-mapping": {
+ "version": "2.10.12",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.12.tgz",
+ "integrity": "sha512-qyq26DxfY4awP2gIRXhhLWfwzwI+N5Nxk6iQi8EFizIaWIjqicQTE4sLnZZVdeKPRcVNoJOkkpfzoIYuvCKaIQ==",
+ "license": "Apache-2.0",
+ "bin": {
+ "baseline-browser-mapping": "dist/cli.cjs"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/better-docs": {
+ "version": "2.7.3",
+ "resolved": "https://registry.npmjs.org/better-docs/-/better-docs-2.7.3.tgz",
+ "integrity": "sha512-OEk9e7RQUQbo1DmVo0mdsALZ+mT0SwIen7/DGnN4xKNktXKgz1j7+KQ2pObNHHVSFGu8YMQW/Ig1v6eiTkdnbw==",
+ "license": "MIT",
+ "dependencies": {
+ "brace": "^0.11.1",
+ "react-ace": "^9.5.0",
+ "react-docgen": "^5.4.0",
+ "react-frame-component": "^5.2.1",
+ "typescript": "^4.5.4",
+ "underscore": "^1.13.2",
+ "vue-docgen-api": "^3.26.0",
+ "vue2-ace-editor": "^0.0.15"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "peerDependencies": {
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2"
+ }
+ },
+ "node_modules/big-integer": {
+ "version": "1.6.52",
+ "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz",
+ "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==",
+ "license": "Unlicense",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/bignumber.js": {
+ "version": "9.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/binary-data": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/binary-data/-/binary-data-0.6.0.tgz",
+ "integrity": "sha512-HGiT0ir03tS1u7iWdW5xjJfbPpvxH2qJbPFxXW0I3P5iOzkbjN/cJy5GlpAwmjHW5CiayGOxZ/ytLzXmYgdgqQ==",
+ "license": "MIT",
+ "dependencies": {
+ "generate-function": "^2.3.1",
+ "is-plain-object": "^2.0.3"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/bn.js": {
+ "version": "4.12.3",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.3.tgz",
+ "integrity": "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g==",
+ "license": "MIT"
+ },
+ "node_modules/body-parser": {
+ "version": "1.20.4",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "content-type": "~1.0.5",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "~1.2.0",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "on-finished": "~2.4.1",
+ "qs": "~6.14.0",
+ "raw-body": "~2.5.3",
+ "type-is": "~1.6.18",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/boolbase": {
+ "version": "1.0.0",
+ "license": "ISC"
+ },
+ "node_modules/bowser": {
+ "version": "2.14.1",
+ "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.14.1.tgz",
+ "integrity": "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg==",
+ "license": "MIT"
+ },
+ "node_modules/brace": {
+ "version": "0.11.1",
+ "resolved": "https://registry.npmjs.org/brace/-/brace-0.11.1.tgz",
+ "integrity": "sha512-Fc8Ne62jJlKHiG/ajlonC4Sd66Pq68fFwK4ihJGNZpGqboc324SQk+lRvMzpPRuJOmfrJefdG8/7JdWX4bzJ2Q==",
+ "license": "MIT"
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.13",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz",
+ "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==",
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/brorand": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
+ "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==",
+ "license": "MIT"
+ },
+ "node_modules/browserslist": {
+ "version": "4.28.1",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",
+ "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==",
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "baseline-browser-mapping": "^2.9.0",
+ "caniuse-lite": "^1.0.30001759",
+ "electron-to-chromium": "^1.5.263",
+ "node-releases": "^2.0.27",
+ "update-browserslist-db": "^1.2.0"
+ },
+ "bin": {
+ "browserslist": "cli.js"
+ },
+ "engines": {
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ }
+ },
+ "node_modules/buffer-alloc": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
+ "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-alloc-unsafe": "^1.1.0",
+ "buffer-fill": "^1.0.0"
+ }
+ },
+ "node_modules/buffer-alloc-unsafe": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
+ "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==",
+ "license": "MIT"
+ },
+ "node_modules/buffer-crc32": {
+ "version": "0.2.13",
+ "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
+ "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
+ "license": "MIT",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/buffer-fill": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
+ "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==",
+ "license": "MIT"
+ },
+ "node_modules/buffer-from": {
+ "version": "1.1.2",
+ "license": "MIT"
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/c8": {
+ "version": "7.14.0",
+ "resolved": "https://registry.npmjs.org/c8/-/c8-7.14.0.tgz",
+ "integrity": "sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw==",
+ "license": "ISC",
+ "dependencies": {
+ "@bcoe/v8-coverage": "^0.2.3",
+ "@istanbuljs/schema": "^0.1.3",
+ "find-up": "^5.0.0",
+ "foreground-child": "^2.0.0",
+ "istanbul-lib-coverage": "^3.2.0",
+ "istanbul-lib-report": "^3.0.0",
+ "istanbul-reports": "^3.1.4",
+ "rimraf": "^3.0.2",
+ "test-exclude": "^6.0.0",
+ "v8-to-istanbul": "^9.0.0",
+ "yargs": "^16.2.0",
+ "yargs-parser": "^20.2.9"
+ },
+ "bin": {
+ "c8": "bin/c8.js"
+ },
+ "engines": {
+ "node": ">=10.12.0"
+ }
+ },
+ "node_modules/call-bind": {
+ "version": "1.0.8",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.0",
+ "es-define-property": "^1.0.0",
+ "get-intrinsic": "^1.2.4",
+ "set-function-length": "^1.2.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/camelcase": {
+ "version": "8.0.0",
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/camelcase-keys": {
+ "version": "9.1.3",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "camelcase": "^8.0.0",
+ "map-obj": "5.0.0",
+ "quick-lru": "^6.1.1",
+ "type-fest": "^4.3.2"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001781",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001781.tgz",
+ "integrity": "sha512-RdwNCyMsNBftLjW6w01z8bKEvT6e/5tpPVEgtn22TiLGlstHOVecsX2KHFkD5e/vRnIE4EGzpuIODb3mtswtkw==",
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "CC-BY-4.0"
+ },
+ "node_modules/caseless": {
+ "version": "0.12.0",
+ "license": "Apache-2.0"
+ },
+ "node_modules/center-align": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
+ "integrity": "sha512-Baz3aNe2gd2LP2qk5U+sDk/m4oSuwSDcBfayTCTBoWpfIGO5XFxPmjILQII4NGiZjD6DoDI6kf7gKaxkf7s3VQ==",
+ "license": "MIT",
+ "dependencies": {
+ "align-text": "^0.1.3",
+ "lazy-cache": "^1.0.3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/character-parser": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz",
+ "integrity": "sha512-+UqJQjFEFaTAs3bNsF2j2kEN1baG/zghZbdqoYEDxGZtJo9LBzl1A+m0D4n3qKx8N2FNv8/Xp6yV9mQmBuptaw==",
+ "license": "MIT",
+ "dependencies": {
+ "is-regex": "^1.0.3"
+ }
+ },
+ "node_modules/clean-css": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz",
+ "integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==",
+ "license": "MIT",
+ "dependencies": {
+ "source-map": "~0.6.0"
+ },
+ "engines": {
+ "node": ">= 4.0"
+ }
+ },
+ "node_modules/cliui": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^7.0.0"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "license": "MIT"
+ },
+ "node_modules/colorette": {
+ "version": "2.0.20",
+ "license": "MIT"
+ },
+ "node_modules/commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "license": "MIT"
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "license": "MIT"
+ },
+ "node_modules/concat-stream": {
+ "version": "2.0.0",
+ "engines": [
+ "node >= 6.0"
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.0.2",
+ "typedarray": "^0.0.6"
+ }
+ },
+ "node_modules/constantinople": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/constantinople/-/constantinople-3.1.2.tgz",
+ "integrity": "sha512-yePcBqEFhLOqSBtwYOGGS1exHo/s1xjekXiinh4itpNQGCu4KA1euPh1fg07N2wMITZXQkBz75Ntdt1ctGZouw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/babel-types": "^7.0.0",
+ "@types/babylon": "^6.16.2",
+ "babel-types": "^6.26.0",
+ "babylon": "^6.18.0"
+ }
+ },
+ "node_modules/content-disposition": {
+ "version": "0.5.4",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "5.2.1"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
+ "license": "MIT"
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.0.6",
+ "license": "MIT"
+ },
+ "node_modules/core-js": {
+ "version": "2.6.12",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
+ "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==",
+ "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.",
+ "hasInstallScript": true,
+ "license": "MIT"
+ },
+ "node_modules/core-util-is": {
+ "version": "1.0.3",
+ "license": "MIT"
+ },
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/cross-spawn/node_modules/which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/css-select": {
+ "version": "5.2.2",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "boolbase": "^1.0.0",
+ "css-what": "^6.1.0",
+ "domhandler": "^5.0.2",
+ "domutils": "^3.0.1",
+ "nth-check": "^2.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/fb55"
+ }
+ },
+ "node_modules/css-what": {
+ "version": "6.2.2",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">= 6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/fb55"
+ }
+ },
+ "node_modules/date-fns": {
+ "version": "2.30.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
+ "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.21.0"
+ },
+ "engines": {
+ "node": ">=0.11"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/date-fns"
+ }
+ },
+ "node_modules/dateformat": {
+ "version": "4.6.3",
+ "license": "MIT",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/de-indent": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
+ "integrity": "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==",
+ "license": "MIT"
+ },
+ "node_modules/debug": {
+ "version": "2.6.9",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/define-data-property": {
+ "version": "1.1.4",
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/destroy": {
+ "version": "1.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/diff-match-patch": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz",
+ "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/doctrine": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
+ "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "esutils": "^2.0.2"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/doctypes": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/doctypes/-/doctypes-1.1.0.tgz",
+ "integrity": "sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ==",
+ "license": "MIT"
+ },
+ "node_modules/dom-serializer": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.2",
+ "entities": "^4.2.0"
+ },
+ "funding": {
+ "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
+ }
+ },
+ "node_modules/domelementtype": {
+ "version": "2.3.0",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fb55"
+ }
+ ],
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/domhandler": {
+ "version": "5.0.3",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "domelementtype": "^2.3.0"
+ },
+ "engines": {
+ "node": ">= 4"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/domhandler?sponsor=1"
+ }
+ },
+ "node_modules/domutils": {
+ "version": "3.2.2",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "dom-serializer": "^2.0.0",
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.3"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/domutils?sponsor=1"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "license": "MIT"
+ },
+ "node_modules/electron-to-chromium": {
+ "version": "1.5.328",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.328.tgz",
+ "integrity": "sha512-QNQ5l45DzYytThO21403XN3FvK0hOkWDG8viNf6jqS42msJ8I4tGDSpBCgvDRRPnkffafiwAym2X2eHeGD2V0w==",
+ "license": "ISC"
+ },
+ "node_modules/elliptic": {
+ "version": "6.6.1",
+ "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz",
+ "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==",
+ "license": "MIT",
+ "dependencies": {
+ "bn.js": "^4.11.9",
+ "brorand": "^1.1.0",
+ "hash.js": "^1.0.0",
+ "hmac-drbg": "^1.0.1",
+ "inherits": "^2.0.4",
+ "minimalistic-assert": "^1.0.1",
+ "minimalistic-crypto-utils": "^1.0.1"
+ }
+ },
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "license": "MIT"
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/end-of-stream": {
+ "version": "1.4.5",
+ "license": "MIT",
+ "dependencies": {
+ "once": "^1.4.0"
+ }
+ },
+ "node_modules/entities": {
+ "version": "4.5.0",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
+ "node_modules/env-paths": {
+ "version": "2.2.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.1",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/escalade": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "license": "MIT"
+ },
+ "node_modules/esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "license": "BSD-2-Clause",
+ "bin": {
+ "esparse": "bin/esparse.js",
+ "esvalidate": "bin/esvalidate.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/estree-to-babel": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/estree-to-babel/-/estree-to-babel-3.2.1.tgz",
+ "integrity": "sha512-YNF+mZ/Wu2FU/gvmzuWtYc8rloubL7wfXCTgouFrnjGVXPA/EeYYA7pupXWrb3Iv1cTBeSSxxJIbK23l4MRNqg==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.1.6",
+ "@babel/types": "^7.2.0",
+ "c8": "^7.6.0"
+ },
+ "engines": {
+ "node": ">=8.3.0"
+ }
+ },
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/event-target-shim": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-6.0.2.tgz",
+ "integrity": "sha512-8q3LsZjRezbFZ2PN+uP+Q7pnHUMmAOziU2vA2OwoFaKIXxlxl38IylhSSgUorWu/rf4er67w0ikBqjBFk/pomA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.13.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ }
+ },
+ "node_modules/events": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
+ "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.8.x"
+ }
+ },
+ "node_modules/express": {
+ "version": "4.22.1",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "~1.3.8",
+ "array-flatten": "1.1.1",
+ "body-parser": "~1.20.3",
+ "content-disposition": "~0.5.4",
+ "content-type": "~1.0.4",
+ "cookie": "~0.7.1",
+ "cookie-signature": "~1.0.6",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "finalhandler": "~1.3.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.0",
+ "merge-descriptors": "1.0.3",
+ "methods": "~1.1.2",
+ "on-finished": "~2.4.1",
+ "parseurl": "~1.3.3",
+ "path-to-regexp": "~0.1.12",
+ "proxy-addr": "~2.0.7",
+ "qs": "~6.14.0",
+ "range-parser": "~1.2.1",
+ "safe-buffer": "5.2.1",
+ "send": "~0.19.0",
+ "serve-static": "~1.16.2",
+ "setprototypeof": "1.2.0",
+ "statuses": "~2.0.1",
+ "type-is": "~1.6.18",
+ "utils-merge": "1.0.1",
+ "vary": "~1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/fake-mediastreamtrack": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/fake-mediastreamtrack/-/fake-mediastreamtrack-1.2.0.tgz",
+ "integrity": "sha512-AxHtlEmka1sqNoe3Ej1H1hJc9gjjO/6vCbCPm4D4QeEXvzhjYumA+iZ7wOi2WrmkAhGElHhBgWoNgJhFccectA==",
+ "license": "ISC",
+ "dependencies": {
+ "event-target-shim": "^6.0.2",
+ "uuid": "^9.0.0"
+ }
+ },
+ "node_modules/fast-copy": {
+ "version": "4.0.2",
+ "license": "MIT"
+ },
+ "node_modules/fast-safe-stringify": {
+ "version": "2.1.1",
+ "license": "MIT"
+ },
+ "node_modules/ffmpeg-static": {
+ "version": "5.3.0",
+ "hasInstallScript": true,
+ "license": "GPL-3.0-or-later",
+ "dependencies": {
+ "@derhuerst/http-basic": "^8.2.0",
+ "env-paths": "^2.2.0",
+ "https-proxy-agent": "^5.0.0",
+ "progress": "^2.0.3"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/ffmpeg-static/node_modules/agent-base": {
+ "version": "6.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 6.0.0"
+ }
+ },
+ "node_modules/ffmpeg-static/node_modules/debug": {
+ "version": "4.4.3",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ffmpeg-static/node_modules/https-proxy-agent": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "6",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/ffmpeg-static/node_modules/ms": {
+ "version": "2.1.3",
+ "license": "MIT"
+ },
+ "node_modules/ffprobe-static": {
+ "version": "3.1.0",
+ "license": "MIT"
+ },
+ "node_modules/file-type": {
+ "version": "21.3.4",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-21.3.4.tgz",
+ "integrity": "sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g==",
+ "license": "MIT",
+ "dependencies": {
+ "@tokenizer/inflate": "^0.4.1",
+ "strtok3": "^10.3.4",
+ "token-types": "^6.1.1",
+ "uint8array-extras": "^1.4.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/file-type?sponsor=1"
+ }
+ },
+ "node_modules/finalhandler": {
+ "version": "1.3.2",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.4.1",
+ "parseurl": "~1.3.3",
+ "statuses": "~2.0.2",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/fluent-ffmpeg": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.3.tgz",
+ "integrity": "sha512-Be3narBNt2s6bsaqP6Jzq91heDgOEaDCJAXcE3qcma/EJBSy5FB4cvO31XBInuAuKBx8Kptf8dkhjK0IOru39Q==",
+ "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
+ "license": "MIT",
+ "dependencies": {
+ "async": "^0.2.9",
+ "which": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/follow-redirects": {
+ "version": "1.15.11",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/for-each": {
+ "version": "0.3.5",
+ "license": "MIT",
+ "dependencies": {
+ "is-callable": "^1.2.7"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/foreground-child": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz",
+ "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==",
+ "license": "ISC",
+ "dependencies": {
+ "cross-spawn": "^7.0.0",
+ "signal-exit": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "0.5.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
+ "license": "ISC"
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/generate-function": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
+ "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "is-property": "^1.0.2"
+ }
+ },
+ "node_modules/generator-function": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/genius-lyrics": {
+ "version": "4.4.7",
+ "license": "MIT",
+ "dependencies": {
+ "node-html-parser": "^6.1.13",
+ "undici": "^6.11.1"
+ }
+ },
+ "node_modules/genius-lyrics/node_modules/undici": {
+ "version": "6.24.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.17"
+ }
+ },
+ "node_modules/gensync": {
+ "version": "1.0.0-beta.2",
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "license": "ISC",
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/glob": {
+ "version": "7.2.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
+ "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
+ "license": "ISC",
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.1.1",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/globalyzer": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
+ "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==",
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/globrex": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
+ "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/h264-profile-level-id": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/h264-profile-level-id/-/h264-profile-level-id-1.1.1.tgz",
+ "integrity": "sha512-xOEl3xKpiRrKIqSfolN+9gDdjR8aktKeB92CHIJohz8KtLF0Mceshgfi9pOyUhCpZmQzzwxGMSSxQvHTgGzrGw==",
+ "license": "ISC",
+ "dependencies": {
+ "debug": "^4.3.4"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/h264-profile-level-id/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/h264-profile-level-id/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/has-property-descriptors": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-tostringtag": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "has-symbols": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hash-sum": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz",
+ "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
+ "license": "MIT"
+ },
+ "node_modules/hash.js": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
+ "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
+ "license": "MIT",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "minimalistic-assert": "^1.0.1"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/he": {
+ "version": "1.2.0",
+ "license": "MIT",
+ "bin": {
+ "he": "bin/he"
+ }
+ },
+ "node_modules/help-me": {
+ "version": "5.0.0",
+ "license": "MIT"
+ },
+ "node_modules/hmac-drbg": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
+ "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==",
+ "license": "MIT",
+ "dependencies": {
+ "hash.js": "^1.0.3",
+ "minimalistic-assert": "^1.0.0",
+ "minimalistic-crypto-utils": "^1.0.1"
+ }
+ },
+ "node_modules/html-escaper": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
+ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
+ "license": "MIT"
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "~2.0.0",
+ "inherits": "~2.0.4",
+ "setprototypeof": "~1.2.0",
+ "statuses": "~2.0.2",
+ "toidentifier": "~1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/http-response-object": {
+ "version": "3.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "^10.0.3"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.4.24",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
+ "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
+ "license": "ISC",
+ "dependencies": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "license": "ISC"
+ },
+ "node_modules/int64-buffer": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/int64-buffer/-/int64-buffer-1.1.0.tgz",
+ "integrity": "sha512-94smTCQOvigN4d/2R/YDjz8YVG0Sufvv2aAh8P5m42gwhCsDAJqnbNOrxJsrADuAFAA69Q/ptGzxvNcNuIJcvw==",
+ "license": "MIT"
+ },
+ "node_modules/ip": {
+ "version": "1.1.9",
+ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz",
+ "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==",
+ "license": "MIT"
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/is-arguments": {
+ "version": "1.2.0",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "has-tostringtag": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
+ "license": "MIT"
+ },
+ "node_modules/is-callable": {
+ "version": "1.2.7",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-core-module": {
+ "version": "2.16.1",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz",
+ "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==",
+ "license": "MIT",
+ "dependencies": {
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-expression": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-expression/-/is-expression-3.0.0.tgz",
+ "integrity": "sha512-vyMeQMq+AiH5uUnoBfMTwf18tO3bM6k1QXBE9D6ueAAquEfCZe3AJPtud9g6qS0+4X8xA7ndpZiDyeb2l2qOBw==",
+ "license": "MIT",
+ "dependencies": {
+ "acorn": "~4.0.2",
+ "object-assign": "^4.0.1"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-generator-function": {
+ "version": "1.1.2",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.4",
+ "generator-function": "^2.0.0",
+ "get-proto": "^1.0.1",
+ "has-tostringtag": "^1.0.2",
+ "safe-regex-test": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-plain-object": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
+ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
+ "license": "MIT",
+ "dependencies": {
+ "isobject": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-promise": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
+ "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==",
+ "license": "MIT"
+ },
+ "node_modules/is-property": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
+ "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==",
+ "license": "MIT"
+ },
+ "node_modules/is-regex": {
+ "version": "1.2.1",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "gopd": "^1.2.0",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-typed-array": {
+ "version": "1.1.15",
+ "license": "MIT",
+ "dependencies": {
+ "which-typed-array": "^1.1.16"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/isarray": {
+ "version": "1.0.0",
+ "license": "MIT"
+ },
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+ "license": "ISC"
+ },
+ "node_modules/isobject": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/istanbul-lib-coverage": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz",
+ "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-lib-report": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz",
+ "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "istanbul-lib-coverage": "^3.0.0",
+ "make-dir": "^4.0.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/istanbul-lib-report/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-reports": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz",
+ "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "html-escaper": "^2.0.0",
+ "istanbul-lib-report": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/jose": {
+ "version": "5.10.0",
+ "license": "MIT",
+ "optional": true,
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
+ "node_modules/joycon": {
+ "version": "3.1.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/js-stringify": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz",
+ "integrity": "sha512-rtS5ATOo2Q5k1G+DADISilDA6lv79zIiwFd6CcjuIxGKLFm5C+RLImRscVap9k55i+MOZwgliw+NejvkLuGD5g==",
+ "license": "MIT"
+ },
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "license": "MIT"
+ },
+ "node_modules/js-yaml": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
+ "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/jsesc": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
+ "license": "MIT",
+ "bin": {
+ "jsesc": "bin/jsesc"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/json5": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
+ "license": "MIT",
+ "bin": {
+ "json5": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/jspack": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/jspack/-/jspack-0.0.4.tgz",
+ "integrity": "sha512-DC/lSTXYDDdYWzyY/9A1kMzp6Ov9mCRhZQ1cGg4te2w3y4/aKZTSspvbYN4LUsvSzMCb/H8z4TV9mYYW/bs3PQ=="
+ },
+ "node_modules/jstransformer": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz",
+ "integrity": "sha512-C9YK3Rf8q6VAPDCCU9fnqo3mAfOH6vUGnMcP4AQAYIEpWtfGLpwOTmZ+igtdK5y+VvI2n3CyYSzy4Qh34eq24A==",
+ "license": "MIT",
+ "dependencies": {
+ "is-promise": "^2.0.0",
+ "promise": "^7.0.1"
+ }
+ },
+ "node_modules/kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==",
+ "license": "MIT",
+ "dependencies": {
+ "is-buffer": "^1.1.5"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/lazy-cache": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz",
+ "integrity": "sha512-RE2g0b5VGZsOCFOCgP7omTRYFqydmZkBwl5oNnQ1lDYC57uyO9KqNnNVxT7COSHTxrRCWVcAVOcbjk+tvh/rgQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/livekit-server-sdk": {
+ "version": "2.15.0",
+ "license": "Apache-2.0",
+ "optional": true,
+ "dependencies": {
+ "@bufbuild/protobuf": "^1.10.1",
+ "@livekit/protocol": "^1.43.1",
+ "camelcase-keys": "^9.0.0",
+ "jose": "^5.1.2"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/lodash": {
+ "version": "4.17.23",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
+ "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.defaultsdeep": {
+ "version": "4.6.1",
+ "resolved": "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz",
+ "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.get": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
+ "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",
+ "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead.",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isequal": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
+ "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
+ "deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.",
+ "license": "MIT"
+ },
+ "node_modules/lodash.memoize": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
+ "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==",
+ "license": "MIT"
+ },
+ "node_modules/longest": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
+ "integrity": "sha512-k+yt5n3l48JU4k8ftnKG6V7u32wyH2NfKzeMto9F/QRE0amxy/LayxwlvjjkZEIzqR+19IrtFO8p5kB9QaYUFg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "license": "MIT",
+ "dependencies": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ },
+ "bin": {
+ "loose-envify": "cli.js"
+ }
+ },
+ "node_modules/lru-cache": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^3.0.2"
+ }
+ },
+ "node_modules/make-dir": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
+ "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==",
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/make-dir/node_modules/semver": {
+ "version": "7.7.4",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
+ "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/map-obj": {
+ "version": "5.0.0",
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "0.3.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "1.0.3",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/methods": {
+ "version": "1.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime": {
+ "version": "1.6.0",
+ "license": "MIT",
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/min-indent": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
+ "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/minimalistic-assert": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
+ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==",
+ "license": "ISC"
+ },
+ "node_modules/minimalistic-crypto-utils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
+ "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==",
+ "license": "MIT"
+ },
+ "node_modules/minimatch": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.8",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/moonlink.js": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/moonlink.js/-/moonlink.js-5.2.0.tgz",
+ "integrity": "sha512-xVtMQiBNqFAp3gzTt6V4FgS9UuouwU8mEXelRZwdNLoom+DEAA6zYXqI9fgnIkl/JZxDmzovPVYto/tb02exgQ==",
+ "license": "Open Software License 3.0",
+ "engines": {
+ "node": ">=22.x.x"
+ }
+ },
+ "node_modules/mp4box": {
+ "version": "0.5.4",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/ms": {
+ "version": "2.0.0",
+ "license": "MIT"
+ },
+ "node_modules/msc-node": {
+ "version": "0.0.26",
+ "resolved": "https://registry.npmjs.org/msc-node/-/msc-node-0.0.26.tgz",
+ "integrity": "sha512-g9xFOyIREIUR+ug6s1o/9L7KL61TccsfOiLlWU5lH6LM9PGKjN69dbFf+gUhq/WV5V1XviRpLIAiyyJY/3PXWQ==",
+ "license": "ISC",
+ "dependencies": {
+ "@types/debug": "^4.1.10",
+ "awaitqueue": "^2.3.3",
+ "bowser": "^2.11.0",
+ "debug": "^4.3.4",
+ "events": "^3.3.0",
+ "fake-mediastreamtrack": "^1.2.0",
+ "h264-profile-level-id": "^1.0.1",
+ "queue-microtask": "^1.2.3",
+ "sdp-transform": "^2.14.1",
+ "supports-color": "^9.4.0",
+ "ua-parser-js": "^1.0.36",
+ "werift": "^0.18.17"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/msc-node/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/msc-node/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/music-metadata": {
+ "version": "11.12.3",
+ "resolved": "https://registry.npmjs.org/music-metadata/-/music-metadata-11.12.3.tgz",
+ "integrity": "sha512-n6hSTZkuD59qWgHh6IP5dtDlDZQXoxk/bcA85Jywg8Z1iFrlNgl2+GTFgjZyn52W5UgQpV42V4XqrQZZAMbZTQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ },
+ {
+ "type": "buymeacoffee",
+ "url": "https://buymeacoffee.com/borewit"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@borewit/text-codec": "^0.2.2",
+ "@tokenizer/token": "^0.3.0",
+ "content-type": "^1.0.5",
+ "debug": "^4.4.3",
+ "file-type": "^21.3.1",
+ "media-typer": "^1.1.0",
+ "strtok3": "^10.3.4",
+ "token-types": "^6.1.2",
+ "uint8array-extras": "^1.5.0",
+ "win-guid": "^0.2.1"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/music-metadata/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/music-metadata/node_modules/media-typer": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
+ "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/music-metadata/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/mysql": {
+ "version": "2.18.1",
+ "license": "MIT",
+ "dependencies": {
+ "bignumber.js": "9.0.0",
+ "readable-stream": "2.3.7",
+ "safe-buffer": "5.1.2",
+ "sqlstring": "2.3.1"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mysql/node_modules/readable-stream": {
+ "version": "2.3.7",
+ "license": "MIT",
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "node_modules/mysql/node_modules/safe-buffer": {
+ "version": "5.1.2",
+ "license": "MIT"
+ },
+ "node_modules/mysql/node_modules/string_decoder": {
+ "version": "1.1.1",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "node_modules/nano-time": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/nano-time/-/nano-time-1.0.0.tgz",
+ "integrity": "sha512-flnngywOoQ0lLQOTRNexn2gGSNuM9bKj9RZAWSzhQ+UJYaAFG9bac4DW9VHjUAzrOaIcajHybCTHe/bkvozQqA==",
+ "license": "ISC",
+ "dependencies": {
+ "big-integer": "^1.6.16"
+ }
+ },
+ "node_modules/negotiator": {
+ "version": "0.6.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/neo-async": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
+ "license": "MIT"
+ },
+ "node_modules/node-dir": {
+ "version": "0.1.17",
+ "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz",
+ "integrity": "sha512-tmPX422rYgofd4epzrNoOXiE8XFZYOcCq1vD7MAXCDO+O+zndlA2ztdKKMa+EeuBG5tHETpr4ml4RGgpqDCCAg==",
+ "license": "MIT",
+ "dependencies": {
+ "minimatch": "^3.0.2"
+ },
+ "engines": {
+ "node": ">= 0.10.5"
+ }
+ },
+ "node_modules/node-gyp-build": {
+ "version": "4.8.4",
+ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",
+ "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",
+ "license": "MIT",
+ "optional": true,
+ "bin": {
+ "node-gyp-build": "bin.js",
+ "node-gyp-build-optional": "optional.js",
+ "node-gyp-build-test": "build-test.js"
+ }
+ },
+ "node_modules/node-html-parser": {
+ "version": "6.1.13",
+ "license": "MIT",
+ "dependencies": {
+ "css-select": "^5.1.0",
+ "he": "1.2.0"
+ }
+ },
+ "node_modules/node-releases": {
+ "version": "2.0.36",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.36.tgz",
+ "integrity": "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==",
+ "license": "MIT"
+ },
+ "node_modules/node-webcodecs": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/node-webcodecs/-/node-webcodecs-1.0.0.tgz",
+ "integrity": "sha512-pXXjotgVIXv0XpLvFZrNwFMnggPiNNKTtHJfxf8fhJcOPK/kgpOiMc9cQBIPVnnJVOarH4BhXJfJMHPSqbuXnQ==",
+ "cpu": [
+ "x64",
+ "arm64"
+ ],
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin",
+ "linux",
+ "win32"
+ ],
+ "dependencies": {
+ "node-addon-api": "^7.0.0",
+ "node-gyp-build": "^4.8.4"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/node-webcodecs/node_modules/node-addon-api": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
+ "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/nth-check": {
+ "version": "2.1.1",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "boolbase": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/nth-check?sponsor=1"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/on-exit-leak-free": {
+ "version": "2.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.1",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "license": "ISC",
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/openapi-typescript": {
+ "version": "5.4.2",
+ "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-5.4.2.tgz",
+ "integrity": "sha512-tHeRv39Yh7brqJpbUntdjtUaXrTHmC4saoyTLU/0J2I8LEFQYDXRLgnmWTMiMOB2GXugJiqHa5n9sAyd6BRqiA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "js-yaml": "^4.1.0",
+ "mime": "^3.0.0",
+ "prettier": "^2.6.2",
+ "tiny-glob": "^0.2.9",
+ "undici": "^5.4.0",
+ "yargs-parser": "^21.0.1"
+ },
+ "bin": {
+ "openapi-typescript": "bin/cli.js"
+ },
+ "engines": {
+ "node": ">= 14.0.0"
+ }
+ },
+ "node_modules/openapi-typescript/node_modules/mime": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
+ "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
+ "license": "MIT",
+ "optional": true,
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/openapi-typescript/node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "license": "ISC",
+ "optional": true,
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/opus-decoder": {
+ "version": "0.7.11",
+ "license": "MIT",
+ "dependencies": {
+ "@wasm-audio-decoders/common": "9.0.7"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/eshaz"
+ }
+ },
+ "node_modules/p-cancelable": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz",
+ "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "license": "MIT",
+ "dependencies": {
+ "yocto-queue": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/parse-cache-control": {
+ "version": "1.0.1"
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
+ "license": "MIT"
+ },
+ "node_modules/path-to-regexp": {
+ "version": "0.1.12",
+ "license": "MIT"
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "license": "ISC"
+ },
+ "node_modules/pino": {
+ "version": "9.14.0",
+ "license": "MIT",
+ "dependencies": {
+ "@pinojs/redact": "^0.4.0",
+ "atomic-sleep": "^1.0.0",
+ "on-exit-leak-free": "^2.1.0",
+ "pino-abstract-transport": "^2.0.0",
+ "pino-std-serializers": "^7.0.0",
+ "process-warning": "^5.0.0",
+ "quick-format-unescaped": "^4.0.3",
+ "real-require": "^0.2.0",
+ "safe-stable-stringify": "^2.3.1",
+ "sonic-boom": "^4.0.1",
+ "thread-stream": "^3.0.0"
+ },
+ "bin": {
+ "pino": "bin.js"
+ }
+ },
+ "node_modules/pino-abstract-transport": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "split2": "^4.0.0"
+ }
+ },
+ "node_modules/pino-pretty": {
+ "version": "13.1.3",
+ "license": "MIT",
+ "dependencies": {
+ "colorette": "^2.0.7",
+ "dateformat": "^4.6.3",
+ "fast-copy": "^4.0.0",
+ "fast-safe-stringify": "^2.1.1",
+ "help-me": "^5.0.0",
+ "joycon": "^3.1.1",
+ "minimist": "^1.2.6",
+ "on-exit-leak-free": "^2.1.0",
+ "pino-abstract-transport": "^3.0.0",
+ "pump": "^3.0.0",
+ "secure-json-parse": "^4.0.0",
+ "sonic-boom": "^4.0.1",
+ "strip-json-comments": "^5.0.2"
+ },
+ "bin": {
+ "pino-pretty": "bin.js"
+ }
+ },
+ "node_modules/pino-pretty/node_modules/pino-abstract-transport": {
+ "version": "3.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "split2": "^4.0.0"
+ }
+ },
+ "node_modules/pino-std-serializers": {
+ "version": "7.1.0",
+ "license": "MIT"
+ },
+ "node_modules/possible-typed-array-names": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/prettier": {
+ "version": "2.8.8",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
+ "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
+ "license": "MIT",
+ "optional": true,
+ "bin": {
+ "prettier": "bin-prettier.js"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
+ "node_modules/prism-media": {
+ "version": "1.3.5",
+ "license": "Apache-2.0",
+ "peerDependencies": {
+ "@discordjs/opus": ">=0.8.0 <1.0.0",
+ "ffmpeg-static": "^5.0.2 || ^4.2.7 || ^3.0.0 || ^2.4.0",
+ "node-opus": "^0.3.3",
+ "opusscript": "^0.0.8"
+ },
+ "peerDependenciesMeta": {
+ "@discordjs/opus": {
+ "optional": true
+ },
+ "ffmpeg-static": {
+ "optional": true
+ },
+ "node-opus": {
+ "optional": true
+ },
+ "opusscript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/private": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
+ "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/process-nextick-args": {
+ "version": "2.0.1",
+ "license": "MIT"
+ },
+ "node_modules/process-warning": {
+ "version": "5.0.0",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/progress": {
+ "version": "2.0.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/promise": {
+ "version": "7.3.1",
+ "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
+ "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==",
+ "license": "MIT",
+ "dependencies": {
+ "asap": "~2.0.3"
+ }
+ },
+ "node_modules/prop-types": {
+ "version": "15.8.1",
+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
+ "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
+ "license": "MIT",
+ "dependencies": {
+ "loose-envify": "^1.4.0",
+ "object-assign": "^4.1.1",
+ "react-is": "^16.13.1"
+ }
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.7",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/pseudomap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
+ "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==",
+ "license": "ISC"
+ },
+ "node_modules/pug": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/pug/-/pug-2.0.4.tgz",
+ "integrity": "sha512-XhoaDlvi6NIzL49nu094R2NA6P37ijtgMDuWE+ofekDChvfKnzFal60bhSdiy8y2PBO6fmz3oMEIcfpBVRUdvw==",
+ "license": "MIT",
+ "dependencies": {
+ "pug-code-gen": "^2.0.2",
+ "pug-filters": "^3.1.1",
+ "pug-lexer": "^4.1.0",
+ "pug-linker": "^3.0.6",
+ "pug-load": "^2.0.12",
+ "pug-parser": "^5.0.1",
+ "pug-runtime": "^2.0.5",
+ "pug-strip-comments": "^1.0.4"
+ }
+ },
+ "node_modules/pug-attrs": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/pug-attrs/-/pug-attrs-2.0.4.tgz",
+ "integrity": "sha512-TaZ4Z2TWUPDJcV3wjU3RtUXMrd3kM4Wzjbe3EWnSsZPsJ3LDI0F3yCnf2/W7PPFF+edUFQ0HgDL1IoxSz5K8EQ==",
+ "license": "MIT",
+ "dependencies": {
+ "constantinople": "^3.0.1",
+ "js-stringify": "^1.0.1",
+ "pug-runtime": "^2.0.5"
+ }
+ },
+ "node_modules/pug-code-gen": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pug-code-gen/-/pug-code-gen-2.0.3.tgz",
+ "integrity": "sha512-r9sezXdDuZJfW9J91TN/2LFbiqDhmltTFmGpHTsGdrNGp3p4SxAjjXEfnuK2e4ywYsRIVP0NeLbSAMHUcaX1EA==",
+ "license": "MIT",
+ "dependencies": {
+ "constantinople": "^3.1.2",
+ "doctypes": "^1.1.0",
+ "js-stringify": "^1.0.1",
+ "pug-attrs": "^2.0.4",
+ "pug-error": "^1.3.3",
+ "pug-runtime": "^2.0.5",
+ "void-elements": "^2.0.1",
+ "with": "^5.0.0"
+ }
+ },
+ "node_modules/pug-error": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/pug-error/-/pug-error-1.3.3.tgz",
+ "integrity": "sha512-qE3YhESP2mRAWMFJgKdtT5D7ckThRScXRwkfo+Erqga7dyJdY3ZquspprMCj/9sJ2ijm5hXFWQE/A3l4poMWiQ==",
+ "license": "MIT"
+ },
+ "node_modules/pug-filters": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/pug-filters/-/pug-filters-3.1.1.tgz",
+ "integrity": "sha512-lFfjNyGEyVWC4BwX0WyvkoWLapI5xHSM3xZJFUhx4JM4XyyRdO8Aucc6pCygnqV2uSgJFaJWW3Ft1wCWSoQkQg==",
+ "license": "MIT",
+ "dependencies": {
+ "clean-css": "^4.1.11",
+ "constantinople": "^3.0.1",
+ "jstransformer": "1.0.0",
+ "pug-error": "^1.3.3",
+ "pug-walk": "^1.1.8",
+ "resolve": "^1.1.6",
+ "uglify-js": "^2.6.1"
+ }
+ },
+ "node_modules/pug-lexer": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/pug-lexer/-/pug-lexer-4.1.0.tgz",
+ "integrity": "sha512-i55yzEBtjm0mlplW4LoANq7k3S8gDdfC6+LThGEvsK4FuobcKfDAwt6V4jKPH9RtiE3a2Akfg5UpafZ1OksaPA==",
+ "license": "MIT",
+ "dependencies": {
+ "character-parser": "^2.1.1",
+ "is-expression": "^3.0.0",
+ "pug-error": "^1.3.3"
+ }
+ },
+ "node_modules/pug-linker": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/pug-linker/-/pug-linker-3.0.6.tgz",
+ "integrity": "sha512-bagfuHttfQOpANGy1Y6NJ+0mNb7dD2MswFG2ZKj22s8g0wVsojpRlqveEQHmgXXcfROB2RT6oqbPYr9EN2ZWzg==",
+ "license": "MIT",
+ "dependencies": {
+ "pug-error": "^1.3.3",
+ "pug-walk": "^1.1.8"
+ }
+ },
+ "node_modules/pug-load": {
+ "version": "2.0.12",
+ "resolved": "https://registry.npmjs.org/pug-load/-/pug-load-2.0.12.tgz",
+ "integrity": "sha512-UqpgGpyyXRYgJs/X60sE6SIf8UBsmcHYKNaOccyVLEuT6OPBIMo6xMPhoJnqtB3Q3BbO4Z3Bjz5qDsUWh4rXsg==",
+ "license": "MIT",
+ "dependencies": {
+ "object-assign": "^4.1.0",
+ "pug-walk": "^1.1.8"
+ }
+ },
+ "node_modules/pug-parser": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/pug-parser/-/pug-parser-5.0.1.tgz",
+ "integrity": "sha512-nGHqK+w07p5/PsPIyzkTQfzlYfuqoiGjaoqHv1LjOv2ZLXmGX1O+4Vcvps+P4LhxZ3drYSljjq4b+Naid126wA==",
+ "license": "MIT",
+ "dependencies": {
+ "pug-error": "^1.3.3",
+ "token-stream": "0.0.1"
+ }
+ },
+ "node_modules/pug-runtime": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/pug-runtime/-/pug-runtime-2.0.5.tgz",
+ "integrity": "sha512-P+rXKn9un4fQY77wtpcuFyvFaBww7/91f3jHa154qU26qFAnOe6SW1CbIDcxiG5lLK9HazYrMCCuDvNgDQNptw==",
+ "license": "MIT"
+ },
+ "node_modules/pug-strip-comments": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/pug-strip-comments/-/pug-strip-comments-1.0.4.tgz",
+ "integrity": "sha512-i5j/9CS4yFhSxHp5iKPHwigaig/VV9g+FgReLJWWHEHbvKsbqL0oP/K5ubuLco6Wu3Kan5p7u7qk8A4oLLh6vw==",
+ "license": "MIT",
+ "dependencies": {
+ "pug-error": "^1.3.3"
+ }
+ },
+ "node_modules/pug-walk": {
+ "version": "1.1.8",
+ "resolved": "https://registry.npmjs.org/pug-walk/-/pug-walk-1.1.8.tgz",
+ "integrity": "sha512-GMu3M5nUL3fju4/egXwZO0XLi6fW/K3T3VTgFQ14GxNi8btlxgT5qZL//JwZFm/2Fa64J/PNS8AZeys3wiMkVA==",
+ "license": "MIT"
+ },
+ "node_modules/pump": {
+ "version": "3.0.4",
+ "license": "MIT",
+ "dependencies": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "node_modules/pvtsutils": {
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.6.tgz",
+ "integrity": "sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==",
+ "license": "MIT",
+ "dependencies": {
+ "tslib": "^2.8.1"
+ }
+ },
+ "node_modules/pvutils": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.1.5.tgz",
+ "integrity": "sha512-KTqnxsgGiQ6ZAzZCVlJH5eOjSnvlyEgx1m8bkRJfOhmGRqfo5KLvmAlACQkrjEtOQ4B7wF9TdSLIs9O90MX9xA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=16.0.0"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.14.2",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "side-channel": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/queue-microtask": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/quick-format-unescaped": {
+ "version": "4.0.4",
+ "license": "MIT"
+ },
+ "node_modules/quick-lru": {
+ "version": "6.1.2",
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "2.5.3",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/react": {
+ "version": "17.0.2",
+ "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz",
+ "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==",
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-ace": {
+ "version": "9.5.0",
+ "resolved": "https://registry.npmjs.org/react-ace/-/react-ace-9.5.0.tgz",
+ "integrity": "sha512-4l5FgwGh6K7A0yWVMQlPIXDItM4Q9zzXRqOae8KkCl6MkOob7sC1CzHxZdOGvV+QioKWbX2p5HcdOVUv6cAdSg==",
+ "license": "MIT",
+ "dependencies": {
+ "ace-builds": "^1.4.13",
+ "diff-match-patch": "^1.0.5",
+ "lodash.get": "^4.4.2",
+ "lodash.isequal": "^4.5.0",
+ "prop-types": "^15.7.2"
+ },
+ "peerDependencies": {
+ "react": "^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0",
+ "react-dom": "^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0"
+ }
+ },
+ "node_modules/react-docgen": {
+ "version": "5.4.3",
+ "resolved": "https://registry.npmjs.org/react-docgen/-/react-docgen-5.4.3.tgz",
+ "integrity": "sha512-xlLJyOlnfr8lLEEeaDZ+X2J/KJoe6Nr9AzxnkdQWush5hz2ZSu66w6iLMOScMmxoSHWpWMn+k3v5ZiyCfcWsOA==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.7.5",
+ "@babel/generator": "^7.12.11",
+ "@babel/runtime": "^7.7.6",
+ "ast-types": "^0.14.2",
+ "commander": "^2.19.0",
+ "doctrine": "^3.0.0",
+ "estree-to-babel": "^3.1.0",
+ "neo-async": "^2.6.1",
+ "node-dir": "^0.1.10",
+ "strip-indent": "^3.0.0"
+ },
+ "bin": {
+ "react-docgen": "bin/react-docgen.js"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "17.0.2",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz",
+ "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==",
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1",
+ "scheduler": "^0.20.2"
+ },
+ "peerDependencies": {
+ "react": "17.0.2"
+ }
+ },
+ "node_modules/react-frame-component": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/react-frame-component/-/react-frame-component-5.3.2.tgz",
+ "integrity": "sha512-ce0/9xAnnkLDY6zxnTegP3Yjchw5z9aEaz0qKEGecrdnh3nAnQ5kehO84sNeLj3wQPB5ZM0OoVVQDQilhaE/5Q==",
+ "license": "MIT",
+ "peerDependencies": {
+ "prop-types": "^15.8.1 || ^16.0.0 || ^17.0.0 || ^18.0.0",
+ "react": ">= 16.8 || ^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-dom": ">= 16.8 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
+ "node_modules/react-is": {
+ "version": "16.13.1",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
+ "license": "MIT"
+ },
+ "node_modules/readable-stream": {
+ "version": "3.6.2",
+ "license": "MIT",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/real-require": {
+ "version": "0.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 12.13.0"
+ }
+ },
+ "node_modules/recast": {
+ "version": "0.17.6",
+ "resolved": "https://registry.npmjs.org/recast/-/recast-0.17.6.tgz",
+ "integrity": "sha512-yoQRMRrK1lszNtbkGyM4kN45AwylV5hMiuEveUBlxytUViWevjvX6w+tzJt1LH4cfUhWt4NZvy3ThIhu6+m5wQ==",
+ "license": "MIT",
+ "dependencies": {
+ "ast-types": "0.12.4",
+ "esprima": "~4.0.0",
+ "private": "^0.1.8",
+ "source-map": "~0.6.1"
+ },
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/recast/node_modules/ast-types": {
+ "version": "0.12.4",
+ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.12.4.tgz",
+ "integrity": "sha512-ky/YVYCbtVAS8TdMIaTiPFHwEpRB5z1hctepJplTr3UW5q8TDrpIMCILyk8pmLxGtn2KCtC/lSn7zOsaI7nzDw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/reflect-metadata": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
+ "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/regenerator-runtime": {
+ "version": "0.11.1",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
+ "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==",
+ "license": "MIT"
+ },
+ "node_modules/repeat-string": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
+ "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/resolve": {
+ "version": "1.22.11",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz",
+ "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==",
+ "license": "MIT",
+ "dependencies": {
+ "is-core-module": "^2.16.1",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/revoice.js": {
+ "version": "0.2.1694",
+ "resolved": "https://registry.npmjs.org/revoice.js/-/revoice.js-0.2.1694.tgz",
+ "integrity": "sha512-m/Hs37Jvm4UuVBOq11XjeGewqI1X/vsFSyIGtBD5B/11P178WPLFfNror/hdS1NhS4YpSNjpr0O5Z7dECXmc/Q==",
+ "license": "MIT",
+ "dependencies": {
+ "@livekit/rtc-node": "^0.13.20",
+ "better-docs": "^2.7.2",
+ "ffmpeg-static": "^5.0.2",
+ "fluent-ffmpeg": "^2.1.3",
+ "msc-node": "^0.0.26",
+ "music-metadata": "^11.9.0",
+ "prism-media": "^1.3.4",
+ "revolt-api": "^0.5.5",
+ "taffydb": "^2.7.3",
+ "wav": "^1.0.2",
+ "wavefile": "^11.0.0",
+ "ws": "^8.16.0"
+ }
+ },
+ "node_modules/revolt-api": {
+ "version": "0.5.21",
+ "resolved": "https://registry.npmjs.org/revolt-api/-/revolt-api-0.5.21.tgz",
+ "integrity": "sha512-/t3yRv5ru6FrX6fC3Brf/FemZouwj5yBOvOpl8iH84LkLYLmpNjqHXrEuV7Z7KHeeEKGLp+DVlmHI8oFYAvdpA==",
+ "license": "MIT",
+ "dependencies": {
+ "@insertish/oapi": "0.1.18",
+ "axios": "^0.26.1",
+ "lodash.defaultsdeep": "^4.6.1"
+ }
+ },
+ "node_modules/right-align": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
+ "integrity": "sha512-yqINtL/G7vs2v+dFIZmFUDbnVyFUJFKd6gK22Kgo6R4jfJGFtisKyncWDDULgjfqf4ASQuIQyjJ7XZ+3aWpsAg==",
+ "license": "MIT",
+ "dependencies": {
+ "align-text": "^0.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "deprecated": "Rimraf versions prior to v4 are no longer supported",
+ "license": "ISC",
+ "dependencies": {
+ "glob": "^7.1.3"
+ },
+ "bin": {
+ "rimraf": "bin.js"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/rx.mini": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/rx.mini/-/rx.mini-1.4.0.tgz",
+ "integrity": "sha512-8w5cSc1mwNja7fl465DXOkVvIOkpvh2GW4jo31nAIvX4WTXCsRnKJGUfiDBzWtYRInEcHAUYIZfzusjIrea8gA=="
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/safe-regex-test": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "is-regex": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/safe-stable-stringify": {
+ "version": "2.5.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "license": "MIT"
+ },
+ "node_modules/scheduler": {
+ "version": "0.20.2",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz",
+ "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==",
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "loose-envify": "^1.1.0",
+ "object-assign": "^4.1.1"
+ }
+ },
+ "node_modules/sdp-transform": {
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/sdp-transform/-/sdp-transform-2.15.0.tgz",
+ "integrity": "sha512-KrOH82c/W+GYQ0LHqtr3caRpM3ITglq3ljGUIb8LTki7ByacJZ9z+piSGiwZDsRyhQbYBOBJgr2k6X4BZXi3Kw==",
+ "license": "MIT",
+ "bin": {
+ "sdp-verify": "checker.js"
+ }
+ },
+ "node_modules/secure-json-parse": {
+ "version": "4.1.0",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/semver": {
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/send": {
+ "version": "0.19.2",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.1",
+ "mime": "1.6.0",
+ "ms": "2.1.3",
+ "on-finished": "~2.4.1",
+ "range-parser": "~1.2.1",
+ "statuses": "~2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/send/node_modules/ms": {
+ "version": "2.1.3",
+ "license": "MIT"
+ },
+ "node_modules/serve-static": {
+ "version": "1.16.3",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "~0.19.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/set-function-length": {
+ "version": "1.2.2",
+ "license": "MIT",
+ "dependencies": {
+ "define-data-property": "^1.1.4",
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "get-intrinsic": "^1.2.4",
+ "gopd": "^1.0.1",
+ "has-property-descriptors": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "license": "ISC"
+ },
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "license": "MIT",
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/side-channel": {
+ "version": "1.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.3",
+ "side-channel-list": "^1.0.0",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/signal-exit": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+ "license": "ISC"
+ },
+ "node_modules/simple-yenc": {
+ "version": "1.0.4",
+ "license": "MIT",
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/eshaz"
+ }
+ },
+ "node_modules/sonic-boom": {
+ "version": "4.2.1",
+ "license": "MIT",
+ "dependencies": {
+ "atomic-sleep": "^1.0.0"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/split2": {
+ "version": "4.2.0",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 10.x"
+ }
+ },
+ "node_modules/sqlstring": {
+ "version": "2.3.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/stream-parser": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz",
+ "integrity": "sha512-bJ/HgKq41nlKvlhccD5kaCr/P+Hu0wPNKPJOH7en+YrJu/9EgqUF+88w5Jb6KNcjOFMhfX4B2asfeAtIGuHObQ==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2"
+ }
+ },
+ "node_modules/string_decoder": {
+ "version": "1.3.0",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-indent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
+ "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
+ "license": "MIT",
+ "dependencies": {
+ "min-indent": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-json-comments": {
+ "version": "5.0.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/strtok3": {
+ "version": "10.3.5",
+ "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.5.tgz",
+ "integrity": "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==",
+ "license": "MIT",
+ "dependencies": {
+ "@tokenizer/token": "^0.3.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "9.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz",
+ "integrity": "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/supports-color?sponsor=1"
+ }
+ },
+ "node_modules/supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/taffydb": {
+ "version": "2.7.3",
+ "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz",
+ "integrity": "sha512-GQ3gtYFSOAxSMN/apGtDKKkbJf+8izz5YfbGqIsUc7AMiQOapARZ76dhilRY2h39cynYxBFdafQo5HUL5vgkrg==",
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/test-exclude": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
+ "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==",
+ "license": "ISC",
+ "dependencies": {
+ "@istanbuljs/schema": "^0.1.2",
+ "glob": "^7.1.4",
+ "minimatch": "^3.0.4"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/thread-stream": {
+ "version": "3.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "real-require": "^0.2.0"
+ }
+ },
+ "node_modules/tiny-glob": {
+ "version": "0.2.9",
+ "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
+ "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "globalyzer": "0.1.0",
+ "globrex": "^0.1.2"
+ }
+ },
+ "node_modules/to-fast-properties": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
+ "integrity": "sha512-lxrWP8ejsq+7E3nNjwYmUBMAgjMTZoTI+sdBOpvNyijeDLa29LUn9QaoXAHv4+Z578hbmHHJKZknzxVtvo77og==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/token-stream": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz",
+ "integrity": "sha512-nfjOAu/zAWmX9tgwi5NRp7O7zTDUD1miHiB40klUnAh9qnL1iXdgzcz/i5dMaL5jahcBAaSfmNOBBJBLJW8TEg==",
+ "license": "MIT"
+ },
+ "node_modules/token-types": {
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.2.tgz",
+ "integrity": "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==",
+ "license": "MIT",
+ "dependencies": {
+ "@borewit/text-codec": "^0.2.1",
+ "@tokenizer/token": "^0.3.0",
+ "ieee754": "^1.2.1"
+ },
+ "engines": {
+ "node": ">=14.16"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ }
+ },
+ "node_modules/ts-map": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/ts-map/-/ts-map-1.0.3.tgz",
+ "integrity": "sha512-vDWbsl26LIcPGmDpoVzjEP6+hvHZkBkLW7JpvwbCv/5IYPJlsbzCVXY3wsCeAxAUeTclNOUZxnLdGh3VBD/J6w==",
+ "license": "MIT"
+ },
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "license": "0BSD"
+ },
+ "node_modules/tsyringe": {
+ "version": "4.10.0",
+ "resolved": "https://registry.npmjs.org/tsyringe/-/tsyringe-4.10.0.tgz",
+ "integrity": "sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==",
+ "license": "MIT",
+ "dependencies": {
+ "tslib": "^1.9.3"
+ },
+ "engines": {
+ "node": ">= 6.0.0"
+ }
+ },
+ "node_modules/tsyringe/node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "license": "0BSD"
+ },
+ "node_modules/turbo-crc32": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/turbo-crc32/-/turbo-crc32-1.0.1.tgz",
+ "integrity": "sha512-8yyRd1ZdNp+AQLGqi3lTaA2k81JjlIZOyFQEsi7GQWBgirnQOxjqVtDEbYHM2Z4yFdJ5AQw0fxBLLnDCl6RXoQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/tweetnacl": {
+ "version": "1.0.3",
+ "license": "Unlicense"
+ },
+ "node_modules/type-fest": {
+ "version": "4.41.0",
+ "license": "(MIT OR CC0-1.0)",
+ "optional": true,
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/type-is": {
+ "version": "1.6.18",
+ "license": "MIT",
+ "dependencies": {
+ "media-typer": "0.3.0",
+ "mime-types": "~2.1.24"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/typedarray": {
+ "version": "0.0.6",
+ "license": "MIT"
+ },
+ "node_modules/typescript": {
+ "version": "4.9.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
+ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=4.2.0"
+ }
+ },
+ "node_modules/ua-parser-js": {
+ "version": "1.0.41",
+ "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.41.tgz",
+ "integrity": "sha512-LbBDqdIC5s8iROCUjMbW1f5dJQTEFB1+KO9ogbvlb3nm9n4YHa5p4KTvFPWvh2Hs8gZMBuiB1/8+pdfe/tDPug==",
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/ua-parser-js"
+ },
+ {
+ "type": "paypal",
+ "url": "https://paypal.me/faisalman"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/faisalman"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "ua-parser-js": "script/cli.js"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/uglify-js": {
+ "version": "2.8.29",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz",
+ "integrity": "sha512-qLq/4y2pjcU3vhlhseXGGJ7VbFO4pBANu0kwl8VCa9KEI0V8VfZIx2Fy3w01iSTA/pGwKZSmu/+I4etLNDdt5w==",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "source-map": "~0.5.1",
+ "yargs": "~3.10.0"
+ },
+ "bin": {
+ "uglifyjs": "bin/uglifyjs"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "optionalDependencies": {
+ "uglify-to-browserify": "~1.0.0"
+ }
+ },
+ "node_modules/uglify-js/node_modules/camelcase": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
+ "integrity": "sha512-wzLkDa4K/mzI1OSITC+DUyjgIl/ETNHE9QvYgy6J6Jvqyyz4C0Xfd+lQhb19sX2jMpZV4IssUn0VDVmglV+s4g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/uglify-js/node_modules/cliui": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
+ "integrity": "sha512-GIOYRizG+TGoc7Wgc1LiOTLare95R3mzKgoln+Q/lE4ceiYH19gUpl0l0Ffq4lJDEf3FxujMe6IBfOCs7pfqNA==",
+ "license": "ISC",
+ "dependencies": {
+ "center-align": "^0.1.1",
+ "right-align": "^0.1.1",
+ "wordwrap": "0.0.2"
+ }
+ },
+ "node_modules/uglify-js/node_modules/source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/uglify-js/node_modules/yargs": {
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
+ "integrity": "sha512-QFzUah88GAGy9lyDKGBqZdkYApt63rCXYBGYnEP4xDJPXNqXXnBDACnbrXnViV6jRSqAePwrATi2i8mfYm4L1A==",
+ "license": "MIT",
+ "dependencies": {
+ "camelcase": "^1.0.2",
+ "cliui": "^2.1.0",
+ "decamelize": "^1.0.0",
+ "window-size": "0.1.0"
+ }
+ },
+ "node_modules/uglify-to-browserify": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz",
+ "integrity": "sha512-vb2s1lYx2xBtUgy+ta+b2J/GLVUR+wmpINwHePmPRhOsIVCG2wDzKJ0n14GslH1BifsqVzSOwQhRaCAsZ/nI4Q==",
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/uint8array-extras": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.5.0.tgz",
+ "integrity": "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/underscore": {
+ "version": "1.13.8",
+ "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.8.tgz",
+ "integrity": "sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ==",
+ "license": "MIT"
+ },
+ "node_modules/undici": {
+ "version": "5.29.0",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
+ "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "@fastify/busboy": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=14.0"
+ }
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/update-browserslist-db": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "escalade": "^3.2.0",
+ "picocolors": "^1.1.1"
+ },
+ "bin": {
+ "update-browserslist-db": "cli.js"
+ },
+ "peerDependencies": {
+ "browserslist": ">= 4.21.0"
+ }
+ },
+ "node_modules/util": {
+ "version": "0.12.5",
+ "license": "MIT",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "is-arguments": "^1.0.4",
+ "is-generator-function": "^1.0.7",
+ "is-typed-array": "^1.1.3",
+ "which-typed-array": "^1.1.2"
+ }
+ },
+ "node_modules/util-deprecate": {
+ "version": "1.0.2",
+ "license": "MIT"
+ },
+ "node_modules/utils-merge": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/uuid": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
+ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/v8-to-istanbul": {
+ "version": "9.3.0",
+ "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz",
+ "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==",
+ "license": "ISC",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "^0.3.12",
+ "@types/istanbul-lib-coverage": "^2.0.1",
+ "convert-source-map": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=10.12.0"
+ }
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/void-elements": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz",
+ "integrity": "sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/vue-docgen-api": {
+ "version": "3.26.0",
+ "resolved": "https://registry.npmjs.org/vue-docgen-api/-/vue-docgen-api-3.26.0.tgz",
+ "integrity": "sha512-ujdg4i5ZI/wE46RZQMFzKnDGyhEuPCu+fMA86CAd9EIek/6+OqraSVBm5ZkLrbEd5f8xxdnqMU4yiSGHHeao/Q==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.2.3",
+ "@babel/types": "^7.0.0",
+ "ast-types": "^0.12.2",
+ "hash-sum": "^1.0.2",
+ "lru-cache": "^4.1.5",
+ "pug": "^2.0.3",
+ "recast": "^0.17.3",
+ "ts-map": "^1.0.3",
+ "typescript": "^3.2.2",
+ "vue-template-compiler": "^2.0.0"
+ }
+ },
+ "node_modules/vue-docgen-api/node_modules/ast-types": {
+ "version": "0.12.4",
+ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.12.4.tgz",
+ "integrity": "sha512-ky/YVYCbtVAS8TdMIaTiPFHwEpRB5z1hctepJplTr3UW5q8TDrpIMCILyk8pmLxGtn2KCtC/lSn7zOsaI7nzDw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/vue-docgen-api/node_modules/lru-cache": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
+ "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
+ "license": "ISC",
+ "dependencies": {
+ "pseudomap": "^1.0.2",
+ "yallist": "^2.1.2"
+ }
+ },
+ "node_modules/vue-docgen-api/node_modules/typescript": {
+ "version": "3.9.10",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
+ "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=4.2.0"
+ }
+ },
+ "node_modules/vue-docgen-api/node_modules/yallist": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
+ "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==",
+ "license": "ISC"
+ },
+ "node_modules/vue-template-compiler": {
+ "version": "2.7.16",
+ "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz",
+ "integrity": "sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==",
+ "license": "MIT",
+ "dependencies": {
+ "de-indent": "^1.0.2",
+ "he": "^1.2.0"
+ }
+ },
+ "node_modules/vue2-ace-editor": {
+ "version": "0.0.15",
+ "resolved": "https://registry.npmjs.org/vue2-ace-editor/-/vue2-ace-editor-0.0.15.tgz",
+ "integrity": "sha512-e3TR9OGXc71cGpvYcW068lNpRcFt3+OONCC81oxHL/0vwl/V3OgqnNMw2/RRolgQkO/CA5AjqVHWmANWKOtNnQ==",
+ "license": "MIT",
+ "dependencies": {
+ "brace": "^0.11.0"
+ }
+ },
+ "node_modules/wav": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wav/-/wav-1.0.2.tgz",
+ "integrity": "sha512-viHtz3cDd/Tcr/HbNqzQCofKdF6kWUymH9LGDdskfWFoIy/HJ+RTihgjEcHfnsy1PO4e9B+y4HwgTwMrByquhg==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-alloc": "^1.1.0",
+ "buffer-from": "^1.0.0",
+ "debug": "^2.2.0",
+ "readable-stream": "^1.1.14",
+ "stream-parser": "^0.3.1"
+ }
+ },
+ "node_modules/wav/node_modules/isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==",
+ "license": "MIT"
+ },
+ "node_modules/wav/node_modules/readable-stream": {
+ "version": "1.1.14",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
+ "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==",
+ "license": "MIT",
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ }
+ },
+ "node_modules/wav/node_modules/string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==",
+ "license": "MIT"
+ },
+ "node_modules/wavefile": {
+ "version": "11.0.0",
+ "resolved": "https://registry.npmjs.org/wavefile/-/wavefile-11.0.0.tgz",
+ "integrity": "sha512-/OBiAALgWU24IG7sC84cDO/KfFuvajWc5Uec0oV2zrpOOZZDgGdOwHwgEzOrwh8jkubBk7PtZfQBIcI1OaE5Ng==",
+ "license": "MIT",
+ "bin": {
+ "wavefile": "bin/wavefile.js"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/webcrypto-core": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.8.1.tgz",
+ "integrity": "sha512-P+x1MvlNCXlKbLSOY4cYrdreqPG5hbzkmawbcXLKN/mf6DZW0SdNNkZ+sjwsqVkI4A4Ko2sPZmkZtCKY58w83A==",
+ "license": "MIT",
+ "dependencies": {
+ "@peculiar/asn1-schema": "^2.3.13",
+ "@peculiar/json-schema": "^1.1.12",
+ "asn1js": "^3.0.5",
+ "pvtsutils": "^1.3.5",
+ "tslib": "^2.7.0"
+ }
+ },
+ "node_modules/werift": {
+ "version": "0.18.17",
+ "resolved": "https://registry.npmjs.org/werift/-/werift-0.18.17.tgz",
+ "integrity": "sha512-zkQ0zI0YSqyhpkBlEEtBi93hCXDq0PqYrQW5Q+mKKWsg1uV9j+CwzvqPFiih4zg8gn/WaREYx77mw5Af9sdD4g==",
+ "license": "MIT",
+ "dependencies": {
+ "@fidm/x509": "^1.2.1",
+ "@minhducsun2002/leb128": "^1.0.0",
+ "@peculiar/webcrypto": "^1.4.1",
+ "@peculiar/x509": "^1.9.2",
+ "@shinyoshiaki/ebml-builder": "^0.0.1",
+ "aes-js": "^3.1.2",
+ "binary-data": "^0.6.0",
+ "buffer-crc32": "^0.2.13",
+ "date-fns": "^2.29.3",
+ "debug": "^4.3.4",
+ "elliptic": "^6.5.4",
+ "int64-buffer": "^1.0.1",
+ "ip": "^1.1.8",
+ "jspack": "^0.0.4",
+ "lodash": "^4.17.21",
+ "mp4box": "^0.5.2",
+ "nano-time": "^1.0.0",
+ "p-cancelable": "^2.1.1",
+ "rx.mini": "^1.2.2",
+ "turbo-crc32": "^1.0.1",
+ "tweetnacl": "^1.0.3",
+ "uuid": "^9.0.0"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/werift/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/werift/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "which": "bin/which"
+ }
+ },
+ "node_modules/which-typed-array": {
+ "version": "1.1.20",
+ "license": "MIT",
+ "dependencies": {
+ "available-typed-arrays": "^1.0.7",
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.4",
+ "for-each": "^0.3.5",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-tostringtag": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/win-guid": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/win-guid/-/win-guid-0.2.1.tgz",
+ "integrity": "sha512-gEIQU4mkgl2OPeoNrWflcJFJ3Ae2BPd4eCsHHA/XikslkIVms/nHhvnvzIZV7VLmBvtFlDOzLt9rrZT+n6D67A==",
+ "license": "MIT"
+ },
+ "node_modules/window-size": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz",
+ "integrity": "sha512-1pTPQDKTdd61ozlKGNCjhNRd+KPmgLSGa3mZTHoOliaGcESD8G1PXhh7c1fgiPjVbNVfgy2Faw4BI8/m0cC8Mg==",
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/with": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/with/-/with-5.1.1.tgz",
+ "integrity": "sha512-uAnSsFGfSpF6DNhBXStvlZILfHJfJu4eUkfbRGk94kGO1Ta7bg6FwfvoOhhyHAJuFbCw+0xk4uJ3u57jLvlCJg==",
+ "license": "MIT",
+ "dependencies": {
+ "acorn": "^3.1.0",
+ "acorn-globals": "^3.0.0"
+ }
+ },
+ "node_modules/with/node_modules/acorn": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
+ "integrity": "sha512-OLUyIIZ7mF5oaAUT1w0TFqQS81q3saT46x8t7ukpPjMNk+nbs4ZHhs7ToV8EWnLYLepjETXd4XaCE4uxkMeqUw==",
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/wordwrap": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz",
+ "integrity": "sha512-xSBsCeh+g+dinoBv3GAOWM4LcVVO68wLXRanibtBSdUvkGWQRGeE9P7IwU9EmDDi4jA6L44lz15CGMwdw9N5+Q==",
+ "license": "MIT/X11",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "license": "ISC"
+ },
+ "node_modules/ws": {
+ "version": "8.19.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
+ "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+ "license": "ISC"
+ },
+ "node_modules/yargs": {
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^7.0.2",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^20.2.2"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "20.2.9",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
+ "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..61a0e93
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+ "type": "module",
+ "dependencies": {
+ "@fluxerjs/core": "^1.3.0",
+ "@fluxerjs/voice": "^1.3.0",
+ "@livekit/rtc-node": "^0.13.24",
+ "express": "^4.18.2",
+ "ffmpeg-static": "^5.1.0",
+ "ffprobe-static": "^3.1.0",
+ "follow-redirects": "^1.15.2",
+ "genius-lyrics": "^4.4.3",
+ "moonlink.js": "^5.2.0",
+ "mysql": "^2.18.1",
+ "revoice.js": "^0.2.1694",
+ "util": "^0.12.5",
+ "ws": "^8.19.0"
+ },
+ "scripts": {
+ "dev": "node --inspect index.mjs --trace-warnings",
+ "start": "node index.mjs",
+ "commands": "node index.mjs usage",
+ "defaultsSync": "node index.mjs sreload",
+ "migrate": "node settings/migrate.mjs"
+ }
+}
\ No newline at end of file
diff --git a/settings/README.md b/settings/README.md
new file mode 100644
index 0000000..e71c0e6
--- /dev/null
+++ b/settings/README.md
@@ -0,0 +1,37 @@
+# WIP Web Dashboard for Remix
+
+Control Remix through a web interface and set server settings and similar.
+
+Installation instructions will follow soon:tm:
+
+## Setup
+
+1. Create a mysql server with the following table:
+ ```MySQL
+ CREATE TABLE `ksiTokens` (
+ `user` varchar(26) NOT NULL,
+ `id` varchar(50) NOT NULL,
+ `token` varchar(70) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ `createdAt` datetime NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
+
+CREATE TABLE `logins` (
+ `user` text NOT NULL,
+ `id` varchar(50) NOT NULL,
+ `token` varchar(70) NOT NULL,
+ `verified` tinyint(1) NOT NULL,
+ `createdAt` datetime NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
+ ```
+2. Fill out the connection details in `config.json` in the remix root directory (See `config.example.json`)
+3. SSL setup:
+ - Create a certificate. For example [using Let's Encrypt](https://letsencrypt.org/de/getting-started/)
+ - Find the path to your private key and certificate pem files. Certbot uses `/etc/letsencrypt/live/remix.fairuse.org/privkey.pem` for the private key and `/etc/letsencrypt/live/remix.fairuse.org/fullchain.pem` for the certificate file. Fill in the paths in the config file
+ - set `useSSL` in `config.json` to `true`
+ - Make sure to configure the ports correctly. HTTPS connects to port `443` so make sure to set `webPort` accordingly.
+
+Credits for Website design:
+- NoLogicAlan
+- ophx
+- ShadowLp174
+- Fantic
diff --git a/settings/Settings.mjs b/settings/Settings.mjs
new file mode 100644
index 0000000..a60b511
--- /dev/null
+++ b/settings/Settings.mjs
@@ -0,0 +1,130 @@
+import { EventEmitter } from "node:events";
+import { logger } from "../src/constants/Logger.mjs";
+import * as fs from "node:fs";
+import * as mysql from "mysql";
+
+export class ServerSettings {
+ /** @type {string} */
+ id;
+ /** @type {SettingsManager} */
+ manager;
+ data = {};
+
+ constructor(id, mgr) {
+ this.id = id; this.manager = mgr;
+ this.loadDefaults();
+ }
+ set(key, value) { this.data[key] = value; this.manager.update(this, key); }
+ get(key) { return this.data[key]; }
+ reset(key) { return this.set(key, this.manager.defaults[key]); }
+ getAll() { return this.data; }
+ loadDefaults() { for (let key in this.manager.defaults) { this.data[key] = this.manager.defaults[key]; } }
+ checkDefaults(d) { for (let key in d) { if (this.data[key] === undefined) this.data[key] = d[key]; } }
+ deserialize(json) { for (let k in json) { if (k === "id") continue; this.data[k] = json[k]; } }
+ get serializationData() { return { ...this.data, id: this.id }; }
+ serialize() { return this.serializationData; }
+ serializeObject() { return this.serializationData; }
+}
+
+export class SettingsManager extends EventEmitter {
+ /** @abstract @type {Object} */
+ defaults;
+ /** @abstract */
+ update(server, key) { }
+ /** @abstract @returns {ServerSettings} */
+ getServer(id) { }
+ /** @abstract @returns {boolean} */
+ hasServer(id) { }
+ /** @abstract @returns {boolean} */
+ isOption(key) { }
+}
+
+export class MySqlSettingsManager extends SettingsManager {
+ guilds = new Map();
+ descriptions = {};
+ defaults = {};
+ db = null;
+
+ constructor(config, defaultsPath) {
+ super();
+ this.db = mysql.createPool({ connectionLimit: 15, ...config });
+ if (defaultsPath) this.loadDefaultsSync(defaultsPath);
+ this.load();
+ }
+ query(query) {
+ return new Promise(res => {
+ this.db.query(query, (error, results, fields) => { res({ error, results, fields }); });
+ });
+ }
+ async load() {
+ const res = await this.query("SELECT * FROM settings");
+ if (res.error) {
+ this._loadAttempts = (this._loadAttempts || 0) + 1;
+ const delay = Math.min(1000 * Math.pow(2, this._loadAttempts - 1), 30_000);
+ logger.error("[Settings] Init error (attempt", this._loadAttempts, "retrying in", delay + "ms):", res.error);
+ return setTimeout(() => { this.load(); }, delay);
+ }
+ this._loadAttempts = 0;
+ res.results.forEach((r) => {
+ const server = new ServerSettings(r.id, this);
+ server.deserialize(JSON.parse(r.data));
+ server.checkDefaults(this.defaults);
+ this.guilds.set(server.id, server);
+ });
+ this.emit("ready");
+ }
+ async remoteUpdate(server, key) {
+ const val = server.data[key];
+ // Arrays/objects must go through remoteSave — JSON_SET with scalar
+ // interpolation corrupts arrays by merging IDs into one number on read-back.
+ if (Array.isArray(val) || (typeof val === "object" && val !== null)) {
+ return this.remoteSave(server);
+ }
+ const escapedKey = mysql.escape(`$.${key}`);
+ // Preserve native boolean/number types so MySQL stores them as JSON
+ // booleans/numbers, not as strings. String(true) would store "true"
+ // which then reads back as a string — breaking strict equality checks.
+ const escapedVal = (typeof val === "boolean" || typeof val === "number")
+ ? mysql.escape(val)
+ : mysql.escape(String(val));
+ const escapedId = mysql.escape(server.id);
+ const r = await this.query(
+ `UPDATE settings SET data = JSON_SET(data, ${escapedKey}, ${escapedVal}) WHERE id=${escapedId}`
+ );
+ if (r.error) logger.error("[Settings] remoteUpdate error:", r.error);
+ }
+ async remoteSave(server) {
+ const escapedData = mysql.escape(JSON.stringify(server.data));
+ const escapedId = mysql.escape(server.id);
+ const r = await this.query(
+ `UPDATE settings SET data = ${escapedData} WHERE id=${escapedId}`
+ );
+ if (r.error) logger.error("[Settings] remoteSave error:", r.error);
+ }
+ loadDefaultsSync(filePath) {
+ const d = fs.readFileSync(filePath, "utf8");
+ const parsed = JSON.parse(d);
+ this.descriptions = parsed.descriptions;
+ this.defaults = parsed.values;
+ }
+ async saveAsync() {
+ await Promise.allSettled([...this.guilds.values()].map(v => this.remoteSave(v)));
+ }
+ async create(id, server) {
+ const escapedId = mysql.escape(id);
+ const escapedData = mysql.escape(JSON.stringify(server.data));
+ const r = await this.query(
+ `INSERT INTO settings (id, data) VALUES (${escapedId}, ${escapedData})`
+ );
+ if (r.error) logger.error("[Settings] create error:", r.error);
+ }
+ update(server, key) {
+ if (!this.guilds.has(server.id)) { this.guilds.set(server.id, server); this.create(server.id, server); }
+ const s = this.guilds.get(server.id);
+ s.data[key] = server.data[key];
+ this.remoteUpdate(server, key);
+ }
+ isOption(key) { return key in this.defaults; }
+ hasServer(id) { return this.guilds.has(id); }
+ getServer(id) { return (!this.guilds.has(id)) ? new ServerSettings(id, this) : this.guilds.get(id); }
+}
\ No newline at end of file
diff --git a/settings/migrate.mjs b/settings/migrate.mjs
new file mode 100644
index 0000000..ecb7832
--- /dev/null
+++ b/settings/migrate.mjs
@@ -0,0 +1,22 @@
+import { SettingsManager, RemoteSettingsManager } from "./Settings.mjs";
+import fs from "node:fs";
+import { logger } from "../src/constants/Logger.mjs";
+
+const config = JSON.parse(fs.readFileSync(new URL("../config.json", import.meta.url)));
+
+const sm = new SettingsManager();
+const rsm = new RemoteSettingsManager(config.mysql);
+
+const servers = sm.guilds.entries();
+
+rsm.on("ready", async () => {
+ for (const [id, s] of servers) {
+ logger.settings("[migrate] Processing server:", id);
+ if (rsm.hasServer(id)) {
+ await rsm.remoteSave(s);
+ continue;
+ }
+ await rsm.create(id, s);
+ }
+ process.exit(0);
+});
diff --git a/settings/runnables.mjs b/settings/runnables.mjs
new file mode 100644
index 0000000..fb47a88
--- /dev/null
+++ b/settings/runnables.mjs
@@ -0,0 +1,16 @@
+export default {
+ prefix: function(value, data) {
+ // prefix change hook — Settings handles persistence
+ },
+
+ pfp: function(value, data) {
+ if (value !== "default") {
+ return "Profile picture customisation is not supported on Fluxer.";
+ }
+ },
+
+ // stay_247 is managed exclusively by the %247 command and auto-join logic.
+ stay_247: function(value, data) {
+ return false;
+ },
+};
\ No newline at end of file
diff --git a/src/CommandHandler.mjs b/src/CommandHandler.mjs
new file mode 100644
index 0000000..c66cfec
--- /dev/null
+++ b/src/CommandHandler.mjs
@@ -0,0 +1,753 @@
+import { pathToFileURL } from "node:url";
+import { logger } from "./constants/Logger.mjs";
+import { Utils } from "./Utils.mjs";
+import { EventEmitter } from "node:events";
+import { Message, MessageHandler, PageBuilder } from "./MessageHandler.mjs";
+import { Client, PermissionFlags } from "@fluxerjs/core";
+import { SettingsManager } from "./Settings.mjs";
+import path from "node:path";
+import * as fs from "node:fs";
+
+export class CommandBuilder {
+ constructor() {
+ this.name = null;
+ this.description = null;
+ this.id = null;
+ this.aliases = [];
+ /** @type {CommandBuilder[]} */
+ this.subcommands = [];
+ /** @type {Option[]} */
+ this.options = [];
+ /** @type {CommandRequirement[]} */
+ this.requirements = [];
+ this.category = "default";
+ this.examples = [];
+
+ this.uid = Utils.uid();
+
+ this.subcommandError = "Invalid subcommand. Try one of the following options: `$previousCmd <$cmdlist>`";
+ /** @type {CommandBuilder} */
+ this.parent = null;
+ }
+ setName(n) { this.name = n; this.aliases.push(n.toLowerCase()); return this; }
+ setDescription(d) { this.description = d; return this; }
+ setId(id) { this.id = id; return this; }
+ get command() { return (this.parent) ? this.parent.command + " " + this.name : this.name; }
+ setRequirement(config) { let req = config(new CommandRequirement()); this.requirements.push(req); return this; }
+ addSubcommand(config) { let sub = config(new CommandBuilder()); sub.parent = this; this.subcommands.push(sub); return this; }
+ addStringOption(config, flag = false) { this.options.push(config(Option.create("string", flag))); return this; }
+ addNumberOption(config, flag = false) { this.options.push(config(Option.create("number", flag))); return this; }
+ addBooleanOption(config, flag = false) { this.options.push(config(Option.create("boolean", flag))); return this; }
+ addChannelOption(config, flag = false) { this.options.push(config(Option.create("channel", flag))); return this; }
+ addUserOption(config, flag = false) { this.options.push(config(Option.create("user", flag))); return this; }
+ addTextOption(config) {
+ if (this.options.findIndex(e => e.type === "text") !== -1) throw new Error("There can only be 1 text option.");
+ this.options.push(config(new Option("text")));
+ return this;
+ }
+ addChoiceOption(config, flag = false) { this.options.push(config(Option.create("choice", flag))); return this; }
+ addAlias(alias) { if (this.aliases.findIndex(e => e === alias.toLowerCase()) !== -1) return this; this.aliases.push(alias.toLowerCase()); return this; }
+ addAliases(...aliases) { aliases.forEach((a) => this.addAlias(a)); return this; }
+ setCategory(cat) { this.category = cat; return this; }
+ addExamples(...examples) { this.examples.push(...examples); return this; }
+}
+
+export class CommandRequirement {
+ ownerOnly = false;
+ constructor() {
+ this.permissions = [];
+ this.permissionError = "You don't have the needed permissions to run this command!";
+ return this;
+ }
+ setOwnerOnly(bool) { this.ownerOnly = bool; return this; }
+ /**
+ * @param {string} p Fluxer permission string (discord.js-style, e.g. "ManageChannels", "ManageGuild")
+ */
+ addPermission(p) { this.permissions.push(p); return this; }
+ addPermissions(...p) { this.permissions.push(...p); return this; }
+ getPermissions() { return (this.ownerOnly) ? [...this.permissions, "Owner-only command"] : this.permissions; }
+ setPermissionError(e) { this.permissionError = e; return this; }
+}
+
+export class Option {
+ // Fluxer uses discord.js-like channel mentions: <#id> and user mentions <@id>
+ channelRegex = /^<#(?\d+)>/;
+ userRegex = /^<@!?(?\d+)>/;
+ idRegex = /^(?\d+)/;
+
+ /** @type {Function} */
+ dynamicDefault;
+
+ constructor(type = "string") {
+ this.name = null;
+ this.description = null;
+ this.required = false;
+ this.id = null;
+ this.uid = Utils.uid();
+ this.type = type;
+ this.tError = null;
+ this.aliases = [null];
+ this.choices = [];
+ this.translations = {};
+ this.defaultValue = null;
+ this.dynamicDefault = null;
+ }
+
+ static create(type, flag = false) {
+ return (!flag) ? new Option(type) : new Flag(type);
+ }
+
+ setName(n) { this.name = n; this.aliases[0] = n; return this; }
+ setDescription(d) { this.description = d; return this; }
+ setRequired(r) { this.required = r; return this; }
+ setId(id) { this.id = id; return this; }
+ setType(t) { this.type = t; return this; }
+ addFlagAliases(...a) { this.aliases.push(...a); return this; }
+ addChoice(c) { if (this.type !== "choice") throw new Error(".addChoice is only available for choice options!"); this.choices.push(c); return this; }
+ addChoices(...cs) { if (this.type !== "choice") throw new Error(".addChoices is only available for choice options!"); cs.forEach(c => this.addChoice(c)); return this; }
+ setDefault(value) { this.defaultValue = value; return this; }
+ setDynamicDefault(callback) { this.dynamicDefault = callback; return this; }
+
+ empty(i) {
+ if (i === undefined || i === null) return true;
+ return (!i && !(String(i).includes("0")));
+ }
+
+ /**
+ * @param {string} i
+ * @param {Client} client
+ * @param {import("@fluxerjs/core").Message} msg
+ * @param {string} [type]
+ * @returns {boolean}
+ */
+ validateInput(i, client, msg, type) {
+ switch (type || this.type) {
+ case "text":
+ case "string":
+ return !!i;
+ case "number":
+ return !isNaN(i) && !isNaN(parseFloat(i));
+ case "boolean":
+ return i === "0" || i === "1" || i?.toLowerCase() === "true" || i?.toLowerCase() === "false";
+ case "choice":
+ return this.choices.includes(i);
+ case "user":
+ return this.userRegex.test(i) || this.idRegex.test(i);
+ case "channel":
+ if (i === undefined) return false;
+ return this.channelRegex.test(i) || this.idRegex.test(i) || client.channels.cache.some(c => c.name === i);
+ case "voiceChannel": {
+ if (!i) return false;
+ const results = this.channelRegex.exec(i) ?? this.idRegex.exec(i);
+ const guildId = msg?.channel?.guildId ?? msg?.guildId;
+
+ // dry-run eval mode
+ if (guildId === "eval") return (results) ? results.groups["id"] : i;
+
+ const voiceTypes = [2, 13]; // GuildVoice and GuildStageVoice
+ const byName = msg?.guild?.channels?.cache?.find(c => c.name === i && voiceTypes.includes(c.type));
+ const cObj = results
+ ? client.channels.cache.get(results.groups["id"])
+ : (byName ?? null);
+ return cObj ? voiceTypes.includes(cObj.type) : false;
+ }
+ }
+ }
+
+ /**
+ * @param {string} i
+ * @param {Client} client
+ * @param {import("@fluxerjs/core").Message} msg
+ * @param {string} [type]
+ * @returns {string|number|boolean}
+ */
+ formatInput(i, client, msg, type) {
+ switch (type || this.type) {
+ case "text":
+ case "string":
+ return i;
+ case "number":
+ return parseFloat(i);
+ case "boolean":
+ return i?.toLowerCase() === "true" || i === "1";
+ case "choice":
+ return i;
+ case "user": {
+ const rs = this.userRegex.exec(i) ?? this.idRegex.exec(i);
+ return rs?.groups["id"] ?? null;
+ }
+ case "channel": {
+ const results = this.channelRegex.exec(i) ?? this.idRegex.exec(i);
+ const channel = client.channels.cache.find(c => c.name === i);
+ return results ? results.groups["id"] : (channel ? channel.id : null);
+ }
+ case "voiceChannel": {
+ const r = this.channelRegex.exec(i) ?? this.idRegex.exec(i);
+ const guildId = msg?.channel?.guildId ?? msg?.guildId;
+ if (guildId === "eval") return r ? r.groups["id"] : (i || null);
+ const voiceTypes = [2, 13];
+ const c = msg?.guild?.channels?.cache?.find(c => c.name === i && voiceTypes.includes(c.type));
+ return r ? r.groups["id"] : (c ? c.id : null);
+ }
+ }
+ }
+
+ get typeError() {
+ if (this.tError) return this.tError;
+ switch (this.type) {
+ case "choice":
+ return "Invalid value '$currValue'. The option `" + this.name + "` has to be one of the following options: \n- " + this.choices.join("\n- ") + "\nSchematic: `$previousCmd <" + this.type + ">`";
+ case "voiceChannel":
+ case "channel":
+ return "Invalid value '$currValue'. The option `" + this.name + "` has to be a channel mention, id, or name.\nSchematic: `$previousCmd <" + this.type + ">`";
+ default:
+ return "Invalid value '$currValue'. The option `" + this.name + "` has to be of type `" + this.type + "`.\nSchematic: `$previousCmd <" + this.type + ">`";
+ }
+ }
+ set typeError(e) { this.tError = e; }
+}
+
+export class Flag extends Option {
+ constructor(type = "string") {
+ if (type === "text") throw new Error("Flags can't be of type 'text'!");
+ super(type);
+ }
+}
+
+export class PrefixManager {
+ /** @type {SettingsManager} */
+ settings;
+ constructor(settings) { this.settings = settings; }
+ getPrefix(guildId) { return this.settings.getServer(guildId).get("prefix"); }
+}
+
+export class HelpHandler {
+ /** @type {CommandHandler} */
+ commands;
+ commandsPerPage = 5;
+
+ paginationHandler = (msg, helpHandler, cmds) => {
+ let form = "Available Commands (page $currentPage/$maxPage): \n\n$content";
+ form += "\n\nRun `$prefix$helpCmd ` to learn more about it. You can also include subcommands.\n";
+ form += "For example: `$prefix$helpCmd settings get`\n\n";
+ form += "Tip: Use the arrows beneath this message to turn pages, or specify the required page by using `$prefix$helpCmd `";
+
+ const contents = cmds.map((cmd, i) => {
+ return (i + 1) + ". **" + cmd.name + "**: " + (cmd.description || "").split("\n")[0];
+ });
+
+ const pages = new PageBuilder(contents)
+ .setForm(helpHandler.commands.format(form, msg.message.guildId))
+ .setMaxLines(helpHandler.commandsPerPage);
+
+ helpHandler.commands.messages.initPagination(pages, msg);
+ return null;
+ }
+
+ customHelpHandler = null;
+
+ constructor(commands) { this.commands = commands; }
+
+ static capitalise(string) {
+ if (string.length < 1) return string;
+ if (string.length === 1) return string.toUpperCase();
+ return string.charAt(0).toUpperCase() + string.slice(1);
+ }
+
+ userCommands(cmds) {
+ return (cmds || this.commands.commands).filter(c =>
+ c.requirements.findIndex(r => r.ownerOnly) === -1
+ );
+ }
+
+ pageNumber() {
+ return Math.ceil(this.commands.commands.length / this.commandsPerPage);
+ }
+
+ help(message) {
+ if (this.customHelpHandler) return this.customHelpHandler(message);
+ if (this.paginationHandler) return this.genHelp(null, message, true);
+ return this.getHelpPage(0, message);
+ }
+
+ getHelpPage(n, msg, cmds = null) {
+ if (!cmds) cmds = this.commands.commands;
+ if (!(this.commandsPerPage < cmds.length)) return this.genHelp(null, msg, false, cmds);
+ let offset = this.commandsPerPage * n;
+ const commands = cmds.slice(offset, offset + this.commandsPerPage);
+ let max = Math.ceil(cmds.length / this.commandsPerPage);
+ return this.genHelp({ curr: n + 1, max, offset }, msg, false, commands);
+ }
+
+ genHelp(page, msg, paginate = false, cmds = null) {
+ cmds = this.userCommands(cmds);
+ if (this.paginationHandler && msg && paginate) return this.paginationHandler(msg, this, cmds);
+
+ let p = (page) ? ` (page ${page.curr}/${page.max})` : "";
+ const indexOffset = (page) ? page.offset : 0;
+ let content = "Available Commands" + p + ": \n\n";
+ if (page && page.curr !== 1) content += (indexOffset) + ". [...]\n";
+ cmds.forEach((cmd, i) => { content += (i + 1 + indexOffset) + ". **" + cmd.name + "**: " + cmd.description + "\n"; });
+ if (page && page.curr !== page.max) content += (cmds.length + indexOffset) + ". [...]\n";
+ content += "\nRun `$prefix$helpCmd ` to learn more about it. You can also include subcommands.\n";
+ content += "For example: `$prefix$helpCmd command subcommandName`";
+ if (page) content += "\n\nTip: Turn pages by using `$prefix$helpCmd `";
+
+ return this.commands.format(content, msg.message.guildId);
+ }
+
+ commandDescription(command) { return command.description; }
+
+ commandUsage(cmd, msg) {
+ if (cmd.subcommands.length > 0) {
+ return this.commands.format("$prefix" + cmd.command, msg.message.guildId) + " <" + cmd.subcommands.map(e => e.name).join(" | ") + "> [...]";
+ }
+ let options = this.commands.format("$prefix" + cmd.command, msg.message.guildId);
+ cmd.options.forEach(o => {
+ if (o.type === "text") return;
+ if (o instanceof Flag)
+ return options += (o.type === "choice") ? "-" + o.aliases[0] + " <" + o.choices.join(" | ") + ">" : " -" + o.aliases[0] + " '" + o.type + "'";
+ options += (o.type === "choice") ? " <" + o.choices.join(" |") + ">" : " '" + o.name + ": " + o.type + "'";
+ });
+ let o = cmd.options.find(e => e.type === "text");
+ if (o) options += "'" + o.name + ": " + o.type + "'";
+ return options.trim();
+ }
+
+ getCommandHelp(command, msg) {
+ let content = `${HelpHandler.capitalise(command.name)}\n`;
+ content += this.commandDescription(command, msg) + "\n\n";
+ content += "Usage: \n💻 `" + this.commandUsage(command, msg) + "`\n\n";
+ if (command.examples.length > 0)
+ content += "Example(s): \n- `" + command.examples.map(e => this.commands.format(e, msg.message.guildId)).join("`\n- `") + "`\n\n";
+ if (command.aliases.length > 1) {
+ content += "Aliases: \n";
+ command.aliases.forEach(alias => { content += "- " + alias + "\n"; });
+ content += "\n";
+ }
+ if (command.subcommands.length > 0) {
+ content += "Subcommands: \n";
+ command.subcommands.forEach(s => {
+ content += "- " + s.name + ": " + (this.commandDescription(s, msg) || "").split("\n")[0] + ((s.options.length > 0) ? "; (`" + s.options.length + " option(s)`)" : "") + "\n";
+ });
+ content += "\n";
+ } else if (command.options.length > 0) {
+ content += "Arguments: \n";
+ command.options.forEach(o => {
+ const optional = ((o.required) ? "" : "?");
+ const flag = (o instanceof Flag) ? "-" : "";
+ if (o.type === "choice") {
+ content += "- **" + flag + o.name + "**" + optional + ": " + (o.description || "").split("\n")[0] + ";\n - Allowed values: `" + o.choices.join("`, `") + "`\n - Aliases: `" + o.aliases.join("`, `") + "`\n";
+ } else {
+ content += "- **" + flag + o.name + "**" + optional + ": " + (o.description || "").split("\n")[0] + "\n - Aliases: `" + o.aliases.join("`, `") + "`\n";
+ }
+ content += "\n";
+ });
+ content += "\n";
+ }
+ if (command.requirements.length > 0) {
+ content += "Requirements: \n";
+ command.requirements.forEach(r => {
+ content += "- " + r.getPermissions().map(e => "Permission `" + e + "`").join("\n- ");
+ });
+ }
+ return content.trim();
+ }
+}
+
+export class CommandHandler extends EventEmitter {
+ onPing = null;
+ pingPrefix = true;
+ owners = [];
+
+ /** @type {MessageHandler} */
+ messages;
+ /** @type {Client} */
+ client;
+ /** @type {PrefixManager} */
+ prefixes;
+ /** @type {HelpHandler} */
+ helpHandler;
+
+ commandNames = [];
+ /** @type {CommandBuilder[]} */
+ commands = [];
+
+ invalidFlagError = "Invalid flag `$invalidFlag`. It doesn't match any options on this command.\n`$previousCmd $invalidFlag`";
+ textWrapError = "Malformed string `$value`: Missing a closing quote character (`$quote`) after the desired string.";
+
+ constructor(handler, prefix = "!") {
+ super();
+ this.messages = handler;
+ this.client = handler.client;
+ this.prefix = prefix;
+ this.helpHandler = new HelpHandler(this);
+ this.helpCommand = "help";
+ this.replyHandler = (message, msg) => {
+ msg.replyEmbed(this.format(message, msg.channel.channel.guildId));
+ };
+ this.messages.onMessage(this.messageHandler.bind(this));
+ }
+
+ getPrefix(guildId) { return this.prefixes.getPrefix(guildId); }
+ setPingPrefix(bool) { this.pingPrefix = bool; }
+ setPrefixManager(manager) { this.prefixes = manager; }
+ setHelpHandler(handler) { this.helpHandler = handler; }
+
+ format(text, guildId) {
+ const prefix = (!guildId) ? this.prefix : this.getPrefix(guildId);
+ return text
+ .replace(/\$prefix/gi, prefix)
+ .replace(/\$helpCmd/gi, this.helpCommand);
+ }
+
+ removeCommand(command) {
+ command.aliases.forEach(a => {
+ const idx = this.commandNames.indexOf(a);
+ if (idx !== -1) this.commandNames.splice(idx, 1);
+ });
+ const idx = this.commands.findIndex(c => c.uid === command.uid);
+ if (idx !== -1) this.commands.splice(idx, 1);
+ }
+
+ messageHandler(msg) {
+ if (!msg || !msg.content) return;
+ const trimmed = msg.content.trim();
+ if (/^<@!?\d+>$/.test(trimmed)) {
+ // Only respond if the bot itself was pinged
+ const botId = this.client.user?.id;
+ if (botId && (trimmed === `<@${botId}>` || trimmed === `<@!${botId}>`)) {
+ return this.onPing?.(msg);
+ }
+ return;
+ }
+ const guildId = msg.channel?.channel?.guildId ?? msg.message?.guildId;
+ const prefix = this.getPrefix(guildId);
+ const ping = `<@${this.client.user?.id}>`;
+ const pingBang = `<@!${this.client.user?.id}>`;
+ if (!(msg.content.startsWith(prefix) || msg.content.startsWith(ping) || msg.content.startsWith(pingBang))) return;
+
+ const len = msg.content.startsWith(prefix) ? prefix.length : (msg.content.startsWith(pingBang) ? pingBang.length : ping.length);
+ const args = msg.content.slice(len).replace(/\u00A0/gi, " ").trim().split(" ").map(e => e.trim());
+
+ if (!args[0]) return;
+
+ if (args[0] === this.helpCommand) {
+ if (!args[1]) {
+ const res = this.helpHandler.help(msg);
+ return (typeof res === "string") ? this.replyHandler(res, msg) : undefined;
+ }
+ if (args.length > 1 && Utils.isNumber(args[1])) {
+ const pageNumber = parseInt(args[1]);
+ if (pageNumber < 1 || pageNumber > this.helpHandler.pageNumber()) return this.replyHandler("`" + pageNumber + "` is not a valid page number!", msg);
+ return this.replyHandler(this.helpHandler.getHelpPage(pageNumber - 1, msg), msg);
+ }
+ if (args.length <= 2) {
+ let idx = this.commands.findIndex(e => e.aliases.some(al => al.toLowerCase() === args[1].toLowerCase()));
+ if (idx === -1) return this.replyHandler("Unknown command `$prefix" + args[1] + "`!", msg);
+ return this.replyHandler(this.helpHandler.getCommandHelp(this.commands[idx], msg), msg);
+ }
+ let currCmd = null;
+ let prefix2 = "";
+ for (let i = 0; i < args.slice(1).length; i++) {
+ let a = args.slice(1)[i];
+ let curr = (currCmd) ? currCmd.subcommands : this.commands;
+ let idx = curr.findIndex(e => e.aliases.some(al => al.toLowerCase() === a.toLowerCase()));
+ if (idx === -1) return this.replyHandler("Unknown command `$prefix" + prefix2 + a + "`!", msg);
+ currCmd = curr[idx];
+ prefix2 += a + " ";
+ }
+ return this.replyHandler(this.helpHandler.getCommandHelp(currCmd, msg), msg);
+ }
+
+ if (!this.commandNames.includes(args[0].toLowerCase())) {
+ this.replyHandler("Unknown Command. Use `$prefix$helpCmd` to view all possible commands.", msg);
+ return;
+ }
+ return this.processCommand(this.commands.find(e => e.aliases.includes(args[0].toLowerCase())), args, msg);
+ }
+
+ processCommand(cmd, args, msg, previous = false, external = false) {
+ // Guard first — cmd could be undefined if called from an edge case
+ if (!cmd) return logger.warn("[CommandHandler.processCommand] Invalid case: `cmd` falsy.");
+ if (cmd.requirements.length > 0 && !external) {
+ if (!this.assertRequirements(cmd, msg)) return;
+ }
+ if (previous === false) previous = this.format("$prefix" + cmd.name, msg.channel?.channel?.guildId);
+ if (!external) this.emit("command", { command: cmd, message: msg });
+
+ if (cmd.subcommands.length !== 0) {
+ const idx = cmd.subcommands.findIndex(el => {
+ if (!args[1]) return false;
+ return el.name.toLowerCase() === args[1].toLowerCase();
+ });
+ if (idx === -1) {
+ const list = cmd.subcommands.map(s => s.name).join(" | ");
+ const e = "Invalid subcommand. Try one of the following options: `$previousCmd <$cmdlist>`".replace(/\$previousCmd/gi, previous).replace(/\$cmdList/gi, list);
+ return (!external) ? this.replyHandler(e, msg) : e;
+ }
+ return this.processCommand(cmd.subcommands[idx], args.slice(1), msg, previous + this.format(" " + cmd.subcommands[idx].name), external);
+ }
+
+ const opts = [];
+ const texts = [];
+
+ const collectArguments = (index, currVal, as) => {
+ const lastChar = currVal.charAt(currVal.length - 1);
+ if (lastChar === '"') return { args: as, index };
+ const a = args[++index];
+ if (!a) return null;
+ as.push(a);
+ return collectArguments(index, a, as);
+ };
+
+ const options = cmd.options.slice().sort((a, b) => {
+ const aText = (a.type === "text") ? 1 : 2;
+ const bText = (b.type === "text") ? 1 : 2;
+ return aText - bText;
+ });
+
+ const STRING_TYPES = ["string", "text", "channel", "voiceChannel"];
+ const usedOptions = [];
+ let usedArgumentCount = 0;
+
+ for (let i = 0, argIndex = 1; i < options.length; i++) {
+ if (options[i] instanceof Flag) i++;
+ const o = options[i];
+ if (o?.type === "text") { texts.push(o); continue; }
+ if ((args[argIndex] || "").startsWith("-")) {
+ const flagName = args[argIndex].slice(1);
+ const op = cmd.options.find(e => e.aliases.includes(flagName));
+ if (!op) {
+ const error = this.invalidFlagError.replace(/\$previousCmd/gi, previous).replace(/\$invalidFlag/gi, "-" + flagName);
+ return (!external) ? this.replyHandler(error, msg) : error;
+ }
+ previous += " " + args[argIndex];
+ let value = args[++argIndex];
+ if ((value || "").startsWith('"') && (STRING_TYPES.includes(op.type))) {
+ const data = collectArguments(argIndex, value, [value]);
+ if (!data) return this.replyHandler(this.textWrapError.replace(/\$value/gi, args.slice(argIndex).join(" ")).replace(/\$quote/gi, args[argIndex].charAt(0)), msg);
+ argIndex += data.index - argIndex;
+ value = data.args.join(" ").slice(1, data.args.join(" ").length - 1);
+ }
+ argIndex++;
+ i--;
+ const valid = op.validateInput(value, this.client, msg.message);
+ if (!valid && (op.required || !op.empty(value))) {
+ const e = op.typeError.replace(/\$previousCmd/gi, previous).replace(/\$currValue/gi, value);
+ return (!external) ? this.replyHandler(e, msg) : e;
+ }
+ usedArgumentCount += 2;
+ previous += " " + value;
+ opts.push({ value: op.formatInput(value, this.client, msg.message), name: op.name, id: op.id, uid: op.uid });
+ usedOptions.push(op.uid);
+ continue;
+ }
+
+ if (!o) continue;
+ if (opts.findIndex(op => op.uid === o.uid) !== -1) continue;
+ let value = args[argIndex];
+ if ((args[argIndex] || "").startsWith('"') && (STRING_TYPES.includes(o.type))) {
+ const data = collectArguments(argIndex, args[argIndex], [args[argIndex]]);
+ if (!data) return this.replyHandler(this.textWrapError.replace(/\$value/gi, args.slice(argIndex).join(" ")).replace(/\$quote/gi, args[argIndex].charAt(0)), msg);
+ argIndex += data.index - argIndex;
+ value = data.args.join(" ");
+ value = value.slice(1, value.length - 1);
+ }
+ let valid = o.validateInput(value, this.client, msg.message);
+ if (!valid && o.dynamicDefault) {
+ value = o.dynamicDefault(this.client, msg);
+ valid = o.validateInput(value, this.client, msg.message);
+ }
+ if (!valid && (o.required || !o.empty(value))) {
+ const e = o.typeError.replace(/\$previousCmd/gi, previous).replace(/\$currValue/gi, value);
+ return (!external) ? this.replyHandler(e, msg) : e;
+ }
+ if (o.empty(value)) value = o.defaultValue;
+ opts.push({ value: o.formatInput(value, this.client, msg.message), name: o.name, id: o.id, uid: o.uid });
+ usedOptions.push(o.uid);
+ previous += " " + value;
+ argIndex++;
+ usedArgumentCount++;
+ }
+
+ if (texts.length > 0) {
+ let o = texts[0];
+ let text = args.slice(usedArgumentCount + 1).join(" ");
+ if (o.required && !o.validateInput(text, this.client, msg.message)) {
+ let e = o.typeError.replace(/\$previousCmd/gi, previous).replace(/\$currValue/gi, text);
+ return (!external) ? this.replyHandler(e, msg) : e;
+ }
+ const quote = (['"', "'"].includes(text.charAt(0))) ? text.charAt(0) : null;
+ if (quote && text.charAt(text.length - 1) === quote) text = text.slice(1, text.length - 1);
+ opts.push({ name: o.name, value: text, id: o.id, uid: o.uid });
+ usedOptions.push(o.uid);
+ }
+
+ options.filter(o => !usedOptions.includes(o.uid)).forEach(o => {
+ if (!o.defaultValue) return;
+ opts.push({ name: o.name, value: o.defaultValue, id: o.id, uid: o.uid });
+ });
+
+ const commandRunData = {
+ command: cmd,
+ commandId: cmd.id,
+ options: opts,
+ message: msg,
+ get: function (oName) { return this.options.find(o => o.name === oName); },
+ getById: function (id) { return this.options.find(o => o.id === id); }
+ };
+ if (!external) this.emit("run", commandRunData);
+ return commandRunData;
+ }
+
+ /**
+ * Checks requirements using fluxerjs (discord.js-like) permission API.
+ */
+ assertRequirements(cmd, msg) {
+ const authorId = msg.message?.author?.id;
+ const isOwner = this.owners.includes(authorId);
+
+ for (let i = 0; i < cmd.requirements.length; i++) {
+ let req = cmd.requirements[i];
+ if (req.ownerOnly && !isOwner) return false;
+ if (req.permissions.length > 0 && !isOwner) {
+ const guild = msg.message?.guild ?? null;
+ if (!guild) continue;
+
+ const member = guild.members.get(authorId) ?? null;
+ if (member?.permissions) {
+ // cached — check directly
+ const missing = req.permissions.filter(p => !member.permissions.has(PermissionFlags[p] ?? p));
+ if (missing.length > 0) {
+ this.replyHandler(req.permissionError, msg);
+ return false;
+ }
+ } else {
+ // not cached — fetch async and re-run
+ guild.fetchMember(authorId).then(member => {
+ const missing = req.permissions.filter(p => !member.permissions.has(PermissionFlags[p] ?? p));
+ if (missing.length > 0) {
+ this.replyHandler(req.permissionError, msg);
+ } else {
+ // Re-parse args the same way messageHandler does so quoted args survive.
+ const guildId2 = msg.channel?.channel?.guildId ?? msg.message?.guildId;
+ const prefix2 = this.getPrefix(guildId2);
+ const rawContent = msg.message.content;
+ const len2 = rawContent.startsWith(prefix2) ? prefix2.length : 0;
+ const args = rawContent.slice(len2).replace(/\u00A0/gi, " ").trim().split(" ").map(e => e.trim());
+ // Pass external=true to skip re-checking requirements and avoid
+ // re-entering the fetch loop if the member is still not cached.
+ this.processCommand(cmd, args, msg, false, true);
+ }
+ }).catch(() => this.replyHandler(req.permissionError, msg));
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ validateInput(type, i, m) { return (new Option()).validateInput(i, this.client, m, type); }
+ formatInput(type, i, m) { return (new Option()).formatInput(i, this.client, m, type); }
+
+ addCommand(builder) {
+ this.commandNames.push(...builder.aliases);
+ this.commands.push(builder);
+ this.commands.sort((a, b) => {
+ let A = a.name.toUpperCase();
+ let B = b.name.toUpperCase();
+ return (A < B) ? -1 : (A > B) ? 1 : 0;
+ });
+ return this.commands;
+ }
+}
+
+export class CommandLoader {
+ /** @type {CommandHandler} */
+ commands;
+ /** @type {Map} */
+ commandFiles = new Map();
+ /** @type {Map} */
+ runnables = new Map();
+ context;
+
+ constructor(commands, context) {
+ this.commands = commands;
+ this.context = context;
+ this.context.loader ??= this;
+ // expose loader helpers on context so reload.js can use them
+ this.context.commandFiles = this.commandFiles;
+ this.context.runnables = this.runnables;
+
+ this.commands.on("run", (data) => {
+ if (!this.runnables.has(data.command.uid)) return;
+ const runFc = this.runnables.get(data.command.uid);
+ try {
+ const result = runFc.call(this.context, data.message, data);
+ if (result && typeof result.catch === "function") {
+ result.catch(e => {
+ const id = Utils.uid();
+ logger.error("Error running command; error id #" + id, e);
+ data.message.replyEmbed("An error occurred. Error id: `#" + id + "`");
+ });
+ }
+ } catch (e) {
+ const id = Utils.uid();
+ logger.error("Error running command; error id #" + id, e);
+ data.message.replyEmbed("An error occurred. Error id: `#" + id + "`");
+ }
+ });
+ }
+
+ /**
+ * Normalise both ESM named-export shape and legacy default-export shape.
+ * Named ESM: export const command; export function run; export const exportDef
+ * Legacy CJS: module.exports = { command, run, export }
+ */
+ canonData(cData) {
+ if (cData.command !== undefined) {
+ return {
+ command: cData.command,
+ run: cData.run,
+ exportDef: cData.exportDef ?? cData.export ?? null
+ };
+ }
+ const d = cData.default ?? cData;
+ return {
+ command: d.command,
+ run: d.run,
+ exportDef: d.exportDef ?? d.export ?? null
+ };
+ }
+
+ loadFromDir(dir) {
+ const files = fs.readdirSync(dir)
+ .filter(f => !f.startsWith(".") && (f.endsWith(".js") || f.endsWith(".mjs")));
+
+ return Promise.all(files.map(async commandFile => {
+ const file = path.join(dir, commandFile);
+
+ const cData = this.canonData(await import(pathToFileURL(file).href));
+
+ const builder = (typeof cData.command === "function")
+ ? cData.command.call(this.context)
+ : cData.command;
+
+ if (!builder) return logger.warn("No builder returned. Skipping '" + commandFile + "'");
+
+ if (cData.exportDef)
+ this.context[cData.exportDef.name] = cData.exportDef.object;
+
+ this.commands.addCommand(builder);
+ this.commandFiles.set(builder.uid, file);
+
+ if (!cData.run) return;
+
+ this.runnables.set(builder.uid, cData.run);
+ builder.subcommands.forEach(sub => {
+ this.runnables.set(sub.uid, cData.run);
+ });
+ }));
+ }
+}
\ No newline at end of file
diff --git a/src/MessageHandler.mjs b/src/MessageHandler.mjs
new file mode 100644
index 0000000..aa2c063
--- /dev/null
+++ b/src/MessageHandler.mjs
@@ -0,0 +1,1152 @@
+import { Client, Events, EmbedBuilder } from "@fluxerjs/core";
+import { logger } from "./constants/Logger.mjs";
+import { Utils } from "./Utils.mjs";
+
+/** Parse a color value from config — accepts hex string "0xe9196c" or number */
+export function parseColor(value, fallback = 0xe9196c) {
+ if (!value) return fallback;
+ if (typeof value === "number") return value;
+ const n = parseInt(value, 16);
+ return isNaN(n) ? fallback : n;
+}
+
+/** Global embed color — set once at startup from config */
+let _globalColor = 0xe9196c;
+export function setGlobalColor(value) { _globalColor = parseColor(value); }
+export function getGlobalColor() { return _globalColor; }
+
+export class MessageHandler {
+ /**
+ * Fluxer.js client instance
+ * @type {Client}
+ * @public
+ */
+ client;
+ observedReactions;
+ /** @type {Map} */
+ observedChannels;
+ /**
+ * @param {Client} client
+ */
+ constructor(client) {
+ this.client = client;
+
+ this.observedReactions = new Map();
+ this.observedChannels = new Map();
+
+ this.setupEvents();
+
+ this.client.on(Events.MessageCreate, (m) => {
+ if (!this.observedChannels.has(m.channelId)) return;
+ const data = this.observedChannels.get(m.channelId);
+ const d = data.filter(e => e.id === m.author.id);
+ if (d.length === 0) return;
+ d.forEach(e => e.cb(new Message(m, this)));
+ });
+ }
+
+ setupEvents() {
+ const reactionUpdate = (reaction, user) => {
+ // fluxerjs reaction events pass a MessageReaction and a User
+ const messageId = reaction.message?.id ?? reaction.messageId;
+ const emoji = reaction.emoji?.name ?? reaction.emoji?.id ?? reaction.emoji;
+ const event = { user_id: user.id, emoji_id: emoji };
+
+ if (!this.observedReactions.has(messageId)) return;
+ if (event.user_id === this.client.user?.id) return;
+ const observer = this.observedReactions.get(messageId);
+ if (!observer.reactions.includes(event.emoji_id)) return;
+ if (observer.user && observer.user !== user.id) return;
+
+ const wrappedMsg = reaction.message ? new Message(reaction.message, this) : null;
+ observer.cb(event, wrappedMsg);
+ };
+ this.client.on(Events.MessageReactionAdd, (reaction, user) => reactionUpdate(reaction, user));
+ this.client.on(Events.MessageReactionRemove, (reaction, user) => reactionUpdate(reaction, user));
+ }
+
+ /**
+ * Checks if the bot has the specified permissions in a specific channel.
+ *
+ * @param {string[]} permissions An array of permissions to check for.
+ * @param {BaseChannel} channel The channel to check the permissions in.
+ * @returns {string[]} Missing permissions.
+ */
+ checkPermissions(permissions, channel) {
+ if (!channel?.guild) return []; // DMs — no guild perms
+ const me = channel.guild.members.me;
+ if (!me) return []; // ← change: can't verify, assume OK instead of blocking
+ const perms = channel.permissionsFor(me);
+ return permissions.filter(p => !perms.has(p));
+ }
+
+ /**
+ * @param {string[]} permissions Permissions to check for.
+ * @param {FluxerMessage} message The message to reply to in case of missing permissions.
+ * @returns {Promise} If all permissions are given.
+ */
+ async assertPermissions(permissions, message) {
+ const missing = this.checkPermissions(permissions, message.channel);
+ if (missing.length === 0) return true;
+
+ if (missing.includes("SendMessages")) {
+ try {
+ const dm = await message.author.createDM();
+ dm.send({
+ embeds: [this.#embedify("I am unable to send messages in <#" + message.channelId + ">. Please contact a server administrator and grant me the \"SendMessages\" permission.")]
+ });
+ } catch (e) {
+ logger.warn("[MessageHandler] Error sending message in DMs (" + message.author.id + "):", e.message);
+ }
+ return false;
+ }
+
+ this.replyEmbed(message, "I need the following permissions: `" + missing.join(",") + "`. Please contact a server administrator to address this.", { mention: true });
+ return false;
+ }
+
+ /**
+ * @callback MessageListener
+ * @param {Message} message
+ */
+ /**
+ * Listen for new messages
+ * @param {MessageListener} listener
+ */
+ onMessage(listener) {
+ this.client.on(Events.MessageCreate, (msg) => {
+ listener(new Message(msg, this));
+ });
+ }
+
+ /**
+ * Get a cached message by id.
+ * @param {string} id
+ * @returns {Message|null}
+ */
+ get(id) {
+ // fluxerjs messages are per-channel; search across cached channels
+ for (const channel of this.client.channels.cache.values()) {
+ if (!channel.messages) continue;
+ const msg = channel.messages.cache.get(id);
+ if (msg) return new Message(msg, this);
+ }
+ return null;
+ }
+
+ /**
+ * Either gets a message from cache or fetches it.
+ * @param {string} id message id
+ * @param {string} channelId channel id
+ * @returns {Promise}
+ */
+ async getOrFetch(id, channelId) {
+ const cached = this.get(id);
+ if (cached) return cached;
+ const channel = await this.client.channels.fetch(channelId);
+ return new Message(await channel.messages.fetch(id), this);
+ }
+
+ /**
+ * Get a cached channel by id.
+ * @param {string} id channel id
+ * @returns {Channel}
+ */
+ getChannel(id) {
+ const c = this.client.channels.cache.get(id);
+ return new Channel(c, this);
+ }
+
+ /**
+ * @param {string} id
+ * @returns {Promise}
+ */
+ async getOrFetchChannel(id) {
+ const c = this.getChannel(id);
+ if (c?.channel) return c;
+ return new Channel(await this.client.channels.fetch(id), this);
+ }
+
+ observeReactions(msg, reactions, cb, user) {
+ this.observedReactions.set(msg.id, {
+ reactions: reactions,
+ user: (user) ? user.id : null,
+ cb
+ });
+ return msg.id;
+ }
+ unobserveReactions(i) {
+ return this.observedReactions.delete(i);
+ }
+
+ /**
+ * @param {string} userId
+ * @param {BaseChannel} channel
+ * @param {MessageListener} callback
+ * @returns {string}
+ */
+ observeUserMessagesChannel(userId, channel, callback) {
+ const current = (this.observedChannels.get(channel.id) || []);
+ const nonce = Utils.uid();
+ current.push({
+ id: userId,
+ nonce: nonce,
+ cb: callback
+ });
+ this.observedChannels.set(channel.id, current);
+ return userId + ";" + channel.id + ";" + nonce;
+ }
+ unobserveUserMessagesChannel(oid) {
+ const [userId, channelId, nonce] = oid.split(";");
+ const current = (this.observedChannels.get(channelId) || []);
+ const idx = current.findIndex(e => e.id === userId && e.nonce === nonce);
+ if (idx === -1) return;
+ current.splice(idx, 1);
+ if (current.length === 0) return this.observedChannels.delete(channelId);
+ this.observedChannels.set(channelId, current);
+ }
+
+ #embedify(text = "", options = {}) {
+ const color = options.color ?? getGlobalColor();
+ const builder = new EmbedBuilder()
+ .setDescription("" + text)
+ .setColor(color);
+
+ if (options.title) builder.setTitle(options.title);
+
+ if (options.thumbnail && Utils.isValidUrl(options.thumbnail)) {
+ builder.setThumbnail(options.thumbnail);
+ }
+
+ if (options.icon_url) {
+ if (Utils.isValidUrl(options.icon_url)) {
+ builder.setAuthor({ name: options.title || "\u200b", iconURL: options.icon_url });
+ } else {
+ builder.setAuthor({ name: options.title || "\u200b" });
+ }
+ }
+
+ return builder.toJSON();
+ }
+
+ #createEmbed(text, message, options = {}) {
+ return {
+ content: options.content ?? undefined,
+ embeds: [this.#embedify(text, options)],
+ };
+ }
+
+ /**
+ * @param {FluxerMessage} replyingTo
+ * @param {string|Object} message
+ * @param {boolean} mention
+ * @returns {Promise}
+ */
+ async reply(replyingTo, message, mention = false) {
+ if (!(await this.assertPermissions(["SendMessages"], replyingTo))) return null;
+ const opts = typeof message === "string" ? { content: message } : { ...message };
+ return new Message(await replyingTo.reply(opts, { ping: false }), this);
+ }
+
+ /**
+ * @param {FluxerMessage} replyingTo
+ * @param {string|Object} message
+ * @param {Object} options
+ * @returns {Promise}
+ */
+ async replyEmbed(replyingTo, message, options = {}) {
+ if (!(await this.assertPermissions(["SendMessages"], replyingTo))) return null;
+
+ // Raw embed payload — pass straight through without re-wrapping
+ if (typeof message === "object" && Array.isArray(message.embeds)) {
+ return new Message(await replyingTo.reply(message, { ping: false }), this);
+ }
+
+ options = {
+ mention: false,
+ embed: {},
+ ...options
+ };
+ const content = (typeof message === "object") ? message.embedText : message;
+ let payload = this.#createEmbed(content, replyingTo, options.embed);
+ if (typeof message === "object") {
+ const { embedText, ...rest } = message;
+ payload = { ...payload, ...rest };
+ }
+ return new Message(await replyingTo.reply(payload, { ping: false }), this);
+ }
+
+ /**
+ * @param {BaseChannel} channel
+ * @param {string|Object} message
+ * @returns {Promise}
+ */
+ async sendMessage(channel, message) {
+ if (this.checkPermissions(["SendMessages"], channel).length !== 0) {
+ logger.warn("[MessageHandler] Missing SendMessages permission in channel", channel.id);
+ return;
+ }
+ return new Message(await channel.send(typeof message === "string" ? { content: message } : message), this);
+ }
+
+ /**
+ * @param {BaseChannel} channel
+ * @param {string|Object} content
+ * @param {Object} embedOptions
+ * @returns {Promise}
+ */
+ async sendEmbed(channel, content, embedOptions = {}) {
+ if (this.checkPermissions(["SendMessages", "EmbedLinks"], channel).length !== 0) {
+ return this.sendMessage(channel, typeof content === "string" ? content : content?.embedText ?? "");
+ }
+ // Raw embed payload — pass straight through without re-wrapping
+ if (typeof content === "object" && Array.isArray(content.embeds)) {
+ return new Message(await channel.send(content), this);
+ }
+ const text = (typeof content === "object") ? content.embedText : content;
+ const payload = this.#createEmbed(text, channel, embedOptions);
+ if (typeof content === "object") {
+ const { embedText, ...rest } = content;
+ Object.assign(payload, rest);
+ }
+ return new Message(await channel.send(payload), this);
+ }
+
+ /**
+ * @param {FluxerMessage} message
+ * @param {string|Object} content
+ * @param {Object} embedOptions
+ * @returns {Promise}
+ */
+ async editEmbed(message, content, embedOptions = {}) {
+ // Raw embed payload — pass straight through without re-wrapping
+ if (typeof content === "object" && Array.isArray(content.embeds)) {
+ try {
+ return new Message(await message.edit(content), this);
+ } catch (err) {
+ if (err.code === "UNKNOWN_MESSAGE") {
+ logger.warn("[MessageHandler] editEmbed: Message no longer exists, skipping edit.");
+ return null;
+ }
+ throw err;
+ }
+ }
+ const text = (typeof content === "object") ? content.embedText : content;
+ const embed = this.#embedify(text, embedOptions);
+ let payload = { embeds: [embed] };
+ if (typeof content === "object") {
+ const { embedText, ...rest } = content;
+ payload = { ...payload, ...rest };
+ }
+
+ try {
+ return new Message(await message.edit(payload), this);
+ } catch (err) {
+ if (err.code === 'UNKNOWN_MESSAGE') {
+ logger.warn("[MessageHandler] editEmbed: Message no longer exists, skipping edit.");
+ return null;
+ }
+ throw err;
+ }
+ }
+
+ /**
+ * Initialize paginated messages.
+ * @param {PageBuilder} builder
+ * @param {Message} msg
+ */
+ async initPagination(builder, msg) {
+ const pages = builder.createPages();
+ if (pages.length === 0) return;
+
+ const arrows = ["⬅️", "➡️"];
+ const currPage = { n: 0 };
+ const send = () => builder.getPage(currPage.n);
+
+ const m = await msg.replyEmbed(send());
+ if (!m) return;
+
+ m.message.react(arrows[0]).catch(() => {});
+ m.message.react(arrows[1]).catch(() => {});
+
+ const unobserve = m.onReaction(arrows, (e) => {
+ if (e.emoji_id === arrows[0]) {
+ currPage.n = Math.max(0, currPage.n - 1);
+ } else {
+ currPage.n = Math.min(pages.length - 1, currPage.n + 1);
+ }
+ m.editEmbed(send()).catch(() => {});
+ });
+
+ // Auto-close after 5 minutes
+ setTimeout(() => {
+ unobserve();
+ m.editEmbed(send() + "\nSession closed - Changing pages **won't work** from here.").catch(() => {});
+ }, 5 * 60 * 1000);
+ }
+
+ /**
+ * @param {string} channelId
+ * @returns {Promise}
+ */
+ async joinChannel(channelId) {
+ const { joinVoiceChannel } = await import("@fluxerjs/voice");
+ const channel = await this.client.channels.fetch(channelId);
+ if (!channel || !("guildId" in channel)) throw new Error("Cannot join a non-guild voice channel.");
+ // @fluxerjs/voice API: joinVoiceChannel(client, channel) — NOT the old discord-voip object style
+ return joinVoiceChannel(this.client, channel);
+ }
+}
+
+export class Channel {
+ /**
+ * The actual underlying fluxer.js channel instance
+ * @type {import("@fluxerjs/core").BaseChannel}
+ */
+ channel;
+ /** @type {MessageHandler} */
+ handler;
+
+ /**
+ * @param {import("@fluxerjs/core").BaseChannel} channel
+ * @param {MessageHandler} handler
+ */
+ constructor(channel, handler) {
+ this.channel = channel;
+ this.handler = handler;
+ }
+
+ /** @type {Guild} */
+ get server() {
+ return this.channel?.guild ?? null;
+ }
+ /** @type {Guild} */
+ get guild() {
+ return this.channel?.guild ?? null;
+ }
+ /** @type {boolean} */
+ get isVoice() {
+ return this.channel?.isVoiceBased?.() ?? false;
+ }
+ /** @type {string} */
+ get id() {
+ return this.channel?.id;
+ }
+ /** @type {string} */
+ get guildId() {
+ return this.channel?.guildId ?? null;
+ }
+ /** @type {string} */
+ get serverId() {
+ return this.guildId;
+ }
+
+ /**
+ * @param {MessageListener} callback
+ * @param {User} user
+ * @returns {Function}
+ */
+ onMessageUser(callback, user) {
+ const oid = this.handler.observeUserMessagesChannel(user.id, this.channel, callback);
+ return () => {
+ this.handler.unobserveUserMessagesChannel(oid);
+ };
+ }
+
+ /**
+ * @param {string|Object} content
+ * @returns {Promise}
+ */
+ sendMessage(content) {
+ return this.handler.sendMessage(this.channel, content);
+ }
+
+ /**
+ * @param {string|Object} content
+ * @param {Object} embedOptions
+ * @returns {Promise}
+ */
+ sendEmbed(content, embedOptions = {}) {
+ return this.handler.sendEmbed(this.channel, content, embedOptions);
+ }
+
+ /**
+ * @returns {Promise}
+ */
+ join() {
+ if (!this.isVoice) throw new Error("Cannot join a text channel. Attempting to 'join' into channel `" + this.channel?.id + "`");
+ return this.handler.joinChannel(this.channel.id);
+ }
+}
+
+export class Message {
+ /**
+ * The actual underlying message instance
+ * @type {import("@fluxerjs/core").Message}
+ */
+ message;
+ /** @type {MessageHandler} */
+ handler;
+
+ constructor(message, handler) {
+ this.message = message;
+ this.handler = handler;
+ }
+
+ /** @type {string} */
+ get content() {
+ return this.message.content;
+ }
+ /** @type {string} */
+ get id() {
+ return this.message.id;
+ }
+ /** @type {User} */
+ get author() {
+ return this.message.author;
+ }
+ /** @type {string} */
+ get authorId() {
+ return this.message.author?.id;
+ }
+ /** @type {GuildMember|null} */
+ get member() {
+ return this.message.member ?? null;
+ }
+ /** @type {Channel} */
+ get channel() {
+ return this.handler.getChannel(this.message.channelId);
+ }
+
+ /**
+ * @param {string[]} reactions
+ * @param {function} callback
+ * @param {User} [user]
+ * @returns {function} unobserve
+ */
+ onReaction(reactions, callback, user = null) {
+ const oid = this.handler.observeReactions(this.message, reactions, callback, user);
+ return () => {
+ this.handler.unobserveReactions(oid);
+ };
+ }
+
+ /**
+ * @param {string|Object} content
+ * @param {boolean} mention
+ * @returns {Promise}
+ */
+ reply(content, mention = false) {
+ return this.handler.reply(this.message, content, mention);
+ }
+
+ /**
+ * @param {string|Object} content
+ * @param {boolean} mention
+ * @param {Object} embedOptions
+ * @returns {Promise}
+ */
+ replyEmbed(content, mention = false, embedOptions = {}) {
+ return this.handler.replyEmbed(this.message, content, {
+ mention,
+ embed: embedOptions
+ });
+ }
+
+ /**
+ * @param {string|Object} content
+ * @param {Object} embedOptions
+ * @returns {Promise}
+ */
+ editEmbed(content, embedOptions = {}) {
+ return this.handler.editEmbed(this.message, content, embedOptions);
+ }
+}
+
+export class PageBuilder {
+ form = "";
+ maxLinesPerPage = 2;
+ /** @type {string[]} */
+ content = [];
+ initiated = false;
+ pages = [];
+
+ /**
+ * @param {string|string[]} content
+ */
+ constructor(content) {
+ if (!Array.isArray(content)) {
+ this.content = content.split("\n");
+ return;
+ }
+ this.content = content;
+ }
+
+ setForm(form) {
+ this.form = form;
+ this.initiated = false; // reset so createPages() rebuilds if called again
+ return this;
+ }
+
+ setMaxLines(maxLinesPerPage = 2) {
+ this.maxLinesPerPage = maxLinesPerPage;
+ this.initiated = false; // reset so createPages() rebuilds with new page size
+ return this;
+ }
+
+ createPages() {
+ if (this.initiated) return this.pages;
+
+ const lines = this.content;
+ const pages = [];
+ for (let i = 0; i < lines.length; i++) {
+ const n = Math.floor(i / this.maxLinesPerPage);
+ if (!pages[n]) pages[n] = [];
+ pages[n].push(lines[i]);
+ }
+
+ this.pages = pages;
+ this.initiated = true;
+ return pages;
+ }
+
+ /**
+ * @param {number} n
+ * @returns {string|null}
+ */
+ getPage(n) {
+ const pages = this.createPages();
+ if (!pages[n]) return null;
+ return this.form
+ .replace(/\$maxPage/gi, pages.length)
+ .replace(/\$currentPage/gi, n + 1)
+ .replace(/\$currPage/gi, n + 1)
+ .replace(/\$content/gi, pages[n].join("\n"));
+ }
+
+ /**
+ * @param {number} n
+ * @returns {string|null}
+ */
+ getContent(n) {
+ const pages = this.createPages();
+ if (!pages[n]) return null;
+ return pages[n].join("\n");
+ }
+
+ /** @returns {number} */
+ size() {
+ return this.pages.length;
+ }
+}
+
+/**
+ * RichPaginator — tabbed embed pagination with reaction controls.
+ *
+ * Usage:
+ * new RichPaginator(msg, handler)
+ * .setTimeout(5 * 60 * 1000)
+ * .addTab({ emoji: "🏠", title: "Home", header: "Home Page", content: "..." })
+ * .addTab({ emoji: "🎵", title: "Music", header: "Music Commands", pages: ["page1", "page2"] })
+ * .setPrevNext("⬅️", "➡️")
+ * .send();
+ */
+export class RichPaginator {
+ /**
+ * @param {Message} msg
+ * @param {MessageHandler} handler
+ */
+ constructor(msg, handler) {
+ this._msg = msg;
+ this._handler = handler;
+ this._tabs = [];
+ this._prev = "⬅️";
+ this._next = "➡️";
+ this._timeout = 5 * 60 * 1000;
+ this._color = getGlobalColor();
+ this._state = { tab: 0, page: 0 };
+ }
+
+ /** @param {number} ms */
+ setTimeout(ms) { this._timeout = ms; return this; }
+
+ /** @param {number} color */
+ setColor(color) { this._color = color; return this; }
+
+ /** @param {string} startTab index (0-based) */
+ setStartTab(idx) { this._state.tab = idx; return this; }
+
+ /** @param {string} prev @param {string} next */
+ setPrevNext(prev, next) { this._prev = prev; this._next = next; return this; }
+
+ /**
+ * Add a tab.
+ * @param {{ emoji: string, title: string, header: string, content?: string, pages?: string[] }} tab
+ * content — single static string (no pagination)
+ * pages — array of strings, one per page (enables prev/next)
+ */
+ addTab(tab) {
+ this._tabs.push({
+ emoji: tab.emoji,
+ title: tab.title,
+ header: tab.header,
+ pages: tab.pages ?? (tab.content != null ? [tab.content] : []),
+ });
+ return this;
+ }
+
+ _buildEmbed(tabIdx, pageIdx) {
+ const tab = this._tabs[tabIdx];
+ const totalTabs = this._tabs.length;
+ const totalPages = Math.max(1, tab.pages.length);
+ const safePage = Math.max(0, Math.min(pageIdx, totalPages - 1));
+ const content = tab.pages[safePage] ?? "";
+
+ const footerParts = [`Page ${tabIdx + 1}/${totalTabs}`];
+ if (totalPages > 1) footerParts.push(`• Subpage ${safePage + 1}/${totalPages}`);
+
+ return new EmbedBuilder()
+ .setColor(this._color)
+ .setAuthor({ name: tab.header })
+ .setTitle(tab.title)
+ .setDescription(content)
+ .setFooter({ text: footerParts.join(" ") })
+ .toJSON();
+ }
+
+ async send() {
+ if (this._tabs.length === 0) return null;
+
+ const tabEmojis = this._tabs.map(t => t.emoji);
+ const allReactions = [...tabEmojis, this._prev, this._next];
+
+ // Send initial embed
+ const nativeMsg = this._msg.message ?? this._msg;
+ if (!nativeMsg?.reply) return null;
+
+ const rawMsg = await nativeMsg.reply(
+ { embeds: [this._buildEmbed(this._state.tab, this._state.page)] },
+ { ping: false }
+ ).catch(() => null);
+
+ if (!rawMsg) return null;
+
+ // Add reactions
+ for (const emoji of allReactions) {
+ await rawMsg.react(emoji).catch(() => {});
+ }
+
+ const wrapped = new Message(rawMsg, this._handler);
+ const state = this._state;
+ const tabs = this._tabs;
+ const prev = this._prev;
+ const next = this._next;
+ const buildEmbed = this._buildEmbed.bind(this);
+
+ const unobserve = wrapped.onReaction(allReactions, async (e) => {
+ const emoji = e.emoji_id;
+
+ if (emoji === prev || emoji === next) {
+ const tab = tabs[state.tab];
+ const totalPages = Math.max(1, tab.pages.length);
+ if (totalPages <= 1) return;
+ state.page = emoji === prev
+ ? (state.page - 1 + totalPages) % totalPages
+ : (state.page + 1) % totalPages;
+ } else {
+ const idx = tabEmojis.indexOf(emoji);
+ if (idx === -1 || idx === state.tab) return;
+ state.tab = idx;
+ state.page = 0;
+ }
+
+ rawMsg.edit({ embeds: [buildEmbed(state.tab, state.page)] }).catch(() => {});
+ });
+
+ const clearReactions = async () => {
+ try {
+ await rawMsg.removeAllReactions();
+ return;
+ } catch (e) {
+ logger.warn("[RichPaginator] removeAllReactions failed:", e?.message ?? e);
+ }
+ // Fallback: remove each bot reaction individually
+ for (const emoji of allReactions) {
+ try {
+ await rawMsg.removeReaction(emoji);
+ } catch (_) {}
+ }
+ };
+
+ // Timer resets on every reaction interaction
+ const closeSession = async () => {
+ unobserve();
+ // Update footer to show session closed
+ const currentEmbed = buildEmbed(state.tab, state.page);
+ currentEmbed.footer.text += " • Session closed";
+ rawMsg.edit({ embeds: [currentEmbed] }).catch(() => {});
+ await clearReactions();
+ };
+
+ let timer = setTimeout(closeSession, this._timeout);
+
+ const resetTimer = () => {
+ clearTimeout(timer);
+ timer = setTimeout(closeSession, this._timeout);
+ };
+
+ // Wrap reaction handler to reset timer on each interaction
+ const origHandler = wrapped.handler.observedReactions.get(rawMsg.id);
+ if (origHandler) {
+ const origCb = origHandler.cb;
+ origHandler.cb = (e, m) => { resetTimer(); origCb(e, m); };
+ }
+
+ return rawMsg;
+ }
+}
+
+/**
+ * QueuePaginator — rich embed pagination for the queue/list command.
+ *
+ * Usage:
+ * new QueuePaginator(msg, handler, client)
+ * .setTimeout(30_000)
+ * .setColor(0xe9196c)
+ * .send(buildEmbedFn, totalPages, startPage);
+ *
+ * buildEmbedFn(page) must return a raw embed object { color, author, title, description, footer }
+ */
+export class QueuePaginator {
+ /**
+ * @param {Message} msg
+ * @param {MessageHandler} handler
+ * @param {Client} client
+ */
+ constructor(msg, handler, client) {
+ this._msg = msg;
+ this._handler = handler;
+ this._client = client;
+ this._timeout = 30 * 1000;
+ this._prev = "⬅️";
+ this._next = "➡️";
+ }
+
+ /** @param {number} ms */
+ setTimeout(ms) { this._timeout = ms; return this; }
+
+ /** @param {string} prev @param {string} next */
+ setPrevNext(prev, next) { this._prev = prev; this._next = next; return this; }
+
+ /**
+ * @param {function(page: number): object} buildEmbed - returns a raw embed object
+ * @param {number} totalPages
+ * @param {number} [startPage=1]
+ */
+ async send(buildEmbed, totalPages, startPage = 1) {
+ const state = { page: Math.max(1, Math.min(startPage, totalPages)) };
+ const nativeMsg = this._msg.message ?? this._msg;
+ if (!nativeMsg?.reply) return null;
+ const rawMsg = await nativeMsg.reply(
+ { embeds: [buildEmbed(state.page)] },
+ { ping: false }
+ ).catch(() => null);
+
+ if (!rawMsg) return null;
+
+ // No arrows needed for single page
+ if (totalPages <= 1) return rawMsg;
+
+ const prev = this._prev;
+ const next = this._next;
+
+ await rawMsg.react(prev).catch(() => {});
+ await rawMsg.react(next).catch(() => {});
+
+ const client = this._client;
+ const channelId = rawMsg.channelId ?? rawMsg.channel_id ?? rawMsg.channel?.id;
+ const msgId = rawMsg.id;
+
+ const clearReactions = async () => {
+ try {
+ await rawMsg.removeAllReactions();
+ } catch (_) {
+ for (const emoji of [prev, next]) {
+ try {
+ await rawMsg.removeReaction(emoji);
+ } catch (_) {}
+ }
+ }
+ };
+
+ const closeSession = async () => {
+ unobserve();
+ const embed = buildEmbed(state.page);
+ embed.footer.text += " • Session closed";
+ rawMsg.edit({ embeds: [embed] }).catch(() => {});
+ await clearReactions();
+ };
+
+ let timer = setTimeout(closeSession, this._timeout);
+ const resetTimer = () => {
+ clearTimeout(timer);
+ timer = setTimeout(closeSession, this._timeout);
+ };
+
+ const wrapped = new Message(rawMsg, this._handler);
+ const unobserve = wrapped.onReaction([prev, next], (e) => {
+ resetTimer();
+ state.page = e.emoji_id === prev
+ ? (state.page <= 1 ? totalPages : state.page - 1)
+ : (state.page >= totalPages ? 1 : state.page + 1);
+ rawMsg.edit({ embeds: [buildEmbed(state.page)] }).catch(() => {});
+ });
+
+ return rawMsg;
+ }
+}
+
+// ─── HelpCommand ──────────────────────────────────────────────────────────────
+// Self-contained help command — no help.mjs needed.
+//
+// Usage in index.mjs (inside the Remix constructor, after commands are set up):
+//
+// import { HelpCommand } from "./src/MessageHandler.mjs";
+//
+// new HelpCommand(this.handler, this.messages, (msg) => this.getSettings(msg))
+// .register();
+//
+// That's it. %help, %h, and %commands all work automatically.
+// The \x00help hack in index.mjs and the commands.helpCommand override are
+// no longer needed — remove them both.
+
+const HELP_CMDS_PER_PAGE = 10;
+const HELP_SESSION_MS = 30 * 1000; // 30 seconds
+
+// ── Tab definitions ───────────────────────────────────────────────────────────
+// Add or remove tabs here. `categories` maps to cmd.category values set via
+// .setCategory() on CommandBuilder. `static: true` renders a hand-written page.
+const HELP_TABS = [
+ {
+ emoji: "🏠",
+ title: "Home",
+ header: "Home Page",
+ static: true,
+ },
+ {
+ emoji: "🎵",
+ title: "Music",
+ header: "Music Commands",
+ categories: ["music"],
+ },
+ {
+ emoji: "🔧",
+ title: "Utilities",
+ header: "Utility Commands",
+ categories: ["util", "default"],
+ },
+ {
+ emoji: "ℹ️",
+ title: "Support",
+ header: "Support Info",
+ static: true,
+ },
+];
+
+function _helpHomeContent(prefix) {
+ return (
+ "**Welcome to the Remix help page.**\n\n" +
+ "Remix is an open-source music bot. It supports a variety of " +
+ "streaming services and has many features.\n\n" +
+ "We hope you enjoy using Remix!\n\n" +
+ "To get started, just click on the reactions below to find out " +
+ "more about the commands. In the case that reactions don't work " +
+ "for you, there's also the possibility to look through them by " +
+ `using \`${prefix}help \` :)\n\n` +
+ `**Tip:** Click the tab emojis to switch sections.`
+ );
+}
+
+function _helpSupportContent() {
+ return (
+ "If you need help with anything or encounter any issues, hop over to " +
+ "our support server **[Remix HQ](https://fluxer.gg/remix)**!\n" +
+ "Alternatively, you can write a dm to any of the following people:\n\n" +
+ "- **Fantic** (Community Manager)\n" +
+ "- **Shadow** (Lead Developer)\n" +
+ "- **NoLogicAlan** (Lead Developer)"
+ );
+}
+
+function _helpBuildCategoryPages(tab, allCmds, prefix) {
+ const cmds = allCmds
+ .filter(cmd => {
+ if (cmd.requirements?.some(r => r.ownerOnly)) return false;
+ return tab.categories?.includes(cmd.category ?? "default");
+ })
+ .sort((a, b) => a.name.localeCompare(b.name));
+
+ if (cmds.length === 0) return ["_No commands available._"];
+
+ const pages = [];
+ for (let i = 0; i < cmds.length; i += HELP_CMDS_PER_PAGE) {
+ const slice = cmds.slice(i, i + HELP_CMDS_PER_PAGE);
+ let page = "";
+ slice.forEach((cmd, j) => {
+ const d = (cmd.description || "No description.").split("\n")[0];
+ page += `${i + j + 1}. **${cmd.name}**: ${d}\n`;
+ });
+ page += `\nTo learn more about a command, run \`${prefix}help \`!`;
+ if (cmds.length > HELP_CMDS_PER_PAGE)
+ page += `\n\n**Tip:** Use ⬅️ ➡️ to scroll between pages.`;
+ pages.push(page);
+ }
+ return pages;
+}
+
+export class HelpCommand {
+ /**
+ * @param {import("./CommandHandler.mjs").CommandHandler} commandHandler
+ * @param {MessageHandler} messageHandler
+ * @param {function(msg: Message): import("./Settings.mjs").SettingsManager} getSettingsFn
+ * Called with a Message to retrieve that guild's settings.
+ * In index.mjs this is: (msg) => this.getSettings(msg)
+ */
+ constructor(commandHandler, messageHandler, getSettingsFn) {
+ this._commands = commandHandler;
+ this._messages = messageHandler;
+ this._getSettings = getSettingsFn;
+ }
+
+ /**
+ * Registers the help command with the CommandHandler and intercepts
+ * incoming messages whose first word is "help", "h", or "commands".
+ *
+ * Call once during bot startup, after commands have been loaded.
+ */
+ register() {
+ const HELP_ALIASES = ["help", "h", "commands"];
+
+ // Neutralize built-in help interceptor
+ this._commands.helpCommand = "\x00help";
+ const _fmt = this._commands.format.bind(this._commands);
+ this._commands.format = (text, guildId) =>
+ _fmt(text, guildId).replace(/\x00help/g, "help");
+
+ // Intercept replyHandler to swallow the "Unknown Command" error
+ // that CommandHandler emits when it sees %help but can't find it.
+ const _reply = this._commands.replyHandler.bind(this._commands);
+ this._commands.replyHandler = (message, msg) => {
+ if (typeof message === "string" && message.includes("Unknown Command")) {
+ // Check if the triggering command was a help alias — if so, drop it silently
+ const content = msg?.content ?? msg?.message?.content ?? "";
+ const guildId = msg?.channel?.channel?.guildId ?? msg?.message?.guildId;
+ const prefix = this._commands.getPrefix(guildId);
+ const botId = this._commands.client.user?.id;
+ const ping = `<@${botId}>`;
+ const pingBang = `<@!${botId}>`;
+ let body = null;
+ if (content.startsWith(prefix)) body = content.slice(prefix.length).trim();
+ else if (content.startsWith(pingBang)) body = content.slice(pingBang.length).trim();
+ else if (content.startsWith(ping)) body = content.slice(ping.length).trim();
+ if (body !== null) {
+ const first = body.split(/\s+/)[0]?.toLowerCase();
+ if (HELP_ALIASES.includes(first)) return; // silently drop
+ }
+ }
+ return _reply(message, msg);
+ };
+
+ // Safety evict in case help.mjs is still present
+ const evict = () => {
+ for (const alias of HELP_ALIASES) {
+ const i = this._commands.commandNames.indexOf(alias);
+ if (i !== -1) this._commands.commandNames.splice(i, 1);
+ }
+ const ci = this._commands.commands.findIndex(c =>
+ c.aliases.some(a => HELP_ALIASES.includes(a.toLowerCase()))
+ );
+ if (ci !== -1) this._commands.commands.splice(ci, 1);
+ };
+ evict();
+ const _add = this._commands.addCommand.bind(this._commands);
+ this._commands.addCommand = (builder) => {
+ const r = _add(builder);
+ if (builder.aliases.some(a => HELP_ALIASES.includes(a.toLowerCase()))) evict();
+ return r;
+ };
+
+ // Our sole listener for help
+ this._messages.onMessage((msg) => {
+ if (!msg?.content) return;
+ const content = msg.content.trim();
+ const guildId = msg.channel?.channel?.guildId ?? msg.message?.guildId;
+ const prefix = this._commands.getPrefix(guildId);
+ const botId = this._commands.client.user?.id;
+ const ping = `<@${botId}>`;
+ const pingBang = `<@!${botId}>`;
+ let body = null;
+ if (content.startsWith(prefix)) body = content.slice(prefix.length).trim();
+ else if (content.startsWith(pingBang)) body = content.slice(pingBang.length).trim();
+ else if (content.startsWith(ping)) body = content.slice(ping.length).trim();
+ if (body === null) return;
+
+ const args = body.split(/\s+/).map(s => s.trim()).filter(Boolean);
+ const cmdName = (args[0] ?? "").toLowerCase();
+ if (!HELP_ALIASES.includes(cmdName)) return;
+
+ this._handle(msg, args.slice(1), prefix);
+ });
+ }
+
+ // ── Internal handler ───────────────────────────────────────────────────────
+
+ _handle(msg, args, prefix) {
+ const allCmds = this._commands.commands;
+ const query = (args[0] ?? "").trim();
+
+ // ── Specific command lookup (%help play, %help settings get, …) ──────────
+ if (query && isNaN(Number(query))) {
+ // Walk subcommands: %help settings get → finds "settings" then "get"
+ let currCmd = null;
+ for (const word of [query, ...args.slice(1)]) {
+ const pool = currCmd ? currCmd.subcommands : allCmds;
+ const found = pool.find(c =>
+ c.aliases.some(a => a.toLowerCase() === word.toLowerCase())
+ );
+ if (!found) {
+ msg.replyEmbed(`❌ Unknown command \`${word}\`. Use \`${prefix}help\` to browse.`);
+ return;
+ }
+ currCmd = found;
+ }
+ if (currCmd) {
+ msg.replyEmbed(this._commands.helpHandler.getCommandHelp(currCmd, msg));
+ }
+ return;
+ }
+
+ // ── Tab jump by number (%help 2 → open tab index 1) ──────────────────────
+ const startTab = query
+ ? Math.max(0, Math.min(HELP_TABS.length - 1, parseInt(query) - 1))
+ : 0;
+
+ const paginator = new RichPaginator(msg, this._messages)
+ .setTimeout(HELP_SESSION_MS)
+ .setStartTab(startTab);
+
+ for (const tab of HELP_TABS) {
+ if (tab.static) {
+ const content = tab.title === "Home"
+ ? _helpHomeContent(prefix)
+ : _helpSupportContent();
+ paginator.addTab({ emoji: tab.emoji, title: tab.title, header: tab.header, content });
+ } else {
+ const pages = _helpBuildCategoryPages(tab, allCmds, prefix);
+ paginator.addTab({ emoji: tab.emoji, title: tab.title, header: tab.header, pages });
+ }
+ }
+
+ paginator.send();
+ }
+}
\ No newline at end of file
diff --git a/src/MoonlinkManager.mjs b/src/MoonlinkManager.mjs
new file mode 100644
index 0000000..2b14e78
--- /dev/null
+++ b/src/MoonlinkManager.mjs
@@ -0,0 +1,284 @@
+/**
+ * MoonlinkManager.mjs
+ *
+ * Wraps moonlink.js Manager with a custom connector for Fluxer.
+ * FIXED: Correct payload format for packetUpdate
+ */
+
+import { Manager } from "moonlink.js";
+import { logger } from "./constants/Logger.mjs";
+import { EventEmitter } from "node:events";
+import { Events } from "@fluxerjs/core";
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// MoonlinkManager ──────────────────────────────────────────────────────────────
+// ═══════════════════════════════════════════════════════════════════════════════
+
+export class MoonlinkManager extends EventEmitter {
+ /** @type {Manager} */
+ manager = null;
+ /** @type {string|null} */
+ sessionId = null;
+ /** @type {import("@fluxerjs/core").Client} */
+ _client = null;
+
+ /**
+ * @param {{ host: string, port: number, password: string, secure?: boolean }} nodeCfg
+ * @param {import("@fluxerjs/core").Client} client
+ */
+ constructor(nodeCfg, client) {
+ super();
+ this.setMaxListeners(50); // reconnects temporarily stack listeners during re-init
+ this._nodeCfg = nodeCfg;
+ this._client = client;
+
+ this.manager = new Manager({
+ nodes: [
+ {
+ host: nodeCfg.host ?? "localhost",
+ port: nodeCfg.port ?? 3000,
+ password: nodeCfg.password ?? "youshallnotpass",
+ secure: nodeCfg.secure ?? false,
+ identifier: "main",
+ }
+ ],
+ options: {
+ resume: true,
+ resumeTimeout: 60_000,
+ defaultPlayer: {
+ volume: 100,
+ selfDeaf: true,
+ selfMute: false,
+ autoPlay: false,
+ autoLeave: false,
+ },
+ search: {
+ defaultPlatform: "ytmsearch",
+ },
+ send: (guildId, payload) => this._sendPayload(guildId, payload),
+ },
+ });
+
+ // Set up voice state forwarding from Fluxer to moonlink
+ this._setupVoiceForwarding(client);
+
+ // Forward key events
+ this.manager.on("nodeReady", (node) => {
+ this.sessionId = node.sessionId ?? null;
+ logger.moonlink(`[Moonlink] Node ready: ${node.identifier} | session: ${this.sessionId}`);
+ this.emit("ready", this.sessionId);
+ });
+
+ this.manager.on("nodeConnected", (node) => {
+ logger.moonlink(`[Moonlink] Node connected: ${node.identifier}`);
+ });
+
+ this.manager.on("nodeDisconnect", (node, reason) => {
+ logger.warn("[Moonlink] Node disconnected:", node.identifier, reason);
+ });
+
+ this.manager.on("nodeError", (node, err) => {
+ logger.error("[Moonlink] Node error:", node.identifier, err?.message ?? err);
+ });
+
+ this.manager.on("trackStart", (player, track) => {
+ this.emit("trackStart", player, track);
+ });
+
+ this.manager.on("trackEnd", (player, track, reason) => {
+ this.emit("trackEnd", player, track, reason);
+ });
+
+ this.manager.on("queueEnd", (player) => {
+ this.emit("queueEnd", player);
+ });
+
+ this.manager.on("playerDisconnected", (player) => {
+ this.emit("playerDisconnected", player);
+ });
+ }
+
+ /**
+ * Send voice payload to Discord via Fluxer's WebSocket
+ * @param {string} guildId
+ * @param {{ op: number, d: object }} payload
+ * @private
+ */
+ _sendPayload(guildId, payload) {
+ try {
+ const shard = this._client?.ws?.shards?.get?.(0);
+ if (!shard) {
+ logger.warn("[MoonlinkManager] No WebSocket shard available");
+ return;
+ }
+
+ if (typeof shard.send === "function") {
+ shard.send(payload);
+ } else if (shard.ws?.send) {
+ shard.ws.send(JSON.stringify(payload));
+ } else {
+ logger.warn("[MoonlinkManager] Cannot send - no valid send method found");
+ }
+ } catch (e) {
+ logger.warn("[MoonlinkManager] Send error:", e.message);
+ }
+ }
+
+ /**
+ * Forward voice state updates from Fluxer to moonlink
+ * @param {import("@fluxerjs/core").Client} client
+ * @private
+ */
+ _setupVoiceForwarding(client) {
+ // @fluxerjs/core emits VoiceStateUpdate with a SINGLE argument:
+ // (data: GatewayVoiceStateUpdateDispatchData) — raw gateway snake_case fields.
+ // This is NOT discord.js style (oldState, newState).
+ client.on(Events.VoiceStateUpdate, (data) => {
+ try {
+ // data is the raw GatewayVoiceStateUpdateDispatchData — always snake_case
+ const guildId = data.guild_id;
+ if (!guildId) {
+ logger.warn("[MoonlinkManager] voiceStateUpdate: No guild_id found in data", data);
+ return;
+ }
+
+ // Build the proper payload format that moonlink expects:
+ // { op: 0, t: "VOICE_STATE_UPDATE", d: { guild_id, user_id, channel_id, ... } }
+ const payload = {
+ op: 0, // Dispatch
+ t: "VOICE_STATE_UPDATE",
+ d: {
+ guild_id: guildId,
+ channel_id: data.channel_id ?? null,
+ user_id: data.user_id,
+ session_id: data.session_id ?? "",
+ deaf: data.deaf ?? false,
+ mute: data.mute ?? false,
+ self_deaf: data.self_deaf ?? false,
+ self_mute: data.self_mute ?? false,
+ self_stream: data.self_stream ?? false,
+ self_video: data.self_video ?? false,
+ suppress: data.suppress ?? false,
+ member: data.member ?? null,
+ }
+ };
+
+ this.manager.packetUpdate(payload);
+ } catch (e) {
+ logger.warn("[MoonlinkManager] voiceStateUpdate forward error:", e.message);
+ }
+ });
+
+ // Raw WS — only for VOICE_SERVER_UPDATE (VOICE_STATE_UPDATE is handled above via Events listener)
+ // Store the handler reference so we can remove the stale listener before re-attaching
+ // on gateway reconnects. Without this, each reconnect stacks another handler on the socket.
+ const attachRawWs = () => {
+ try {
+ const shard0 = client.ws?.shards?.get?.(0);
+ const wsObj = shard0?.ws ?? null;
+ if (!wsObj) return;
+
+ // Remove previous handler if any
+ if (this._rawWsHandler) {
+ try {
+ if (typeof wsObj.removeEventListener === "function") wsObj.removeEventListener("message", this._rawWsHandler);
+ else if (typeof wsObj.off === "function") wsObj.off("message", this._rawWsHandler);
+ } catch (_) {}
+ }
+
+ this._rawWsHandler = (rawData) => {
+ try {
+ const text = typeof rawData === "string" ? rawData : rawData?.data;
+ const payload = typeof text === "string" ? JSON.parse(text) : rawData;
+ if (payload?.t === "VOICE_SERVER_UPDATE") {
+ if (!payload.d?.guild_id) {
+ logger.warn("[MoonlinkManager] VOICE_SERVER_UPDATE: Missing guild_id", payload);
+ return;
+ }
+ this.manager.packetUpdate(payload);
+ }
+ } catch (_) {}
+ };
+
+ if (typeof wsObj.addEventListener === "function") {
+ wsObj.addEventListener("message", this._rawWsHandler);
+ } else if (typeof wsObj.on === "function") {
+ wsObj.on("message", this._rawWsHandler);
+ }
+ } catch (e) {
+ logger.warn("[MoonlinkManager] Raw WS setup error:", e.message);
+ }
+ };
+
+ attachRawWs();
+ // Re-attach after every gateway reconnect so the new socket gets the listener
+ client.on(Events.Ready, attachRawWs);
+ }
+
+ /**
+ * Call after client.login() resolves and client.user.id is available.
+ * Safe to call on every reconnect — removes stale internal listeners before re-init
+ * to prevent the MaxListenersExceededWarning that moonlink.js triggers by adding
+ * a new nodeReady/nodeConnected listener to the node socket on every init() call.
+ * @param {string} clientId
+ */
+ async init(clientId) {
+ // Raise the limit on both this emitter and the internal manager so reconnects
+ // don't spam MaxListenersExceededWarning while we're between socket teardown
+ // and the re-init completing.
+ this.setMaxListeners(50);
+ try { this.manager.setMaxListeners?.(50); } catch (_) {}
+
+ // Strip any stale nodeReady listeners the previous init() call registered
+ // so they don't stack up across gateway reconnects.
+ try {
+ for (const node of this.manager.nodes?.nodes?.values?.() ?? []) {
+ const sock = node.socket ?? node.ws ?? null;
+ if (sock && typeof sock.removeAllListeners === "function") {
+ sock.removeAllListeners("open");
+ sock.removeAllListeners("close");
+ sock.removeAllListeners("error");
+ sock.removeAllListeners("message");
+ }
+ }
+ } catch (_) {}
+
+ await this.manager.init(clientId);
+ }
+
+ /**
+ * Search for tracks. Returns a moonlink SearchResult.
+ * @param {string} query
+ * @param {string} [source] e.g. "ytmsearch", "spsearch"
+ * @param {*} [requester]
+ */
+ search(query, source, requester) {
+ return this.manager.search({ query, source, requester });
+ }
+
+ /**
+ * Get or create a moonlink Player for a guild.
+ * @param {{ guildId: string, voiceChannelId: string, textChannelId?: string, volume?: number }} opts
+ * @returns {import("moonlink.js").Player}
+ */
+ createPlayer(opts) {
+ return this.manager.players.create(opts);
+ }
+
+ /**
+ * Get an existing player by guildId.
+ * @param {string} guildId
+ * @returns {import("moonlink.js").Player|undefined}
+ */
+ getPlayer(guildId) {
+ return this.manager.players.get(guildId);
+ }
+
+ destroy() {
+ try {
+ for (const node of this.manager.nodes.nodes.values()) {
+ node.socket?.close?.();
+ }
+ } catch (_) {}
+ }
+}
\ No newline at end of file
diff --git a/src/Player.mjs b/src/Player.mjs
new file mode 100644
index 0000000..2b4be3b
--- /dev/null
+++ b/src/Player.mjs
@@ -0,0 +1,1606 @@
+/**
+ * Player.mjs — moonlink.js + revoice.js edition
+ *
+ * Track resolution → moonlink.js Manager (search / load via NodeLink REST)
+ * Session handling → moonlink.js (WebSocket to NodeLink, session ID, player state)
+ * Audio playback → revoice.js (LiveKit voice connection → Fluxer VC)
+ *
+ */
+
+import Revoicejs from "revoice.js";
+const { MediaPlayer } = Revoicejs;
+import { joinVoiceChannel, getVoiceManager } from "@fluxerjs/voice";
+import { Utils } from "./Utils.mjs";
+import { EventEmitter } from "node:events";
+import meta from "./probe.mjs";
+import { Worker } from "node:worker_threads";
+import http from "node:http";
+import https from "node:https";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "./MessageHandler.mjs";
+import { logger } from "./constants/Logger.mjs";
+import { PROVIDER_NAMES } from "./constants/providers.mjs";
+
+/** Emit a plain embed payload so listeners can send it directly */
+function mkEmbed(desc) {
+ return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] };
+}
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// Queue Class
+// ═══════════════════════════════════════════════════════════════════════════════
+
+export class Queue extends EventEmitter {
+ data = [];
+ current = null;
+ loop = false;
+ songLoop = false;
+
+ constructor() {
+ super();
+ }
+
+ isEmpty() { return this.data.length === 0; }
+ size() { return this.data.length; }
+
+ next() {
+ const previous = this.current;
+
+ if (this.songLoop && this.current) return this.current;
+ if (this.loop && this.current) this.data.push(this.current);
+
+ if (this.isEmpty()) {
+ this.current = null;
+ return null;
+ }
+
+ this.current = this.data.shift();
+ this.emit("queue", {
+ type: "update",
+ data: { current: this.current, old: previous, loop: this.loop }
+ });
+ return this.current;
+ }
+
+ remove(idx) {
+ if (idx < 0 || idx >= this.data.length) return "Index out of bounds";
+ const title = this.data[idx].title;
+ const removed = this.data.splice(idx, 1);
+ this.emit("queue", { type: "remove", data: { index: idx, old: this.data.slice(), removed, new: this.data } });
+ return `Successfully removed **${title}** from the queue.`;
+ }
+
+ move(from, to) {
+ if (from < 0 || from >= this.data.length) return "Source index out of bounds";
+ if (to < 0 || to >= this.data.length) return "Target index out of bounds";
+ if (from === to) return "Track is already in that position";
+ const [track] = this.data.splice(from, 1);
+ this.data.splice(to, 0, track);
+ this.emit("queue", { type: "move", data: { from, to, track } });
+ return `Moved **${track.title}** from position ${from + 1} to ${to + 1}.`;
+ }
+
+ addFirst(data) { return this.add(data, true); }
+
+ add(data, top = false) {
+ this.emit("queue", { type: "add", data: { append: !top, data } });
+ return top ? this.data.unshift(data) : this.data.push(data);
+ }
+
+ addMany(tracks, top = false) {
+ if (!tracks?.length) return 0;
+ if (top) {
+ for (let i = tracks.length - 1; i >= 0; i--) this.data.unshift(tracks[i]);
+ } else {
+ this.data.push(...tracks);
+ }
+ this.emit("queue", { type: "addMany", data: { append: !top, tracks } });
+ return tracks.length;
+ }
+
+ clear() { this.data.length = 0; }
+ reset() { this.clear(); this.current = null; this.songLoop = false; this.loop = false; }
+
+ setSongLoop(bool) { this.songLoop = bool; }
+ setLoop(bool) { this.loop = bool; }
+
+ toggleLoop(loop) {
+ if (loop === "song") { this.setSongLoop(!this.songLoop); return this.songLoop; }
+ if (loop === "queue") { this.setLoop(!this.loop); return this.loop; }
+ return null;
+ }
+
+ shuffle() {
+ Utils.shuffleArr(this.data);
+ this.emit("queue", { type: "shuffle", data: this.data });
+ }
+
+ getCurrent() { return this.current; }
+ getQueue() { return this.data; }
+
+ getPage(page = 1, pageSize = 10) {
+ const total = this.data.length;
+ const totalPages = Math.max(1, Math.ceil(total / pageSize));
+ const safePage = Utils.clamp(page, 1, totalPages);
+ const start = (safePage - 1) * pageSize;
+ return { items: this.data.slice(start, start + pageSize), page: safePage, totalPages, total, start };
+ }
+}
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// Player Class
+// ═══════════════════════════════════════════════════════════════════════════════
+
+export default class Player extends EventEmitter {
+ /** @type {import("revoice.js").VoiceConnection|null} */
+ connection = null;
+ _guildId = null;
+ _channelId = null;
+
+ // Components
+ queue = null;
+ client = null;
+ settings = null;
+ config = {};
+ spotifyConfig = null;
+
+ // revoice.js instances
+ /** @type {import("revoice.js").MediaPlayer|null} */
+ _mediaPlayer = null;
+
+ // moonlink.js manager reference (set by PlayerManager)
+ /** @type {import("./MoonlinkManager.mjs").MoonlinkManager|null} */
+ _moonlink = null;
+
+ // Playback state
+ leaving = false;
+ _paused = false;
+ _playingNext = false;
+ _isRecovering = false;
+ startedPlaying = null;
+ // searches Map with max-size eviction to prevent memory leak on busy servers
+ searches = new Map();
+ _searchOrder = []; // insertion-order tracker for LRU eviction
+ _searchMaxSize = 50; // cap: max concurrent pending search sessions
+ resultLimit = 5;
+ preferredVolume = 1;
+
+ // Streaming state
+ _streamingStopped = false;
+ _skipping = false;
+ _currentPassthrough = null;
+ _wasRadio = false;
+ _radioAnnounced = false;
+
+ // Inactivity timeout
+ _inactivityTimer = null;
+ _inactivityLimit = 3 * 60 * 1000; // 3 min default
+
+ // Join mutex — prevents concurrent join() calls from racing each other
+ _isJoining = false;
+
+ // NodeLink config (kept for direct stream URL building; session managed by moonlink)
+ _nl = {
+ host: "localhost",
+ port: 3000,
+ password: "youshallnotpass",
+ sessionId: null,
+ };
+
+ constructor(token, opts = {}) {
+ super();
+
+ this.queue = new Queue();
+ this.client = opts.client;
+ this.config = opts.config ?? {};
+ this.spotifyConfig = opts.config?.spotify;
+ this.settings = opts.settings ?? null;
+ this.settingsMgr = opts.settingsMgr ?? null;
+ this._observedVoiceUsers = opts.observedVoiceUsers ?? null;
+
+ // Merge NodeLink config (for stream URL building)
+ this._nl = {
+ ...this._nl,
+ ...(this.config?.nodelink ?? {}),
+ ...(opts.nodelink ?? {}),
+ };
+
+ // Set inactivity limit — checks config.timers.inactivityTimeout first, then legacy config.inactivityTimeout
+ const inactivityMs = this.config?.timers?.inactivityTimeout ?? this.config?.inactivityTimeout;
+ if (inactivityMs !== undefined) {
+ this._inactivityLimit = inactivityMs;
+ }
+
+ // moonlink.js manager reference — injected by PlayerManager
+ this._moonlink = opts.moonlink ?? null;
+
+ // Keep session ID in sync when moonlink establishes/re-establishes it.
+ // Use a named handler stored on the instance so it can be removed in destroy()
+ // and doesn't stack up across player replacements on the same moonlink instance.
+ if (this._moonlink) {
+ this._onMoonlinkReady = (sessionId) => {
+ this._nl.sessionId = sessionId;
+ };
+ this._moonlink.on("ready", this._onMoonlinkReady);
+ if (this._moonlink.sessionId) {
+ this._nl.sessionId = this._moonlink.sessionId;
+ }
+ }
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // 24/7 Mode Check
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Check if 24/7 mode is enabled for this guild.
+ * @private
+ */
+ _is247Enabled() {
+ if (!this._guildId) return false;
+
+ // Helper: check a single settings object
+ const checkSettings = (set) => {
+ if (!set?.get) return false;
+ const raw = set.get("stay_247");
+ if (!raw || raw === "none") return false;
+ const channels = Array.isArray(raw)
+ ? raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean)
+ : [String(raw).replace(/\D/g, "")];
+ const currentChannel = String(this._channelId).replace(/\D/g, "");
+ if (!channels.includes(currentChannel)) return false;
+ const mode = set.get("stay_247_mode") ?? "auto";
+ return mode === "on" || mode === "auto";
+ };
+
+ if (this.settingsMgr?.getServer) return checkSettings(this.settingsMgr.getServer(this._guildId));
+ if (this.settings?.get) return checkSettings(this.settings);
+ if (this.client?.settings?.getServer) return checkSettings(this.client.settings.getServer(this._guildId));
+ return false;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Volume Restore
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ _restoreVolume() {
+ if (!this._guildId) return;
+ let savedVol = null;
+
+ if (this.settings?.get) {
+ savedVol = this.settings.get("volume");
+ } else if (this.settingsMgr?.getServer) {
+ const set = this.settingsMgr.getServer(this._guildId);
+ savedVol = set?.get?.("volume");
+ } else if (this.client?.settings?.getServer) {
+ savedVol = this.client.settings.getServer(this._guildId)?.get?.("volume");
+ } else if (this.client?.settings?.get) {
+ const s = this.client.settings.get(this._guildId);
+ savedVol = s?.get?.("volume") ?? s?.volume;
+ }
+
+ if (savedVol !== undefined && savedVol !== null) {
+ this.preferredVolume = Utils.clamp(savedVol / 100, 0, 1);
+ logger.player(`[Player] Restored volume ${savedVol}% for guild ${this._guildId}`);
+ }
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Connection Recovery
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ async _recoverConnection() {
+ if (this._isRecovering) return;
+ this._isRecovering = true;
+ logger.mediaplayer(`[Player] Attempting to recover voice connection for ${this._guildId}`);
+
+ try {
+ if (this.connection) {
+ try { await this.connection.disconnect(); } catch (_) {}
+ }
+
+ await Utils.sleep(2000);
+ if (this.leaving) return;
+
+ logger.mediaplayer(`[Player] Rejoining channel ${this._channelId}`);
+ await this.join(this._channelId);
+
+ // Resume playing the interrupted track
+ const current = this.queue.getCurrent();
+ if (current) {
+ logger.player(`[Player] Resuming track after recovery: ${current.title}`);
+ this.queue.data.unshift(current);
+ this.queue.current = null;
+ this._playingNext = false;
+ await this.playNext();
+ } else if (!this.queue.isEmpty()) {
+ this._playingNext = false;
+ await this.playNext();
+ }
+ } catch (e) {
+ logger.error("[Player] Recovery failed:", e.message);
+ this.emit("autoleave"); // Fallback to full recreate if recovery fails entirely
+ } finally {
+ this._isRecovering = false;
+ }
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Inactivity Timer
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Returns true if there is at least one non-bot human in the bot's current voice channel.
+ * Uses the observedVoiceUsers map maintained by the gateway voice state handler,
+ * since this bot uses intents: 0 and channel.members is never populated.
+ */
+ _hasHumansInChannel() {
+ if (!this._channelId || !this._guildId) return false;
+ // Normalize to digits-only — IDs can arrive from different sources
+ // (gateway snake_case vs API camelCase) with inconsistent formatting.
+ const cleanChan = String(this._channelId).replace(/\D/g, "");
+ const cleanGuild = String(this._guildId).replace(/\D/g, "");
+ try {
+ const voiceUsers = this._observedVoiceUsers;
+ if (voiceUsers) {
+ for (const [, info] of voiceUsers) {
+ if (
+ String(info.guildId ?? "").replace(/\D/g, "") === cleanGuild &&
+ String(info.channelId ?? "").replace(/\D/g, "") === cleanChan
+ ) return true;
+ }
+ return false;
+ }
+ } catch (_) {}
+ // Fallback: try channel.members cache (works if privileged intents are enabled)
+ try {
+ const channel = this.client?.channels?.cache?.get(this._channelId);
+ const members = channel?.members;
+ if (members) {
+ const iter = typeof members.values === "function" ? members.values() : Object.values(members);
+ for (const entry of iter) {
+ const isBot = entry?.user?.bot ?? entry?.member?.user?.bot ?? false;
+ if (!isBot) return true;
+ }
+ }
+ } catch (_) {}
+ return false;
+ }
+
+ _startInactivityTimer() {
+ this._stopInactivityTimer();
+ if (this._inactivityLimit <= 0) return;
+
+ const is247 = this._is247Enabled();
+ logger.inactivity(`[Player] Checking 24/7 mode for guild ${this._guildId}: ${is247}`);
+
+ if (is247) {
+ logger.inactivity(`[Player] 24/7 mode active for guild ${this._guildId}, skipping inactivity timer`);
+ return;
+ }
+
+ // Don't start the inactivity timer if there are humans in the channel
+ if (this._hasHumansInChannel()) {
+ logger.inactivity(`[Player] Humans present in channel ${this._channelId}, skipping inactivity timer`);
+ return;
+ }
+
+ logger.inactivity(`[Player] Starting inactivity timer for guild ${this._guildId} (${this._inactivityLimit / 1000}s)`);
+ this._inactivityTimer = setTimeout(() => {
+ if (this._is247Enabled()) {
+ logger.inactivity("[Player] 24/7 mode enabled during inactivity wait, aborting leave");
+ return;
+ }
+ // Double-check: abort if a human joined during the wait
+ if (this._hasHumansInChannel()) {
+ logger.inactivity("[Player] Human joined during inactivity wait, aborting leave");
+ return;
+ }
+ logger.inactivity(`[Player] Guild ${this._guildId} inactive too long. Leaving.`);
+ this.emit("autoleave");
+ }, this._inactivityLimit);
+ }
+
+ _stopInactivityTimer() {
+ if (this._inactivityTimer) {
+ logger.inactivity(`[Player] Stopping inactivity timer for guild ${this._guildId}`);
+ clearTimeout(this._inactivityTimer);
+ this._inactivityTimer = null;
+ }
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // MediaPlayer Management
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ async _ensureMediaPlayer() {
+ if (!this.connection) {
+ logger.mediaplayer("[Player] No connection available");
+ return false;
+ }
+
+ const room = this.connection.room;
+ if (!room) {
+ logger.mediaplayer("[Player] No room available");
+ return false;
+ }
+
+ logger.mediaplayer(`[Player] _ensureMediaPlayer: attempting to create MediaPlayer (room.state: ${room.state})`);
+
+ if (this._mediaPlayer) {
+ const room = this.connection?.room;
+ const roomAlive = room && room.state !== "disconnected" && room.state !== "failed" && room.state !== 0;
+ const mpAlive = !this._mediaPlayer.destroyed && typeof this._mediaPlayer.playStream === "function";
+
+ if (roomAlive && mpAlive) {
+ logger.mediaplayer("[Player] Reusing healthy MediaPlayer");
+ return true;
+ }
+
+ logger.mediaplayer("[Player] Existing MediaPlayer unhealthy, cleaning up...");
+ await this._cleanupMediaPlayer();
+ }
+
+ try {
+ this._mediaPlayer = new MediaPlayer();
+ this._mediaPlayer.setMaxListeners(0);
+ this._setupMediaPlayerMonitoring();
+
+ await this._mediaPlayer.publishToRoom(room);
+ logger.mediaplayer("[Player] MediaPlayer published successfully");
+ return true;
+ } catch (e) {
+ logger.error("[Player] publishToRoom failed:", e.message);
+ this._mediaPlayer = null;
+ return false;
+ }
+ }
+
+ /**
+ * Monitor MediaPlayer for ghost connections via event — not polling.
+ * The connection.on("disconnected") handler in join() already calls
+ * _cleanupMediaPlayer() + _recoverConnection(), so this method is intentionally
+ * lightweight: it only validates the room state once before playing.
+ * @private
+ */
+ _setupMediaPlayerMonitoring() {
+ // No-op: recovery is fully handled by connection.on("disconnected") in join().
+ // The old setInterval(5000) approach polled LiveKit state unnecessarily and
+ // risked acting on a stale captured MediaPlayer reference.
+ }
+
+ /**
+ * Clean up MediaPlayer properly.
+ * @private
+ */
+ async _cleanupMediaPlayer() {
+ try {
+ await this._mediaPlayer?.stop();
+ } catch (_) {}
+
+ this._mediaPlayer = null;
+ }
+
+ async _stopMediaPlayer() {
+ this._streamingStopped = true;
+
+ if (this._currentPassthrough) {
+ try {
+ const stream = this._currentPassthrough;
+ this._currentPassthrough = null;
+ if (typeof stream.unpipe === "function") stream.unpipe();
+ if (typeof stream.destroy === "function") stream.destroy();
+ } catch (e) {
+ logger.error("[Player] Error destroying passthrough:", e.message);
+ }
+ }
+
+ if (this._mediaPlayer) {
+ try {
+ this._mediaPlayer.removeAllListeners("finish");
+ this._mediaPlayer.removeAllListeners("error");
+ await this._mediaPlayer.stop();
+ } catch (e) {
+ logger.error("[Player] Error stopping media player:", e.message);
+ }
+
+ await new Promise(r => setTimeout(r, 150));
+ }
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // HTTP/Stream Helpers
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ async _request(url, options = {}, returnStream = false) {
+ return new Promise((resolve, reject) => {
+ const fetchUrl = (target) => {
+ const urlObj = new URL(target);
+ const client = urlObj.protocol === "https:" ? https : http;
+
+ const req = client.request({
+ protocol: urlObj.protocol,
+ host: urlObj.hostname,
+ port: urlObj.port,
+ path: urlObj.pathname + urlObj.search,
+ method: options.method || "GET",
+ headers: {
+ "User-Agent": "Mozilla/5.0 (compatible; Bot/1.0)",
+ "Accept": "*/*",
+ "Authorization": this._nl.password,
+ ...options.headers,
+ },
+ }, (res) => {
+ if ([301, 302, 307, 308].includes(res.statusCode)) {
+ let loc = res.headers.location;
+ if (!loc) return reject(new Error("Redirect without location"));
+ if (loc.startsWith("/")) loc = `${urlObj.protocol}//${urlObj.host}${loc}`;
+ return fetchUrl(loc);
+ }
+ if (res.statusCode !== 200 && res.statusCode !== 204) {
+ res.resume();
+ return reject(new Error(`HTTP ${res.statusCode} at ${target}`));
+ }
+ if (returnStream) return resolve(res);
+
+ const chunks = [];
+ res.on("data", d => chunks.push(d));
+ res.on("end", () => {
+ try { resolve(JSON.parse(Buffer.concat(chunks).toString())); }
+ catch (e) { reject(new Error(`JSON parse error from ${target}`)); }
+ });
+ });
+
+ req.on("error", reject);
+ req.setTimeout(options.timeout || 30_000, () => {
+ req.destroy();
+ reject(new Error("Request timeout"));
+ });
+ if (options.body) req.write(options.body);
+ req.end();
+ };
+ fetchUrl(url);
+ });
+ }
+
+ async _fetchStream(url) {
+ return this._request(url, {
+ headers: {
+ ...(this._nl.sessionId ? { "Session-Id": this._nl.sessionId } : {}),
+ ...(this._guildId ? { "Guild-Id": this._guildId } : {}),
+ }
+ }, true);
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Audio Streaming (revoice.js)
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ async _streamViaRevoice(url) {
+ this._streamingStopped = false;
+ let audioStream = null;
+
+ try {
+ audioStream = await this._fetchStream(url);
+ this._currentPassthrough = audioStream;
+
+ const cleanup = () => {
+ if (audioStream) {
+ try {
+ if (typeof audioStream.unpipe === "function") audioStream.unpipe();
+ if (typeof audioStream.destroy === "function") audioStream.destroy();
+ } catch (_) {}
+ }
+ this._currentPassthrough = null;
+ };
+
+ await new Promise((resolve, reject) => {
+ audioStream.on("error", (e) => {
+ cleanup();
+ if (this._streamingStopped || this._skipping) return resolve();
+ const graceful = ["aborted", "ECONNRESET", "ERR_STREAM_DESTROYED", "ENOTFOUND", "ETIMEDOUT", "ECONNREFUSED"];
+ if (graceful.includes(e.code) || graceful.includes(e.message)) return resolve();
+ reject(e);
+ });
+
+ if (!this._mediaPlayer) { cleanup(); return resolve(); }
+
+ this._mediaPlayer.removeAllListeners("finish");
+ this._mediaPlayer.removeAllListeners("error");
+
+ // revoice.js MediaPlayer.playStream() pipes through FFmpeg but the FFmpeg
+ // error handler is a no-op (// TODO). Wire it up manually so errors surface.
+ const onFfmpegError = (err) => {
+ logger.error("[Player] FFmpeg error:", err?.message ?? err);
+ cleanup();
+ if (this._streamingStopped || this._skipping) return resolve();
+ reject(new Error(`FFmpeg: ${err?.message ?? err}`));
+ };
+
+ try {
+ this._mediaPlayer.playStream(audioStream);
+ if (this._mediaPlayer.fProc) {
+ this._mediaPlayer.fProc.once("error", onFfmpegError);
+ }
+ } catch (e) {
+ cleanup();
+ if (e.message?.includes("InvalidState") || e.message?.includes("capture frame")) {
+ logger.mediaplayer("[Player] Suppressed InvalidState during stream start");
+ return resolve();
+ }
+ return reject(e);
+ }
+
+ // Safety timeout — FFmpeg errors emit nothing in revoice.js, this ensures
+ // the queue always advances even if a future silent failure slips through.
+ const safetyMs = 10 * 60 * 1000;
+ const safetyTimer = setTimeout(() => {
+ logger.warn("[Player] Stream safety timeout — advancing queue");
+ cleanup();
+ resolve();
+ }, safetyMs);
+
+ this._mediaPlayer.once("finish", () => {
+ clearTimeout(safetyTimer);
+ if (this._mediaPlayer?.fProc) this._mediaPlayer.fProc.removeListener("error", onFfmpegError);
+ cleanup();
+ resolve();
+ });
+ this._mediaPlayer.once("error", (e) => {
+ clearTimeout(safetyTimer);
+ if (this._mediaPlayer?.fProc) this._mediaPlayer.fProc.removeListener("error", onFfmpegError);
+ cleanup();
+ if (e.message?.includes("InvalidState") || e.message?.includes("capture frame")) {
+ logger.mediaplayer("[Player] Suppressed InvalidState during playback");
+ if (this._streamingStopped) return resolve();
+ return;
+ }
+ if (this._streamingStopped) return resolve();
+ reject(e);
+ });
+ });
+
+ } catch (e) {
+ if (audioStream && !audioStream.destroyed) {
+ try { audioStream.destroy(); } catch (_) {}
+ }
+ this._currentPassthrough = null;
+ if (e.message?.includes("InvalidState") || e.message?.includes("capture frame")) {
+ logger.mediaplayer("[Player] Suppressed InvalidState in stream setup");
+ return;
+ }
+ if (this._streamingStopped) return;
+ throw e;
+ }
+ }
+
+ async _streamUrl(url) {
+ const isNodeLink = url.includes(`${this._nl.host}:${this._nl.port}`) ||
+ url.includes("/v4/trackstream");
+
+ if (!isNodeLink) return this._streamViaRevoice(url);
+
+ // NodeLink /v4/trackstream returns { "url": "https://..." } — a JSON wrapper
+ // pointing to the actual CDN audio URL. Extract it then stream that.
+ try {
+ const json = await this._request(url, {
+ headers: {
+ ...(this._nl.sessionId ? { "Session-Id": this._nl.sessionId } : {}),
+ ...(this._guildId ? { "Guild-Id": this._guildId } : {}),
+ }
+ });
+ if (!json?.url) throw new Error(`NodeLink gave no URL: ${JSON.stringify(json)}`);
+ logger.player(`[Player] NodeLink resolved stream URL`);
+ return this._streamViaRevoice(json.url);
+ } catch (err) {
+ logger.error("[Player] NodeLink resolve error:", err.message);
+ throw err;
+ }
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Voice Connection (revoice.js)
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ async join(channelId) {
+ if (this._isJoining) {
+ logger.player(`[Player] Busy joining. Ignoring: ${channelId}`);
+ return;
+ }
+ if (this.connection && this._channelId === channelId) {
+ const state = this.connection.room?.state;
+ if (state === 1 || state === "connected") {
+ logger.player(`[Player] Already in channel: ${channelId}`);
+ return;
+ }
+ logger.mediaplayer(`[Player] Connection in bad state (${state}), reconnecting...`);
+ try { await this.connection.disconnect(); } catch (_) {}
+ this.connection = null;
+ this._mediaPlayer = null;
+ }
+
+ this._isJoining = true;
+ try {
+ const channel = this.client?.channels?.cache?.get(channelId);
+ if (!channel) throw new Error(`Channel not found: ${channelId}`);
+
+ if (this.connection) {
+ logger.mediaplayer("[Player] Cleaning up existing connection before join");
+ try {
+ await this.connection.disconnect();
+ await Utils.sleep(500);
+ } catch (_) {}
+ this.connection = null;
+ this._mediaPlayer = null;
+ }
+
+ const connection = await joinVoiceChannel(this.client, channel);
+ this.connection = connection;
+ this._channelId = channelId;
+ this._guildId = channel.guildId;
+ this.leaving = false;
+
+ const room = connection.room;
+ if (room) {
+ logger.mediaplayer("[Player] Waiting for LiveKit room to connect...");
+
+ let connected = false;
+
+ if (room.state === "connected" || room.state === 1) {
+ logger.mediaplayer("[Player] Room appears connected");
+ connected = true;
+ } else {
+ try {
+ await new Promise((resolve, reject) => {
+ const timeout = setTimeout(() => {
+ room.off("connectionStateChanged", onStateChange);
+ reject(new Error("LiveKit connection timeout"));
+ }, 15_000);
+
+ const onStateChange = (state) => {
+ logger.mediaplayer(`[Player] LiveKit state changed: ${state}`);
+ if (state === "connected" || state === 1 || state === "connecting") {
+ clearTimeout(timeout);
+ room.off("connectionStateChanged", onStateChange);
+ connected = true;
+ resolve();
+ } else if (state === "disconnected" || state === 0 || state === "failed") {
+ clearTimeout(timeout);
+ room.off("connectionStateChanged", onStateChange);
+ reject(new Error(`LiveKit failed: ${state}`));
+ }
+ };
+
+ room.on("connectionStateChanged", onStateChange);
+ });
+ } catch (err) {
+ logger.error("[Player] LiveKit connection failed:", err.message);
+ throw err;
+ }
+ }
+
+ await Utils.sleep(300);
+ logger.mediaplayer("[Player] Proceeding to create MediaPlayer (trusting connection event)");
+ } else {
+ throw new Error("No room available after joinVoiceChannel");
+ }
+
+ connection.on("error", (err) => {
+ const causeStr = err?.cause ? ` (Cause: ${err.cause})` : "";
+ logger.error("[Player] Voice error:", err?.message ?? err, causeStr);
+ this._cleanupMediaPlayer();
+ });
+
+ connection.on("disconnected", () => {
+ if (!this.leaving) {
+ logger.mediaplayer("[Player] Unexpected disconnect detected");
+ this._cleanupMediaPlayer();
+ this._recoverConnection(); // Trigger recovery instead of giving up
+ } else {
+ try { connection.destroy(); } catch (_) {}
+ }
+ });
+
+ try {
+ const vm = getVoiceManager(this.client);
+ vm.updateVoiceState(channelId, { self_deaf: true, self_mute: false });
+ } catch (e) {
+ logger.warn("[Player] Self-deafen failed:", e.message);
+ }
+
+ const playerReady = await this._ensureMediaPlayer();
+ if (!playerReady) {
+ logger.mediaplayer("[Player] First MediaPlayer attempt failed, retrying after delay...");
+ await Utils.sleep(1000);
+ const retryReady = await this._ensureMediaPlayer();
+ if (!retryReady) throw new Error("Failed to create MediaPlayer after retry");
+ }
+
+ this._restoreVolume();
+ this.emit("roomfetched");
+ logger.player(`[Player] Voice connected to ${channel.name}`);
+
+ if (!this.queue.isEmpty() && !this.queue.getCurrent()) {
+ this.playNext();
+ } else if (this.queue.isEmpty()) {
+ setTimeout(() => {
+ if (this.queue.isEmpty() && !this.queue.getCurrent()) {
+ this._startInactivityTimer();
+ }
+ }, 3000);
+ }
+
+ } catch (e) {
+ const causeStr = e.cause ? ` (Cause: ${e.cause})` : "";
+ logger.error("[Player] Join failed:", e.message, causeStr);
+
+ if (this.connection) {
+ try { this.connection.destroy(); } catch (_) {}
+ this.connection = null;
+ }
+ throw e;
+ } finally {
+ this._isJoining = false;
+ }
+ }
+
+ async leave() {
+ if (!this.connection) return false;
+ try {
+ this.leaving = true;
+ this._stopInactivityTimer();
+ await this._stopMediaPlayer();
+ await Utils.sleep(100);
+ await this.connection.disconnect();
+ this.queue.reset();
+ this.connection = null;
+ this._mediaPlayer = null;
+ this._paused = false;
+ this._playingNext = false;
+ this.leaving = false;
+ } catch (e) {
+ logger.error("[Player] leave error:", e.message);
+ return false;
+ }
+ this.emit("leave");
+ return true;
+ }
+
+ destroy() {
+ try {
+ // Remove the moonlink "ready" listener registered in the constructor
+ // so it doesn't stack up across player replacements on the same manager.
+ if (this._moonlink && this._onMoonlinkReady) {
+ try { this._moonlink.off("ready", this._onMoonlinkReady); } catch (_) {}
+ this._onMoonlinkReady = null;
+ }
+ this.leaving = true;
+ this._streamingStopped = true;
+ this._stopInactivityTimer();
+ // _stopMediaPlayer is async; we fire it and swallow the promise here
+ // (destroy is intentionally sync/fire-and-forget), but we do wait for it
+ // before disconnecting via the chained .then so the media player stops
+ // cleanly before the connection tears down — preventing "AudioSource is closed" errors.
+ this._stopMediaPlayer().catch(() => {}).then(() => {
+ setTimeout(() => {
+ const disconnectPromise = this.connection?.disconnect?.();
+ if (disconnectPromise instanceof Promise) {
+ disconnectPromise.catch((err) => {
+ logger.error("[Player] Deferred disconnect failed:", err.message);
+ });
+ }
+ this.connection = null;
+ }, 100);
+ });
+ } catch (e) {
+ logger.error("[Player] destroy error:", e.message);
+ }
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Playback Controls
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ get paused() { return this._paused; }
+
+ pause() {
+ if (!this.connection || !this.queue.getCurrent())
+ return ":negative_squared_cross_mark: There's nothing playing at the moment!";
+ if (this._paused)
+ return ":negative_squared_cross_mark: Already paused!";
+ this._paused = true;
+ this._mediaPlayer?.pause();
+ this.emit("playback", false);
+
+ // patiently waits in the VC forever until you resume!
+ this._stopInactivityTimer();
+
+ return ":pause_button: Paused";
+ }
+
+ resume() {
+ if (!this.connection || !this.queue.getCurrent())
+ return ":negative_squared_cross_mark: There's nothing playing at the moment!";
+ if (!this._paused)
+ return ":negative_squared_cross_mark: Not paused!";
+ this._paused = false;
+ this._mediaPlayer?.resume();
+ this.emit("playback", true);
+
+ this._stopInactivityTimer();
+ return ":arrow_forward: Resumed";
+ }
+
+ skip() {
+ if (!this.connection || !this.queue.getCurrent())
+ return ":negative_squared_cross_mark: There's nothing playing at the moment!";
+ this._skipping = true;
+ this._radioAnnounced = false;
+ this.queue.current = null;
+ this._stopMediaPlayer().then(() => {
+ this._playingNext = false;
+ this._skipping = false;
+ if (!this.queue.isEmpty() && !this.leaving) this.playNext();
+ else {
+ this.emit("stopplay");
+ if (!this._is247Enabled()) {
+ this._startInactivityTimer();
+ }
+ }
+ }).catch(e => logger.error("[Player] skip stop error:", e.message));
+ return ":track_next: Skipped";
+ }
+
+ skipTo(position) {
+ if (!this.connection || !this.queue.getCurrent())
+ return ":negative_squared_cross_mark: There's nothing playing at the moment!";
+ const idx = position - 1;
+ if (idx < 0 || idx >= this.queue.size())
+ return `:negative_squared_cross_mark: Position ${position} out of range (queue has ${this.queue.size()} tracks).`;
+ this.queue.data.splice(0, idx);
+ this.queue.current = null;
+ this._skipping = true;
+ this._stopMediaPlayer().then(() => {
+ this._playingNext = false;
+ this._skipping = false;
+ if (!this.queue.isEmpty() && !this.leaving) this.playNext();
+ else {
+ this.emit("stopplay");
+ if (!this._is247Enabled()) {
+ this._startInactivityTimer();
+ }
+ }
+ }).catch(e => logger.error("[Player] skipTo stop error:", e.message));
+ return `:track_next: Skipped to position ${position}`;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Volume Control
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ setVolume(v) {
+ this.preferredVolume = Utils.clamp(v, 0, 1);
+ this.emit("volume", this.preferredVolume);
+ this._mediaPlayer?.setVolume(this.preferredVolume);
+ if (!this.connection)
+ return `Volume set to \`${Math.round(this.preferredVolume * 100)}%\` — will apply when connected.`;
+ return `Volume changed to \`${Math.round(this.preferredVolume * 100)}%\`.`;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Queue Management
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ isEmpty() { return this.queue.isEmpty(); }
+
+ addToQueue(d, t) {
+ this.queue.add(d, t);
+ this.emit("update", "queue");
+ this._stopInactivityTimer();
+ }
+
+ clear() {
+ this.queue.clear();
+ this.emit("update", "queue");
+ if (!this.queue.getCurrent()) {
+ this._startInactivityTimer();
+ }
+ }
+
+ addManyToQueue(t, top = false) {
+ const added = this.queue.addMany(t, top);
+ this.emit("update", "queue");
+ this._stopInactivityTimer();
+ return added;
+ }
+
+ shuffle() {
+ if (this.isEmpty()) return "There is nothing to shuffle in the queue.";
+ this.queue.shuffle();
+ this.emit("update", "queue");
+ return ":twisted_rightwards_arrows: Shuffled queue";
+ }
+
+ move(from, to) {
+ if (this.queue.size() === 0) return "The queue is empty.";
+ return this.queue.move(from - 1, to - 1);
+ }
+
+ loop(choice) {
+ if (!["song", "queue"].includes(choice))
+ return `'${choice}' is not valid. Use \`song\` or \`queue\``;
+ const state = this.queue.toggleLoop(choice);
+ const name = choice.charAt(0).toUpperCase() + choice.slice(1);
+ return state
+ ? `:repeat: ${name} loop activated`
+ : `:arrow_right: ${name} loop disabled`;
+ }
+
+ remove(index) {
+ if (index === undefined || index === null) throw new Error("Index can't be empty");
+ const oldSize = this.queue.size();
+ const msg = this.queue.remove(index);
+ if (oldSize !== this.queue.size()) this.emit("update", "queue");
+
+ if (this.isEmpty() && !this.queue.getCurrent()) {
+ this._startInactivityTimer();
+ }
+ return msg;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Display Helpers
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ _createProgressBar(length = 15) {
+ const current = this.queue.getCurrent();
+ if (!current?.duration || !this.startedPlaying) return Utils.progressBar(0, 1, length);
+ const elapsed = Date.now() - this.startedPlaying;
+ let totalMs;
+ if (typeof current.duration === "object") totalMs = (current.duration.seconds ?? 0) * 1000;
+ else if (typeof current.duration === "number") totalMs = current.duration;
+ else return Utils.progressBar(0, 1, length);
+ const bar = Utils.progressBar(elapsed, totalMs, length);
+ const timeNow = Utils.prettifyMS(elapsed);
+ const total = Utils.prettifyMS(totalMs);
+ return `${bar} \`${timeNow} / ${total}\``;
+ }
+
+ getCurrent() {
+ const c = this.queue.getCurrent();
+ if (!c) return "There's nothing playing at the moment.";
+ return this.getVideoName(c);
+ }
+
+ getVideoName(vid, code = false) {
+ if (!vid) return "Unknown";
+ if (vid.type === "radio") {
+ return code
+ ? `[Radio]: ${vid.title} - ${vid.author?.url || ""}`
+ : `[Radio] [${vid.title} by ${vid.author?.name || "Unknown"}](${vid.author?.url || ""})`;
+ }
+ if (vid.type === "external") {
+ return code
+ ? `${vid.title} - ${vid.url}`
+ : `[${vid.title}](${vid.url})`;
+ }
+ const elapsed = this.getCurrentElapsedDuration();
+ const total = this.getDuration(vid.duration);
+ const link = vid.spotifyUrl || vid.url || "";
+ return code
+ ? `${vid.title} (${elapsed}/${total})${link ? " - " + link : ""}`
+ : `[${vid.title} (${elapsed}/${total})]${link ? "(" + link + ")" : ""}`;
+ }
+
+ getQueueRemainingTime() {
+ let totalMs = 0;
+ const current = this.queue.getCurrent();
+ if (current?.duration && this.startedPlaying) {
+ const elapsed = Date.now() - this.startedPlaying;
+ const durationMs = typeof current.duration === "object"
+ ? (current.duration.seconds ?? 0) * 1000
+ : current.duration;
+ totalMs += Math.max(0, durationMs - elapsed);
+ }
+ for (const track of this.queue.data) {
+ if (!track?.duration) continue;
+ if (typeof track.duration === "object" && track.duration?.seconds) totalMs += track.duration.seconds * 1000;
+ else if (typeof track.duration === "number") totalMs += track.duration;
+ }
+ return Utils.prettifyMS(totalMs);
+ }
+
+ getCurrentElapsedDuration() {
+ if (!this.startedPlaying) return "0:00";
+ return Utils.prettifyMS(Date.now() - this.startedPlaying);
+ }
+
+ list(page = 1, pageSize = 10) {
+ const current = this.queue.getCurrent();
+ const total = this.queue.size();
+ let text = "";
+ if (current) {
+ const remaining = this.getQueueRemainingTime();
+ text += `🎧 **Queue**\n`;
+ text += `**${total} tracks** • ⏱️ ${remaining}\n`;
+ text += `${this._createProgressBar()}\n\n`;
+ text += `🎵 **Now Playing**\n`;
+ text += `${this.getVideoName(current)}\n\n`;
+ }
+ if (total === 0) { if (!current) text += "--- Empty ---"; return text; }
+ const { items, page: pg, totalPages, start } = this.queue.getPage(page, pageSize);
+ items.forEach((vid, i) => {
+ const index = String(start + i + 1).padStart(2, " ");
+ const name = this.getVideoName({ ...vid, title: Utils.truncate(vid.title, 60) });
+ text += `\`${index}.\` ${name}\n`;
+ });
+ text += `\nPage ${pg}/${totalPages} • Loop: ${this.queue.loop ? "🟢" : "🔴"}`;
+ return text;
+ }
+
+ async nowPlaying() {
+ const current = this.queue.getCurrent();
+ if (!current) return { msg: "There's nothing playing at the moment." };
+
+ const loopqueue = this.queue.loop ? "**enabled**" : "**disabled**";
+ const songloop = this.queue.songLoop ? "**enabled**" : "**disabled**";
+ const vol = `${Math.round((this.preferredVolume || 1) * 100)}%`;
+
+ const vcLine = this._channelId ? `🔊 **Now playing in:** <#${this._channelId}>\n\n` : "";
+
+ if (current.type === "radio") {
+ try {
+ const data = await meta(current.url);
+ return {
+ msg: `${vcLine}📻 Streaming **[${current.title}](${current.author?.url || current.url})**\n\n${current.description || ""}\n\nCurrent song: ${data?.title || "Unknown"}\n\nVolume: ${vol}\n\nQueue loop: ${loopqueue}\nSong loop: ${songloop}`,
+ image: current.thumbnail
+ };
+ } catch {
+ return {
+ msg: `${vcLine}📻 Streaming **[${current.title}](${current.author?.url || current.url})**\n\nVolume: ${vol}\n\nQueue loop: ${loopqueue}\nSong loop: ${songloop}`,
+ image: current.thumbnail
+ };
+ }
+ }
+
+ if (current.type === "external") {
+ return {
+ msg: `${vcLine}Playing **[${current.title}](${current.url}) by [${current.artist || "Unknown"}](${current.author?.url || ""})**\n\nVolume: ${vol}\n\nQueue loop: ${loopqueue}\nSong loop: ${songloop}`,
+ image: current.thumbnail
+ };
+ }
+
+ return {
+ msg: `${vcLine}🎵 Playing: **[${current.title}](${current.spotifyUrl || current.url})** (${this.getCurrentElapsedDuration()}/${this.getCurrentDuration()})\n\nVolume: ${vol}\n\nQueue loop: ${loopqueue}\nSong loop: ${songloop}`,
+ image: current.thumbnail
+ };
+ }
+
+ async getThumbnail() {
+ const current = this.queue.getCurrent();
+ if (!current) return { msg: "There's nothing playing at the moment.", image: null };
+ if (!current.thumbnail) return { msg: "No thumbnail available.", image: null };
+ return { msg: `Thumbnail of [${current.title}](${current.url}):`, image: current.thumbnail };
+ }
+
+ getDuration(duration) {
+ if (typeof duration === "object" && duration?.timestamp) return duration.timestamp;
+ if (typeof duration === "object" && duration?.seconds != null) return Utils.formatSeconds(duration.seconds);
+ if (typeof duration === "string" && duration.startsWith("PT")) return Utils.prettifyMS(Utils.parseISODuration(duration));
+ return Utils.prettifyMS(duration);
+ }
+
+ getCurrentDuration() {
+ const current = this.queue.getCurrent();
+ if (!current?.duration) return "?:??";
+ return this.getDuration(current.duration);
+ }
+
+ announceSong(s) {
+ if (!s) return;
+
+ const inVC = this._channelId ? ` in <#${this._channelId}>` : "";
+
+ if (s.type === "radio") {
+ this.emit("message", mkEmbed(`📻 Now streaming _${Utils.escapeMarkdown(s.title)}_ by [${s.author?.name || "Unknown"}](${s.author?.url || ""})${inVC}`))
+ return;
+ }
+ const author = s.artists
+ ? s.artists.map(a => a.url ? `[${a.name}](${a.url})` : a.name).join(" & ")
+ : s.author?.url
+ ? `[${s.author.name}](${s.author.url})`
+ : s.author?.name || "Unknown";
+ this.emit("message", mkEmbed(`🎵 Now playing [${Utils.escapeMarkdown(s.title)}](${s.spotifyUrl || s.url}) by ${author}${inVC}`))
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Worker Management
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ workerJob(jobId, data, onMessage = null) {
+ const workerPath = new URL("./worker.mjs", import.meta.url);
+ const worker = new Worker(workerPath, {
+ workerData: {
+ jobId,
+ data: {
+ ...data,
+ nodelink: this._nl,
+ guildId: this._guildId,
+ }
+ }
+ });
+
+ const job = new Promise((resolve, reject) => {
+ worker.on("message", (raw) => {
+ const parsed = Utils.safeJsonParse(raw);
+ if (!parsed) { reject(new Error("Invalid worker message")); return; }
+ if (parsed.event === "error") reject(parsed.data);
+ else if (parsed.event === "message" && onMessage) onMessage(parsed.data);
+ else if (parsed.event === "finished") resolve(parsed.data);
+ });
+ worker.on("error", reject);
+ worker.on("exit", (code) => { if (code !== 0) reject(new Error(`Worker exited ${code}`)); });
+ });
+
+ return Utils.timeout(job, 60_000, "Worker timeout after 60s")
+ .finally(() => worker.terminate().catch(() => {}));
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Public Play Methods
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ async fetchResults(query, id, provider = "ytm") {
+ try {
+ const data = await this.workerJob("searchResults", { query, provider, resultCount: this.resultLimit });
+ let list = `Search results using **${PROVIDER_NAMES[provider] || "YouTube Music"}**:\n\n`;
+ data.data.forEach((v, i) => {
+ const url = v.url || "";
+ const title = v.title || Utils.formatTrackInfo(v, false);
+ const dur = v.duration ? this.getDuration(v.duration) : "?:??";
+ list += `${i + 1}. [${title}](${url}) - ${dur}\n`;
+ });
+ list += "\nSend the number of the result. Example: `2`\nSend 'x' to cancel.";
+
+ // FIX: evict oldest search session if we're at the cap, preventing unbounded growth
+ if (this.searches.size >= this._searchMaxSize) {
+ const oldestKey = this._searchOrder.shift();
+ if (oldestKey) this.searches.delete(oldestKey);
+ }
+ this.searches.set(id, data.data);
+ this._searchOrder.push(id);
+
+ return { m: list, count: data.data.length };
+ } catch (err) {
+ return { m: `Error searching: ${err.message}`, count: 0 };
+ }
+ }
+
+ playResult(id, result = 0, next = false) {
+ if (!this.searches.has(id)) return null;
+ const searchResults = this.searches.get(id);
+ if (!searchResults || !searchResults[result]) return null;
+
+ const res = searchResults[result];
+ this.addToQueue(res, next);
+
+ // Clean up this search session once the user has picked a result
+ this.searches.delete(id);
+ const orderIdx = this._searchOrder.indexOf(id);
+ if (orderIdx !== -1) this._searchOrder.splice(orderIdx, 1);
+
+ if (!this.queue.getCurrent()) {
+ this.playNext();
+ }
+ return res;
+ }
+
+ playFirst(query, provider) { return this.play(query, true, provider); }
+
+ play(query, top = false, provider) {
+ const events = new EventEmitter();
+ this.workerJob("generalQuery", { query, provider }, (msg) => events.emit("message", msg))
+ .then((data) => {
+ if (!data) {
+ logger.worker("[Player] Worker returned empty result");
+ events.emit("message", "Could not load track - no data returned.");
+ return;
+ }
+
+ if (data.type === "error") {
+ logger.worker("[Player] Worker returned error:", data.error);
+ events.emit("message", data.error || "Failed to load track.");
+ return;
+ }
+
+ if (data.type === "list") {
+ this.addManyToQueue(data.data, top);
+ } else if (data.type === "video") {
+ this.addToQueue(data.data, top);
+ } else {
+ logger.worker("[Player] Unknown worker result:", data);
+ events.emit("message", "Unexpected result from track loader.");
+ return;
+ }
+
+ if (!this.queue.getCurrent()) {
+ this.playNext();
+ }
+ })
+ .catch((reason) => {
+ logger.error("[Player] Worker job failed:", reason);
+ events.emit("message", reason?.message || "An error occurred while loading the track.");
+ });
+ return events;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Radio track builder
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ _buildRadioTrack(radio) {
+ return {
+ type: "radio",
+ title: radio.detailedName || radio.title || "Unknown Radio",
+ description: Utils.truncate(radio.description || "", 200),
+ url: radio.url,
+ author: {
+ name: radio.author?.name || "Unknown",
+ url: radio.author?.url || radio.url,
+ },
+ thumbnail: radio.thumbnail ?? null,
+ };
+ }
+
+ playRadio(radio, top = false) {
+ if (!radio?.url) { logger.error("[Player] Invalid radio data"); return; }
+ this.addToQueue(this._buildRadioTrack(radio), top);
+ if (!this.queue.getCurrent()) this.playNext();
+ }
+
+ async switchRadio(radio) {
+ if (!radio?.url) { logger.error("[Player] switchRadio: invalid radio data"); return; }
+
+ const newTrack = this._buildRadioTrack(radio);
+ this.queue.data = this.queue.data.filter(t => t.type !== "radio");
+
+ if (!this.queue.getCurrent()) {
+ this.queue.add(newTrack);
+ this.playNext();
+ return;
+ }
+
+ this.queue.data.unshift(newTrack);
+ this._skipping = true;
+ this._radioAnnounced = false;
+ this.queue.current = null;
+ await this._stopMediaPlayer();
+ this._playingNext = false;
+ this._skipping = false;
+ if (!this.leaving) this.playNext();
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Core Playback
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ async playNext() {
+ if (this._playingNext) return;
+ this._playingNext = true;
+ try { await this._doPlayNext(); }
+ finally { this._playingNext = false; }
+ }
+
+ async _doPlayNext() {
+ if (this._currentPassthrough) {
+ try {
+ if (typeof this._currentPassthrough.unpipe === "function") this._currentPassthrough.unpipe();
+ if (typeof this._currentPassthrough.destroy === "function") this._currentPassthrough.destroy();
+ } catch (_) {}
+ this._currentPassthrough = null;
+ }
+
+ if (this._mediaPlayer) {
+ try {
+ await this._mediaPlayer.stop();
+ } catch (_) {}
+ }
+
+ this._streamingStopped = false;
+
+ const songData = this.queue.next();
+ if (!songData) {
+ this.emit("stopplay");
+
+ if (!this._is247Enabled()) {
+ this._startInactivityTimer();
+ } else {
+ logger.voice247("[Player] 24/7 enabled, staying in channel");
+ }
+
+ if (!this._wasRadio) {
+ const prefix = (() => {
+ try {
+ return this.settingsMgr?.getServer?.(this._guildId)?.get?.("prefix")
+ ?? this.settings?.get?.("prefix")
+ ?? "%";
+ } catch (_) { return "%"; }
+ })();
+ this.emit("message", mkEmbed(`🎵 The queue has ended — nothing left to play. Add more songs with \`${prefix}play\`!`));
+ }
+ this._wasRadio = false;
+ return;
+ }
+
+ this._stopInactivityTimer();
+ this._wasRadio = songData.type === "radio";
+
+ if (!this.connection || this.leaving) return;
+
+ const room = this.connection.room;
+ if (!room || room.state === "disconnected" || room.state === 0) {
+ logger.mediaplayer("[Player] Room disconnected, recovering connection before playing.");
+ if (songData) {
+ this.queue.data.unshift(songData);
+ this.queue.current = null;
+ this._playingNext = false;
+ }
+ this._recoverConnection(); // Safely recover the broken LiveKit connection
+ return;
+ }
+
+ const hasValidPlayer = await this._ensureMediaPlayer();
+ if (!hasValidPlayer) {
+ logger.error("[Player] Failed to create healthy MediaPlayer — cannot play.");
+ this.emit("message", mkEmbed(":x: Voice connection lost. Please rejoin."))
+
+ if (!this._is247Enabled()) {
+ this._startInactivityTimer();
+ }
+ return;
+ }
+
+ if (this._mediaPlayer && this.preferredVolume !== 1) {
+ this._mediaPlayer.setVolume(this.preferredVolume);
+ }
+
+ await Utils.sleep(200);
+ if (!this.connection || this.leaving) return;
+
+ let streamUrl = null;
+
+ if (songData.type === "radio" || songData.type === "external") {
+ streamUrl = songData.url;
+ } else if (songData.encoded) {
+ const nlBase = `http://${this._nl.host}:${this._nl.port}`;
+ const sessionParam = this._nl.sessionId ? `&sessionId=${encodeURIComponent(this._nl.sessionId)}` : "";
+ const guildParam = this._guildId ? `&guildId=${this._guildId}` : "";
+ streamUrl = `${nlBase}/v4/trackstream?encodedTrack=${encodeURIComponent(songData.encoded)}${guildParam}${sessionParam}`;
+ } else if (songData.url && Utils.isValidUrl(songData.url)) {
+ streamUrl = songData.url;
+ } else {
+ try {
+ if (this._moonlink?.manager) {
+ const result = await this._moonlink.search(`ytsearch:${songData.title}`);
+ const track = result?.tracks?.[0];
+ if (track?.encoded) {
+ const nlBase = `http://${this._nl.host}:${this._nl.port}`;
+ const guildParam = this._guildId ? `&guildId=${this._guildId}` : "";
+ streamUrl = `${nlBase}/v4/trackstream?encodedTrack=${encodeURIComponent(track.encoded)}${guildParam}`;
+ } else if (track?.uri) {
+ streamUrl = track.uri;
+ }
+ }
+ } catch (e) {
+ logger.error("[Player] moonlink search fallback error:", e.message);
+ }
+ }
+
+ if (!streamUrl || !Utils.isValidUrl(streamUrl)) {
+ logger.error("[Player] No valid stream URL for:", songData.title);
+ this.emit("message", mkEmbed(`:x: Could not get stream URL for **${songData.title}** — skipping...`))
+ this._playingNext = false;
+ this._streamingStopped = false;
+ this.playNext();
+ return;
+ }
+
+ logger.player(`[Player:${this._guildId}] Streaming: ${songData.title}`);
+ this.startedPlaying = Date.now();
+ this._paused = false;
+ if (songData.type !== "radio" || !this._radioAnnounced) {
+ this.announceSong(songData);
+ if (songData.type === "radio") this._radioAnnounced = true;
+ }
+ this.emit("startplay", songData);
+
+ try {
+ await Utils.retry(() => this._streamUrl(streamUrl), 2, 1000);
+ } catch (err) {
+ logger.error("[Player] Stream error:", err.message);
+ this._streamingStopped = true;
+ if (!this._skipping && !this.leaving && !this._paused) {
+ if (songData.type !== "radio") {
+ this.emit("message", mkEmbed(`:x: Error streaming **${songData.title}** — skipping...`))
+ }
+ }
+ }
+
+ if (!this.leaving && !this._skipping) {
+ if (songData.type === "radio") {
+ this.queue.data.unshift(songData);
+ this.queue.current = null;
+ this._streamingStopped = false;
+ this._playingNext = false;
+ await Utils.sleep(1500);
+ if (!this.leaving && !this._skipping) this.playNext();
+ } else {
+ if (!this._paused) {
+ if (!this.queue.songLoop) this.queue.current = null;
+ this._streamingStopped = false;
+ this._playingNext = false;
+ this.playNext();
+ }
+ }
+ }
+ this._skipping = false;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Lyrics
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ async lyrics() {
+ const current = this.queue.getCurrent();
+ if (!current) return null;
+
+ if (this._moonlink?.manager) {
+ try {
+ const node = this._moonlink.manager.nodes.findNode();
+ if (node) {
+ const searchQuery = current.artists?.[0]?.name
+ ? `${current.title} ${current.artists[0].name}`
+ : current.title;
+ const result = await node.loadLyrics(current.encoded || searchQuery);
+ if (result?.data?.lines?.length) {
+ return {
+ text: result.data.lines.map(l => l.text).join("\n"),
+ source: "NodeLink",
+ synced: result.data.lines.some(l => l.startTimeMs != null),
+ lines: result.data.lines,
+ };
+ }
+ }
+ } catch (e) {
+ logger.player(`[Lyrics] moonlink loadLyrics failed: ${e.message}`);
+ }
+ }
+
+ try {
+ const searchQuery = current.artists?.[0]?.name
+ ? `${current.title} ${current.artists[0].name}`
+ : current.title;
+ const url = current.encoded
+ ? `http://${this._nl.host}:${this._nl.port}/v4/loadlyrics?encodedTrack=${encodeURIComponent(current.encoded)}`
+ : `http://${this._nl.host}:${this._nl.port}/v4/loadlyrics?identifier=${encodeURIComponent(searchQuery)}`;
+ const results = await this._request(url, {
+ headers: {
+ ...(this._nl.sessionId ? { "Session-Id": this._nl.sessionId } : {}),
+ ...(this._guildId ? { "Guild-Id": this._guildId } : {}),
+ }
+ });
+ if (results?.data?.lines?.length) {
+ return {
+ text: results.data.lines.map(l => l.text).join("\n"),
+ source: "NodeLink",
+ synced: results.data.lines.some(l => l.startTimeMs != null),
+ lines: results.data.lines,
+ };
+ }
+ } catch (e) {
+ logger.player(`[Lyrics] REST fallback failed: ${e.message}`);
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/PlayerManager.mjs b/src/PlayerManager.mjs
new file mode 100644
index 0000000..6b427c8
--- /dev/null
+++ b/src/PlayerManager.mjs
@@ -0,0 +1,382 @@
+/**
+ * PlayerManager.mjs — Manages voice channel players across servers
+ *
+ * Updated for moonlink.js: passes the MoonlinkManager instance into every
+ * new Player so it can resolve tracks and retrieve session IDs.
+ */
+
+import Player from "./Player.mjs";
+import { CommandHandler } from "./CommandHandler.mjs";
+import { Message } from "./MessageHandler.mjs";
+import { SettingsManager } from "./Settings.mjs";
+import { Utils } from "./Utils.mjs";
+import { logger } from "./constants/Logger.mjs";
+import { EmbedBuilder } from "@fluxerjs/core";
+import { getGlobalColor } from "./MessageHandler.mjs";
+
+/** Helper — build a plain embed payload from a description string */
+function mkEmbed(desc) {
+ return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] };
+}
+
+export class PlayerManager {
+ /** @type {SettingsManager} */
+ settings;
+
+ /** @type {CommandHandler} */
+ commands;
+
+ /** @type {Map} */
+ playerMap = new Map();
+
+ /** @type {Object} */
+ config;
+
+ /** @type {Object} */
+ playerConfig;
+
+ /**
+ * @param {SettingsManager} settings
+ * @param {CommandHandler} commands
+ * @param {Object} config
+ * @param {Object} config.config - Parsed config.json
+ * @param {Object} config.player - Config data passed to new Player instances
+ */
+ constructor(settings, commands, config) {
+ this.commands = commands;
+ this.settings = settings;
+ this.config = config.config;
+ this.playerConfig = config.player;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Voice Channel Detection
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Attempt to detect the voice channel a user is currently in.
+ * @param {Message} message
+ * @returns {string|null} Voice channel ID or null
+ */
+ checkVoiceChannels(message) {
+ if (!message) return null;
+
+ const userId = message.author?.id;
+ const serverId = message.channel?.server_id ??
+ message.channel?.serverId ??
+ message.message?.server_id ??
+ message.message?.serverId;
+
+ if (!userId) return null;
+
+ // Fallback: find any existing player in this server
+ if (serverId) {
+ for (const [channelId] of this.playerMap) {
+ const channel = this.commands.client?.channels?.get(channelId) ??
+ this.commands.client?.channels?.cache?.get(channelId);
+ if (channel?.guildId === serverId || channel?.server_id === serverId || channel?.serverId === serverId) {
+ return channelId;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Player Retrieval
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Get or create a player for the user's voice channel.
+ * @param {Message} message
+ * @param {boolean} [promptJoin=true]
+ * @param {boolean} [verifyUser=true]
+ * @param {boolean} [shouldJoin=false]
+ * @returns {Promise}
+ */
+ async getPlayer(message, promptJoin = true, verifyUser = true, shouldJoin = false) {
+ const serverId = message.channel?.server_id ??
+ message.channel?.serverId ??
+ message.message?.server_id ??
+ message.message?.serverId;
+
+ const userChannelId = this.checkVoiceChannels(message);
+
+ if (userChannelId) {
+ const player = this.playerMap.get(userChannelId);
+ if (player) {
+ player.textChannel = message.channel;
+ return player;
+ }
+ }
+
+ const serverPlayers = serverId
+ ? [...this.playerMap.entries()].filter(([chId]) => {
+ const ch = this.commands.client?.channels?.get(chId) ??
+ this.commands.client?.channels?.cache?.get(chId);
+ return ch?.guildId === serverId || ch?.server_id === serverId || ch?.serverId === serverId;
+ })
+ : [];
+
+ if (serverPlayers.length > 0) {
+ const channelList = serverPlayers.map(([chId]) => `<#${chId}>`).join(" or ");
+
+ if (!userChannelId) {
+ message.replyEmbed(mkEmbed(`⚠️ Please join ${channelList} to use this command.`));
+ return null;
+ }
+
+ const match = serverPlayers.find(([chId]) => chId === userChannelId);
+ if (match) {
+ match[1].textChannel = message.channel;
+ return match[1];
+ }
+
+ message.replyEmbed(mkEmbed(`⚠️ I'm already playing in ${channelList}. Join that channel.`));
+ return null;
+ }
+
+ if (!userChannelId) {
+ message.replyEmbed(mkEmbed("⚠️ Please join a voice channel first."));
+ return null;
+ }
+
+ if (shouldJoin) {
+ return new Promise((resolve) => {
+ this.initPlayer(message, userChannelId, (p) => resolve(p));
+ });
+ }
+
+ return null;
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Channel Selection Prompt
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Prompt the user to select a voice channel.
+ * @param {Message} msg
+ * @returns {Promise}
+ */
+ async promptVC(msg) {
+ const autoDetected = this.checkVoiceChannels(msg);
+ if (autoDetected) {
+ return new Promise(resolve => this.initPlayer(msg, autoDetected, () => resolve(autoDetected)));
+ }
+
+ const serverId = msg.channel?.server_id ?? msg.channel?.serverId;
+ const allChannels = serverId
+ ? [...(this.commands.client?.channels?.values?.() ??
+ this.commands.client?.channels?.cache?.values?.() ?? [])]
+ .filter(c => {
+ const cServerId = c.server_id ?? c.serverId;
+ return cServerId === serverId && c.channel_type === "VoiceChannel";
+ })
+ : [];
+
+ const reactions = ["1️⃣","2️⃣","3️⃣","4️⃣","5️⃣","6️⃣","7️⃣","8️⃣","9️⃣"];
+ const channelArr = allChannels.slice(0, 9);
+
+ let channelSelection = "";
+ if (channelArr.length > 0) {
+ channelSelection = "Please select one of the following channels by clicking on the reactions below\n\n";
+ channelArr.forEach((c, i) => { channelSelection += `${i + 1}. <#${c._id ?? c.id}>\n`; });
+ }
+
+ const selectionMsg = await msg.replyEmbed(mkEmbed(
+ (channelSelection ? channelSelection + "\n**..or**" : "Please") +
+ " send a message with the voice channel! (Mention/Id/Name)\nSend 'x' to cancel."
+ ));
+
+ return new Promise(resolve => {
+ let unsubscribeReactions;
+ let unsubscribeMessages;
+
+ const cleanup = () => {
+ unsubscribeMessages?.();
+ unsubscribeReactions?.();
+ };
+
+ const timeout = setTimeout(() => {
+ cleanup();
+ msg.replyEmbed(mkEmbed("⏱️ Voice selection timed out."));
+ resolve(false);
+ }, 30_000);
+
+ if (typeof selectionMsg?.onReaction === "function" && channelArr.length > 0) {
+ unsubscribeReactions = selectionMsg.onReaction(
+ reactions.slice(0, channelArr.length),
+ (e) => {
+ const idx = reactions.indexOf(e.emoji_id ?? e.emoji?.id ?? e.emoji);
+ const channel = channelArr[idx];
+ if (!channel) return;
+ clearTimeout(timeout);
+ cleanup();
+ const cid = channel._id ?? channel.id;
+ this.initPlayer(msg, cid, () => resolve(cid));
+ },
+ msg.author
+ );
+ }
+
+ unsubscribeMessages = msg.channel.onMessageUser((m) => {
+ const content = m.content?.toLowerCase() ?? "";
+ if (content === "x") {
+ clearTimeout(timeout);
+ cleanup();
+ m.replyEmbed(mkEmbed("Cancelled!"));
+ resolve(false);
+ return;
+ }
+ if (!this.commands.validateInput("voiceChannel", m.content, m)) {
+ m.replyEmbed(mkEmbed("Invalid voice channel. Try again or type `x`."));
+ return;
+ }
+ const channel = this.commands.formatInput("voiceChannel", m.content, m);
+ clearTimeout(timeout);
+ cleanup();
+ this.initPlayer(m, channel, () => resolve(channel));
+ }, msg.author);
+ });
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Leave
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Make the player leave its current voice channel.
+ * @param {Message} msg
+ * @param {string} [cid]
+ */
+ async leave(msg, cid) {
+ if (!cid) {
+ const serverId = msg.channel?.server_id ?? msg.channel?.serverId ??
+ msg.message?.server_id ?? msg.message?.serverId;
+ if (serverId) {
+ cid = [...this.playerMap.keys()].find((id) => {
+ const ch = this.commands.client?.channels?.get(id) ??
+ this.commands.client?.channels?.cache?.get(id);
+ return ch?.guildId === serverId || ch?.server_id === serverId || ch?.serverId === serverId;
+ });
+ }
+ }
+
+ const player = cid ? this.playerMap.get(cid) : null;
+ if (!player) return msg.replyEmbed(mkEmbed("I'm not in a voice channel."));
+
+ this.playerMap.delete(cid);
+ await msg.replyEmbed(mkEmbed("✅ Successfully Left"));
+ await player.leave();
+ player.destroy();
+ }
+
+ // ═══════════════════════════════════════════════════════════════════════════
+ // Player Initialisation
+ // ═══════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Create and register a new Player for the given voice channel.
+ * @param {Message} message
+ * @param {string} cid - Voice channel ID
+ * @param {Function} [cb]
+ */
+ initPlayer(message, cid, cb = () => {}) {
+ const channel = this.commands.client?.channels?.get(cid) ??
+ this.commands.client?.channels?.cache?.get(cid);
+
+ if (!channel) {
+ return message.replyEmbed(mkEmbed(
+ `Couldn't find the channel \`${cid}\`\nUse the help command to learn more about this.`
+ ));
+ }
+
+ const isVoice = channel.channel_type === "VoiceChannel" ||
+ channel.type === "VoiceChannel" ||
+ channel.type === 2;
+
+ if (!isVoice) {
+ return message.replyEmbed(mkEmbed("❌ Please join a **voice channel** first before using this command!"));
+ }
+
+ if (this.playerMap.has(cid)) {
+ const existing = this.playerMap.get(cid);
+ existing.textChannel = message.channel;
+ cb(existing);
+ return message.replyEmbed(mkEmbed(`Already joined <#${cid}>.`));
+ }
+
+ const player = new Player(this.config.token, {
+ ...this.playerConfig,
+ client: this.commands.client,
+ config: this.config,
+ nodelink: this.config.nodelink,
+ moonlink: this.playerConfig?.moonlink ?? null,
+ settingsMgr: this.settings,
+ observedVoiceUsers: this.observedVoiceUsers ?? null,
+ });
+
+ player.textChannel = message.channel;
+
+ player.on("autoleave", () => {
+ const ch = player.textChannel;
+ const serverId = ch?.server_id ?? ch?.serverId ?? ch?.guild?.id;
+ const is247 = (() => {
+ try {
+ const raw = this.settings.getServer(serverId)?.get("stay_247");
+ return raw && raw !== "none";
+ } catch (_) { return false; }
+ })();
+ const prefix = (() => {
+ try {
+ return this.settings.getServer(serverId)?.get("prefix") ?? "%";
+ } catch (_) { return "%"; }
+ })();
+ const desc = is247
+ ? `Left channel <#${cid}> because of inactivity.`
+ : `Left channel <#${cid}> because of inactivity.\nIf you want me to stay in voice, use \`${prefix}247 on/auto\``;
+ ch?.sendEmbed(mkEmbed(desc));
+ this.playerMap.delete(cid);
+ player.destroy();
+ });
+
+ player.on("leave", () => {});
+
+ player.on("message", (m) => {
+ const ch = player.textChannel;
+ const serverId = ch?.server_id ?? ch?.serverId ?? ch?.guild?.id;
+ const raw = this.settings.getServer(serverId)?.get("songAnnouncements");
+ const disabled = raw === false || raw === 0 ||
+ ["false","0","no","off","disable"].includes(String(raw).toLowerCase().trim());
+ if (disabled) return;
+ ch?.sendEmbed(typeof m === "object" && Array.isArray(m.embeds) ? m : mkEmbed(m));
+ });
+
+ this.playerMap.set(cid, player);
+
+ (async () => {
+ const statusMsg = await message.replyEmbed(mkEmbed("⏳ Joining Channel..."));
+ try {
+ await player.join(cid);
+ await statusMsg.editEmbed(mkEmbed(`✅ Successfully joined <#${cid}>`));
+
+ const serverId = message.channel?.server_id ?? message.channel?.serverId;
+ if (serverId) {
+ const savedVol = this.settings.getServer(serverId)?.get("volume");
+ if (savedVol !== undefined && savedVol !== null) {
+ const vol = Number(savedVol);
+ if (!isNaN(vol)) player.setVolume(vol / 100);
+ }
+ }
+
+ cb(player);
+ } catch (err) {
+ await statusMsg.editEmbed(mkEmbed(`❌ Failed to join: ${err.message}`)).catch(() => {});
+ this.playerMap.delete(cid);
+ player.destroy();
+ }
+ })();
+ }
+}
\ No newline at end of file
diff --git a/src/Settings.mjs b/src/Settings.mjs
new file mode 100644
index 0000000..c8bd7cf
--- /dev/null
+++ b/src/Settings.mjs
@@ -0,0 +1,199 @@
+import fs from "node:fs";
+import { logger } from "./constants/Logger.mjs";
+import mysql from "mysql";
+import { EventEmitter } from "node:events";
+
+export class ServerSettings {
+ id;
+ manager;
+ data = {};
+
+ constructor(id, mgr) {
+ this.id = id;
+ this.manager = mgr;
+ this.loadDefaults();
+ }
+ set(key, value) { this.data[key] = value; this.manager.update(this, key); }
+ get(key) { return this.data[key]; }
+ reset(key) { return this.set(key, this.manager.defaults[key]); }
+ getAll() { return this.data; }
+ loadDefaults() { for (let key in this.manager.defaults) { this.data[key] = this.manager.defaults[key]; } }
+ deserialize(json) { for (let k in json) { if (k === "id") continue; this.data[k] = json[k]; } }
+
+ // was `if (!this.data[key])` which clobbered valid falsy values like 0, false, ""
+ checkDefaults(d) { for (let key in d) { if (this.data[key] === undefined) this.data[key] = d[key]; } }
+
+ get serializationData() { return { ...this.data, id: this.id }; }
+ serialize() { return this.serializationData; }
+ serializeObject() { return this.serializationData; }
+}
+
+/** @deprecated Use RemoteSettingsManager instead */
+export class SettingsManager {
+ guilds = new Map();
+ storagePath = "./storage/settings.json";
+ defaults = {};
+ descriptions = {};
+
+ constructor(storagePath = null) {
+ if (storagePath) this.storagePath = storagePath;
+ this.load();
+ }
+ loadDefaultsSync(filePath) {
+ const d = fs.readFileSync(filePath, "utf8");
+ const parsed = JSON.parse(d);
+ this.descriptions = parsed.descriptions;
+ this.defaults = parsed.values;
+ }
+ load() {
+ if (!fs.existsSync(this.storagePath)) {
+ fs.writeFileSync(this.storagePath, JSON.stringify({ guilds: [] }));
+ }
+ const json = JSON.parse(fs.readFileSync(this.storagePath, "utf8"));
+ const entries = json.guilds || json.servers || [];
+ entries.forEach((s) => {
+ const server = new ServerSettings(s.id, this);
+ server.deserialize(s);
+ server.checkDefaults(this.defaults);
+ this.guilds.set(s.id, server);
+ });
+ }
+ save() {
+ const s = [];
+ this.guilds.forEach((val) => { s.push(val.serialize()); });
+ fs.writeFileSync(this.storagePath, JSON.stringify({ guilds: s }));
+ }
+ saveAsync() {
+ return new Promise((res) => {
+ const s = [];
+ this.guilds.forEach((val) => { s.push(val.serializeObject()); });
+ fs.writeFile(this.storagePath, JSON.stringify({ guilds: s }), () => { res(); });
+ });
+ }
+ update(server, key) {
+ if (!this.guilds.has(server.id)) this.guilds.set(server.id, server);
+ const s = this.guilds.get(server.id);
+ s.data[key] = server.data[key];
+ }
+ isOption(key) { return key in this.defaults; }
+ hasServer(id) { return this.guilds.has(id); }
+ getServer(id) {
+ if (this.guilds.has(id)) return this.guilds.get(id);
+ // Create AND store so any .set() calls on the returned object are persisted.
+ // Previously this returned a detached instance, causing settings writes to silently disappear.
+ const server = new ServerSettings(id, this);
+ server.checkDefaults(this.defaults);
+ this.guilds.set(id, server);
+ return server;
+ }
+}
+
+export class RemoteSettingsManager extends EventEmitter {
+ guilds = new Map();
+ descriptions = {};
+ defaults = {};
+ db = null;
+
+ // track retry count and apply exponential backoff on load failures
+ _loadAttempts = 0;
+
+ constructor(config, defaultsPath) {
+ super();
+ this.db = mysql.createPool({ connectionLimit: 15, ...config });
+ if (defaultsPath) this.loadDefaultsSync(defaultsPath);
+ this.load();
+ }
+
+ query(q) {
+ return new Promise(res => {
+ this.db.query(q, (error, results, fields) => { res({ error, results, fields }); });
+ });
+ }
+
+ async load() {
+ const res = await this.query("SELECT * FROM settings");
+ if (res.error) {
+ this._loadAttempts++;
+ // exponential backoff with a cap of 30s instead of forever-at-2s
+ const delay = Math.min(1000 * Math.pow(2, this._loadAttempts - 1), 30_000);
+ logger.error("[Settings] Init error (attempt", this._loadAttempts, "retrying in", delay + "ms):", res.error);
+ return setTimeout(() => { this.load(); }, delay);
+ }
+ this._loadAttempts = 0;
+ res.results.forEach((r) => {
+ const server = new ServerSettings(r.id, this);
+ server.deserialize(JSON.parse(r.data));
+ server.checkDefaults(this.defaults);
+ this.guilds.set(server.id, server);
+ });
+ this.emit("ready");
+ }
+
+ async remoteUpdate(server, key) {
+ const val = server.data[key];
+ // Arrays/objects must go through remoteSave — JSON_SET with scalar
+ // interpolation corrupts arrays by merging IDs into one number on read-back.
+ if (Array.isArray(val) || (typeof val === "object" && val !== null)) {
+ return this.remoteSave(server);
+ }
+ // Use mysql.escape() for every user-supplied value to prevent SQL injection.
+ const escapedPath = mysql.escape(`$.${key}`);
+ const escapedVal = mysql.escape(String(val));
+ const escapedId = mysql.escape(server.id);
+ const r = await this.query(`UPDATE settings SET data = JSON_SET(data, ${escapedPath}, ${escapedVal}) WHERE id=${escapedId}`);
+ if (r.error) logger.error("[Settings] remoteUpdate error:", r.error);
+ }
+
+ async remoteSave(server) {
+ const escapedData = mysql.escape(JSON.stringify(server.data));
+ const escapedId = mysql.escape(server.id);
+ const r = await this.query(`UPDATE settings SET data = ${escapedData} WHERE id=${escapedId}`);
+ if (r.error) logger.error("[Settings] remoteSave error:", r.error);
+ }
+
+ loadDefaultsSync(filePath) {
+ const d = fs.readFileSync(filePath, "utf8");
+ const parsed = JSON.parse(d);
+ this.descriptions = parsed.descriptions;
+ this.defaults = parsed.values;
+ }
+
+ async saveAsync() {
+ await Promise.allSettled([...this.guilds.values()].map(v => this.remoteSave(v)));
+ }
+
+ async create(id, server) {
+ const escapedId = mysql.escape(id);
+ const escapedData = mysql.escape(JSON.stringify(server.data));
+ const r = await this.query(`INSERT INTO settings (id, data) VALUES (${escapedId}, ${escapedData})`);
+ if (r.error) logger.error("[Settings] create error:", r.error);
+ }
+
+ update(server, key) {
+ if (!this.guilds.has(server.id)) { this.guilds.set(server.id, server); this.create(server.id, server); }
+ const s = this.guilds.get(server.id);
+ s.data[key] = server.data[key];
+ this.remoteUpdate(server, key);
+ }
+
+ isOption(key) { return key in this.defaults; }
+ hasServer(id) { return this.guilds.has(id); }
+
+ getServer(id) {
+ if (!this.guilds.has(id)) {
+ // Return a fresh object but don't register it yet;
+ // update() will call create() on the first real write.
+ return new ServerSettings(id, this);
+ }
+ return this.guilds.get(id);
+ }
+
+ /**
+ * Drop a server from the in-memory cache without touching the DB row.
+ * This lets settings be restored automatically if the bot is re-invited.
+ * @param {string} id - Guild / server ID
+ */
+ removeServer(id) {
+ this.guilds.delete(id);
+ }
+}
\ No newline at end of file
diff --git a/src/Utils.mjs b/src/Utils.mjs
new file mode 100644
index 0000000..826d9b6
--- /dev/null
+++ b/src/Utils.mjs
@@ -0,0 +1,511 @@
+/**
+ * Utils.mjs — Utility functions for the music bot
+ * @module Utils
+ */
+
+/**
+ * @class Utils
+ * @description Static utility methods for time formatting, array manipulation,
+ * string processing, and validation used across the music bot.
+ */
+export class Utils {
+ // ═════════════════════════════════════════════════════════════════════════════
+ // Time & Duration
+ // ═════════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Format milliseconds to human-readable time string (H:MM:SS or M:SS)
+ * @param {number} milliseconds - Duration in milliseconds
+ * @returns {string} Formatted time string
+ * @example Utils.prettifyMS(125000) // "2:05"
+ * @example Utils.prettifyMS(3661000) // "1:01:01"
+ */
+ static prettifyMS(milliseconds) {
+ if (!milliseconds || milliseconds < 0 || !isFinite(milliseconds)) {
+ return "0:00";
+ }
+
+ const totalSeconds = Math.floor(milliseconds / 1000);
+ const hours = Math.floor(totalSeconds / 3600);
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
+ const seconds = totalSeconds % 60;
+
+ const pad = (n) => String(n).padStart(2, "0");
+
+ return hours > 0
+ ? `${hours}:${pad(minutes)}:${pad(seconds)}`
+ : `${minutes}:${pad(seconds)}`;
+ }
+
+ /**
+ * Parse duration string (H:MM:SS or M:SS) to milliseconds
+ * @param {string} str - Duration string
+ * @returns {number} Milliseconds, 0 if invalid
+ */
+ static parseDuration(str) {
+ if (!str || typeof str !== "string") return 0;
+
+ const parts = str.split(":").map((s) => parseInt(s.trim(), 10)).reverse();
+ if (parts.some(isNaN) || parts.some(n => n < 0)) return 0;
+
+ let ms = 0;
+ if (parts[0] !== undefined) ms += parts[0] * 1000; // seconds
+ if (parts[1] !== undefined) ms += parts[1] * 60 * 1000; // minutes
+ if (parts[2] !== undefined) ms += parts[2] * 3600 * 1000; // hours
+
+ return ms;
+ }
+
+ /**
+ * Format seconds to MM:SS (for NodeLink duration compatibility)
+ * @param {number} seconds - Duration in seconds
+ * @returns {string} Formatted time
+ */
+ static formatSeconds(seconds) {
+ if (!seconds || seconds < 0 || !isFinite(seconds)) return "0:00";
+ return this.prettifyMS(seconds * 1000);
+ }
+
+ // ═════════════════════════════════════════════════════════════════════════════
+ // Array Manipulation
+ // ═════════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Shuffles array in-place using Fisher-Yates algorithm
+ * @template T
+ * @param {T[]} array - Array to shuffle
+ * @returns {T[]} Same array reference (shuffled)
+ */
+ static shuffleArr(array) {
+ if (!Array.isArray(array) || array.length < 2) return array;
+
+ for (let i = array.length - 1; i > 0; i--) {
+ const j = Math.floor(Math.random() * (i + 1));
+ [array[i], array[j]] = [array[j], array[i]];
+ }
+ return array;
+ }
+
+ /**
+ * Get random element from array
+ * @template T
+ * @param {T[]} array - Source array
+ * @returns {T | undefined} Random element or undefined if empty
+ */
+ static randomElement(array) {
+ if (!Array.isArray(array) || array.length === 0) return undefined;
+ return array[Math.floor(Math.random() * array.length)];
+ }
+
+ /**
+ * Chunk array into smaller arrays
+ * @template T
+ * @param {T[]} array - Array to chunk
+ * @param {number} size - Chunk size (minimum 1)
+ * @returns {T[][]} Array of chunks
+ */
+ static chunk(array, size) {
+ if (!Array.isArray(array) || size < 1) return [];
+ const chunks = [];
+ for (let i = 0; i < array.length; i += size) {
+ chunks.push(array.slice(i, i + size));
+ }
+ return chunks;
+ }
+
+ /**
+ * Remove duplicates from array (primitive values only)
+ * @template T
+ * @param {T[]} array - Array with potential duplicates
+ * @returns {T[]} New array without duplicates
+ */
+ static unique(array) {
+ if (!Array.isArray(array)) return [];
+ return [...new Set(array)];
+ }
+
+ // ═════════════════════════════════════════════════════════════════════════════
+ // String Formatting
+ // ═════════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Truncate text with ellipsis
+ * @param {string} str - String to truncate
+ * @param {number} [maxLen=100] - Maximum length
+ * @param {string} [suffix="..."] - Suffix to add
+ * @returns {string} Truncated string
+ */
+ static truncate(str, maxLen = 100, suffix = "...") {
+ if (!str || typeof str !== "string") return "";
+ if (str.length <= maxLen) return str;
+ if (maxLen <= suffix.length) return str.substring(0, maxLen);
+ return str.substring(0, maxLen - suffix.length) + suffix;
+ }
+
+ /**
+ * Clean song title by removing common suffixes/prefixes for better matching
+ * Used for lyrics search and display normalization
+ * @param {string} title - Raw title
+ * @returns {string} Cleaned title
+ */
+ static cleanTitle(title) {
+ if (!title || typeof title !== "string") return "Unknown";
+
+ return title
+ .replace(/\s*[\(\[][^\)\]]*(?:feat|ft|featuring|remix|edit|version|prod|official|audio|video|lyrics|visualizer)[^\)\]]*[\)\]]/gi, "")
+ .replace(/\s*-\s*(?:feat|ft|featuring)\.?.*/gi, "")
+ .replace(/\s*\|.*$/g, "") // Remove pipe and everything after
+ .replace(/\s*【.*?】/g, "") // Remove Japanese brackets
+ .replace(/\s*\[.*?\]/g, "") // Remove square brackets
+ .replace(/\s*\(.*?\)/g, "") // Remove parentheses
+ .replace(/\s{2,}/g, " ") // Collapse multiple spaces
+ .trim();
+ }
+
+ /**
+ * Sanitize string for safe filename
+ * @param {string} str - Input string
+ * @param {number} [maxLen=50] - Maximum length
+ * @returns {string} Safe filename
+ */
+ static sanitizeFilename(str, maxLen = 50) {
+ if (!str || typeof str !== "string") return "unknown";
+ return str
+ .replace(/[^a-z0-9\u4e00-\u9fa5]/gi, "_") // Keep CJK chars too
+ .replace(/_{2,}/g, "_")
+ .substring(0, maxLen)
+ .replace(/^_+|_+$/g, "");
+ }
+
+ /**
+ * Escape markdown characters for Discord
+ * @param {string} text - Raw text
+ * @returns {string} Escaped text
+ */
+ static escapeMarkdown(text) {
+ if (!text || typeof text !== "string") return "";
+ return text
+ .replace(/\\/g, "\\\\")
+ .replace(/`/g, "\\`")
+ .replace(/\*/g, "\\*")
+ .replace(/_/g, "\\_")
+ .replace(/~/g, "\\~")
+ .replace(/\|/g, "\\|");
+ }
+
+ /**
+ * Format number with commas (e.g., 1,000,000)
+ * @param {number} num - Number to format
+ * @returns {string} Formatted number
+ */
+ static formatNumber(num) {
+ if (num === null || num === undefined || isNaN(num)) return "0";
+ return num.toLocaleString();
+ }
+
+ /**
+ * Format bytes to human readable (KB, MB, GB)
+ * @param {number} bytes - Bytes to format
+ * @param {number} [decimals=2] - Decimal places
+ * @returns {string} Human readable size
+ */
+ static formatBytes(bytes, decimals = 2) {
+ if (!bytes || bytes === 0) return "0 Bytes";
+ if (bytes < 0) return "Unknown";
+
+ const k = 1024;
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
+ const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1);
+
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${sizes[i]}`;
+ }
+
+ // ═════════════════════════════════════════════════════════════════════════════
+ // ID Generation
+ // ═════════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Generate random unique ID
+ * @param {number} [length=16] - Desired length of ID (8-32 recommended)
+ * @returns {string} Random ID
+ */
+ static uid(length = 16) {
+ const targetLen = Math.max(8, Math.min(length, 32));
+
+ const timestamp = Date.now().toString(36).toUpperCase();
+ let random = "";
+
+ // Generate enough random data
+ while ((timestamp + random).length < targetLen) {
+ random += Math.random().toString(36).substring(2).toUpperCase();
+ }
+
+ return (timestamp + random).substring(0, targetLen);
+ }
+
+ /**
+ * Generate UUID v4 (RFC4122 compliant)
+ * @returns {string} UUID string
+ */
+ static uuid() {
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
+ const r = (Math.random() * 16) | 0;
+ const v = c === "x" ? r : (r & 0x3) | 0x8;
+ return v.toString(16);
+ });
+ }
+
+ // ═════════════════════════════════════════════════════════════════════════════
+ // Validation & Safety (CRITICAL for worker.mjs compatibility)
+ // ═════════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Check if a string represents a finite number
+ * @param {string} str
+ * @returns {boolean}
+ */
+ static isNumber(str) {
+ if (str === null || str === undefined || str === "") return false;
+ return !isNaN(str) && isFinite(str);
+ }
+
+ /**
+ * Check if value is a valid URL
+ * Used by worker.mjs YTUtils.isValidUrl
+ * @param {string} str - String to check
+ * @returns {boolean} True if valid URL
+ */
+ static isValidUrl(str) {
+ if (!str || typeof str !== "string") return false;
+ try {
+ new URL(str);
+ return true;
+ } catch {
+ return false;
+ }
+ }
+
+ /**
+ * Clamp number between min and max
+ * @param {number} num - Number to clamp
+ * @param {number} min - Minimum value
+ * @param {number} max - Maximum value
+ * @returns {number} Clamped value
+ */
+ static clamp(num, min, max) {
+ if (isNaN(num)) return min;
+ return Math.max(min, Math.min(max, num));
+ }
+
+ /**
+ * Safe JSON parse with fallback
+ * @template T
+ * @param {string} str - JSON string
+ * @param {T} [fallback=null] - Fallback value on error
+ * @returns {T | null} Parsed object or fallback
+ */
+ static safeJsonParse(str, fallback = null) {
+ if (!str || typeof str !== "string") return fallback;
+ try {
+ return JSON.parse(str);
+ } catch {
+ return fallback;
+ }
+ }
+
+ // ═════════════════════════════════════════════════════════════════════════════
+ // Async Utilities
+ // ═════════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Sleep/delay promise
+ * @param {number} ms - Milliseconds to sleep
+ * @returns {Promise}
+ */
+ static sleep(ms) {
+ return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
+ }
+
+ /**
+ * Retry an async operation with exponential backoff
+ * @template T
+ * @param {() => Promise} fn - Function to retry
+ * @param {number} [attempts=3] - Max retry attempts
+ * @param {number} [delay=1000] - Initial delay in ms
+ * @param {number} [backoff=2] - Backoff multiplier
+ * @returns {Promise}
+ */
+ static async retry(fn, attempts = 3, delay = 1000, backoff = 2) {
+ if (typeof fn !== "function") {
+ throw new TypeError("First argument must be a function");
+ }
+
+ let lastError;
+ for (let i = 0; i < attempts; i++) {
+ try {
+ return await fn();
+ } catch (err) {
+ lastError = err;
+ if (i < attempts - 1) {
+ await this.sleep(delay * Math.pow(backoff, i));
+ }
+ }
+ }
+ throw lastError;
+ }
+
+ /**
+ * Timeout wrapper for promises
+ * @template T
+ * @param {Promise} promise - Promise to wrap
+ * @param {number} ms - Timeout in milliseconds
+ * @param {string} [message="Operation timed out"] - Error message
+ * @returns {Promise}
+ */
+ static timeout(promise, ms, message = "Operation timed out") {
+ const timeoutPromise = new Promise((_, reject) => {
+ setTimeout(() => reject(new Error(message)), ms);
+ });
+ return Promise.race([promise, timeoutPromise]);
+ }
+
+ // ═════════════════════════════════════════════════════════════════════════════
+ // Object Utilities
+ // ═════════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Deep clone an object (JSON method - not suitable for circular refs)
+ * @template T
+ * @param {T} obj - Object to clone
+ * @returns {T} Cloned object
+ */
+ static deepClone(obj) {
+ if (obj === null || typeof obj !== "object") return obj;
+ try {
+ return JSON.parse(JSON.stringify(obj));
+ } catch {
+ return obj;
+ }
+ }
+
+ /**
+ * Pick specific keys from object
+ * @template T, K
+ * @param {T} obj - Source object
+ * @param {K[]} keys - Keys to pick
+ * @returns {Pick} New object with picked keys
+ */
+ static pick(obj, keys) {
+ if (!obj || typeof obj !== "object") return {};
+ const result = {};
+ for (const key of keys) {
+ if (key in obj) result[key] = obj[key];
+ }
+ return result;
+ }
+
+ /**
+ * Omit specific keys from object
+ * @template T, K
+ * @param {T} obj - Source object
+ * @param {K[]} keys - Keys to omit
+ * @returns {Omit} New object without omitted keys
+ */
+ static omit(obj, keys) {
+ if (!obj || typeof obj !== "object") return {};
+ const result = { ...obj };
+ for (const key of keys) {
+ delete result[key];
+ }
+ return result;
+ }
+
+ // ═════════════════════════════════════════════════════════════════════════════
+ // Music-Specific Helpers
+ // ═════════════════════════════════════════════════════════════════════════════
+
+ /**
+ * Create progress bar string
+ * @param {number} current - Current position in ms or 0-1 ratio
+ * @param {number} [total] - Total duration in ms (if omitted, current is treated as 0-1 ratio)
+ * @param {number} [length=15] - Bar length in characters
+ * @param {string} [filledChar="▬"] - Filled character
+ * @param {string} [emptyChar="▬"] - Empty character
+ * @param {string} [indicator="🔘"] - Position indicator
+ * @returns {string} Progress bar string
+ */
+ static progressBar(
+ current,
+ total,
+ length = 15,
+ filledChar = "▬",
+ emptyChar = "▬",
+ indicator = "🔘"
+ ) {
+ let progress;
+ if (total !== undefined && total > 0) {
+ progress = this.clamp(current / total, 0, 1);
+ } else {
+ progress = this.clamp(current, 0, 1);
+ }
+
+ const position = Math.floor(progress * length);
+ let bar = "";
+
+ for (let i = 0; i < length; i++) {
+ if (i === position) {
+ bar += indicator;
+ } else if (i < position) {
+ bar += filledChar;
+ } else {
+ bar += emptyChar;
+ }
+ }
+
+ return bar;
+ }
+
+ /**
+ * Format track info for display
+ * @param {object} track - Track object
+ * @param {boolean} [includeDuration=true] - Include duration
+ * @returns {string} Formatted string
+ */
+ static formatTrackInfo(track, includeDuration = true) {
+ if (!track) return "Unknown Track";
+
+ const title = this.cleanTitle(track.title || "Unknown");
+ const author = track.author?.name || track.author || "Unknown Artist";
+
+ if (includeDuration && track.duration) {
+ const duration = typeof track.duration === "number"
+ ? this.prettifyMS(track.duration)
+ : track.duration.timestamp || track.duration.seconds
+ ? this.formatSeconds(track.duration.seconds)
+ : "?:??";
+ return `${title} - ${author} [${duration}]`;
+ }
+
+ return `${title} - ${author}`;
+ }
+
+ /**
+ * Parse YouTube-like ISO duration (PT4M13S) to milliseconds
+ * @param {string} isoDuration - ISO 8601 duration
+ * @returns {number} Milliseconds
+ */
+ static parseISODuration(isoDuration) {
+ if (!isoDuration || typeof isoDuration !== "string") return 0;
+
+ const match = isoDuration.match(
+ /PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?/
+ );
+ if (!match) return 0;
+
+ const hours = parseInt(match[1] || 0, 10);
+ const minutes = parseInt(match[2] || 0, 10);
+ const seconds = parseFloat(match[3] || 0);
+
+ return (hours * 3600 + minutes * 60 + seconds) * 1000;
+ }
+}
\ No newline at end of file
diff --git a/src/constants/Logger.mjs b/src/constants/Logger.mjs
new file mode 100644
index 0000000..c939342
--- /dev/null
+++ b/src/constants/Logger.mjs
@@ -0,0 +1,65 @@
+/**
+ * Logger — configurable console output for Fluxer.
+ *
+ * Categories (all under config.logging):
+ * enabled — master switch; false silences everything except errors
+ * player — voice connect/disconnect, stream start, volume restore
+ * inactivity — alone-check, inactivity timer, human detection
+ * voice247 — 24/7 rejoin, auto-save channel, intentional leave skip
+ * voiceState — raw VOICE_STATE_UPDATE events (human join/leave detection)
+ * mediaplayer — MediaPlayer publish, LiveKit room state, connection recovery
+ * commands — command load, module load, error IDs
+ * guild — GuildCreate / GuildDelete lifecycle
+ * recovery — session save/restore on reboot
+ * settings — settings DB load, remote update errors
+ * worker — worker URL cleaning, result logging
+ * moonlink — moonlink node events
+ * errors — always on; console.error calls (cannot be disabled)
+ */
+
+let _config = null;
+
+/**
+ * Call once at startup with the loaded config object.
+ * @param {object} config
+ */
+export function initLogger(config) {
+ _config = config?.logging ?? {};
+}
+
+function isEnabled(category) {
+ if (!_config) return true; // default on if not yet initialised
+ if (_config.enabled === false) return false;
+ // If the category key is missing, default to true
+ return _config[category] !== false;
+}
+
+function ts() {
+ return new Date().toISOString().replace("T", " ").slice(0, 19);
+}
+
+export const logger = {
+ // ── always-on (errors / warnings critical to operation) ──────────────────
+ error(tag, ...args) {
+ console.error(`[${ts()}] ${tag}`, ...args);
+ },
+ warn(tag, ...args) {
+ // warnings are on unless master switch is off
+ if (_config?.enabled === false) return;
+ console.warn(`[${ts()}] ${tag}`, ...args);
+ },
+
+ // ── categorised logs ─────────────────────────────────────────────────────
+ player(...args) { if (isEnabled("player")) console.log(`[${ts()}]`, ...args); },
+ inactivity(...args) { if (isEnabled("inactivity")) console.log(`[${ts()}]`, ...args); },
+ voice247(...args) { if (isEnabled("voice247")) console.log(`[${ts()}]`, ...args); },
+ voiceState(...args) { if (isEnabled("voiceState")) console.log(`[${ts()}]`, ...args); },
+ mediaplayer(...args) { if (isEnabled("mediaplayer")) console.log(`[${ts()}]`, ...args); },
+ commands(...args) { if (isEnabled("commands")) console.log(`[${ts()}]`, ...args); },
+ guild(...args) { if (isEnabled("guild")) console.log(`[${ts()}]`, ...args); },
+ recovery(...args) { if (isEnabled("recovery")) console.log(`[${ts()}]`, ...args); },
+ settings(...args) { if (isEnabled("settings")) console.log(`[${ts()}]`, ...args); },
+ worker(...args) { if (isEnabled("worker")) console.log(`[${ts()}]`, ...args); },
+ moonlink(...args) { if (isEnabled("moonlink")) console.log(`[${ts()}]`, ...args); },
+ aloneCheck(...args) { if (isEnabled("inactivity")) console.log(`[${ts()}]`, ...args); },
+};
diff --git a/src/constants/audio/StreamMerger.mjs b/src/constants/audio/StreamMerger.mjs
new file mode 100644
index 0000000..366ec2c
--- /dev/null
+++ b/src/constants/audio/StreamMerger.mjs
@@ -0,0 +1,77 @@
+import { logger } from "../Logger.mjs";
+import ffmpeg from "ffmpeg-static";
+import { Transform } from "node:stream";
+import { spawn } from "node:child_process";
+
+class StreamMerger extends Transform {
+ ffmpegPath = ffmpeg;
+ ffmpeg = null;
+ streamTree = [];
+
+ constructor(streamOptions) {
+ super(streamOptions);
+ }
+ _transform(chunk, _enc, cb) {
+ if (!this.ffmpeg) { this.push(chunk); return cb(); }
+ this.ffmpeg.stdio[3].write(chunk);
+ cb();
+ }
+ pipe(stream) {
+ return super.pipe(stream);
+ }
+ setupBaseFfmpeg() {
+ this.ffmpeg = this.spawnFfmpeg();
+ this.ffmpeg.stderr.on("data", (chunk) => { logger.mediaplayer("[ffmpeg]", chunk.toString().trim()); });
+ this.ffmpeg.stdout.on("data", (chunk) => { this.push(chunk); });
+ }
+ spawnFfmpeg() {
+ const args = "-i pipe:3 -re -i pipe:4 -vn -fflags nobuffer -filter_complex amix=inputs=2:duration=longest pipe:1".split(" ");
+ return spawn(this.ffmpegPath, args, {
+ windowsHide: true,
+ stdio: ["pipe", "pipe", "pipe", "pipe", "pipe"]
+ });
+ }
+ findOpenNode() {
+ if (this.streamTree.length === 0) {
+ this.streamTree.push({ process: this.ffmpeg, pipes: [4], available: true, children: [] });
+ return this.streamTree[0];
+ }
+ const findChild = (node) => {
+ if (node.available) return node;
+ for (const child of node.children) {
+ const c = findChild(child);
+ if (c) return c;
+ }
+ return null;
+ };
+ for (const node of this.streamTree) {
+ const firstChild = findChild(node);
+ if (firstChild) return firstChild;
+ }
+ return null;
+ }
+ addStream(s) {
+ if (!this.ffmpeg) this.setupBaseFfmpeg();
+ const open = this.findOpenNode();
+ if (!open) throw "Impossible case detected. No free merge node found.";
+ const p = this.spawnFfmpeg();
+ const node = { process: p, pipes: [4], available: true, parent: open, children: [] };
+ open.children.push(node);
+ s.pipe(p.stdio[3]);
+ p.stderr.on("data", (c) => { logger.mediaplayer("[ffmpeg]", c.toString().trim()); });
+ p.stdio[4].write(Buffer.alloc(1024, 0));
+ p.stdout.pipe(open.process.stdio[open.pipes[0]]);
+ const pipeNumber = open.pipes[0].valueOf();
+ open.pipes.splice(0, 1);
+ if (open.pipes.length === 0) open.available = false;
+ p.on("exit", () => {
+ open.pipes.push(pipeNumber);
+ open.available = true;
+ const idx = open.children.findIndex(c => c === node);
+ if (idx === -1) throw "Impossible case detected. Damaged node structure.";
+ open.children.splice(idx, 1);
+ });
+ }
+}
+
+export default StreamMerger;
diff --git a/src/constants/audio/Tuna.mjs b/src/constants/audio/Tuna.mjs
new file mode 100644
index 0000000..b2a787a
--- /dev/null
+++ b/src/constants/audio/Tuna.mjs
@@ -0,0 +1,57 @@
+import { https } from "follow-redirects";
+
+class Tuna {
+ apiKey = null;
+ constructor(auth) {
+ this.apiKey = auth.key;
+ }
+ get(path, params = {}) {
+ return new Promise((resolve, rej) => {
+ var query = "";
+ for (let key in params) {
+ query += ((query.length === 0) ? "?" : "&") + key + "=" + encodeURIComponent(params[key]);
+ }
+ var options = {
+ method: "GET",
+ hostname: "tuna-api.voicemod.net",
+ path: path + query,
+ headers: { "x-api-key": this.apiKey },
+ maxRedirects: 20
+ };
+ var req = https.request(options, function(res) {
+ var chunks = [];
+ res.on("data", (chunk) => { chunks.push(chunk); });
+ res.on("end", () => { resolve(JSON.parse(Buffer.concat(chunks).toString())); });
+ res.on("error", (error) => { rej(error); });
+ });
+ req.end();
+ });
+ }
+ search(query, page = 1, size = 10) {
+ return new Promise(async res => {
+ const results = await this.get("/v1/sounds/search", { size, page, search: query });
+ results.items = results.items.map(s => {
+ s.download = function() {
+ return new Promise(resolve => {
+ https.get(this.oggPath, (r) => { resolve(r); });
+ });
+ };
+ return s;
+ });
+ res(results);
+ });
+ }
+ getSound(id) {
+ return new Promise(async res => {
+ const sound = await this.get("/v1/sounds/" + id);
+ sound.download = function() {
+ return new Promise(res => {
+ https.get(this.oggPath, (result) => { res(result); });
+ });
+ };
+ res(sound);
+ });
+ }
+}
+
+export default Tuna;
diff --git a/src/constants/providers.mjs b/src/constants/providers.mjs
new file mode 100644
index 0000000..90269f9
--- /dev/null
+++ b/src/constants/providers.mjs
@@ -0,0 +1,103 @@
+/**
+ * providers.mjs — Single source of truth for all provider data.
+ *
+ * PROVIDERS — full map: { prefix, label } — used by worker.mjs for search
+ * PROVIDER_NAMES — derived label-only map — used by Player.mjs for display
+ * PROVIDER_CHOICES — ordered list of valid keys — used by command option builders
+ *
+ * Edit only here; worker.mjs and Player.mjs import from this file.
+ */
+
+export const PROVIDERS = {
+ // ── Standard search ──────────────────────────────────────────────────────
+ yt: { prefix: "ytsearch", label: "YouTube" },
+ ytm: { prefix: "ytmsearch", label: "YouTube Music" },
+ scld: { prefix: "scsearch", label: "SoundCloud" },
+ sc: { prefix: "scsearch", label: "SoundCloud" },
+ sp: { prefix: "spsearch", label: "Spotify" },
+ spotify: { prefix: "spsearch", label: "Spotify" },
+ am: { prefix: "amsearch", label: "Apple Music" },
+ apple: { prefix: "amsearch", label: "Apple Music" },
+ dz: { prefix: "dzsearch", label: "Deezer" },
+ deezer: { prefix: "dzsearch", label: "Deezer" },
+ td: { prefix: "tdsearch", label: "Tidal" },
+ tidal: { prefix: "tdsearch", label: "Tidal" },
+ bc: { prefix: "bcsearch", label: "Bandcamp" },
+ bandcamp: { prefix: "bcsearch", label: "Bandcamp" },
+ adm: { prefix: "admsearch", label: "Audiomack" },
+ audiomack: { prefix: "admsearch", label: "Audiomack" },
+ gaana: { prefix: "gaanasearch", label: "Gaana" },
+ js: { prefix: "jssearch", label: "JioSaavn" },
+ jiosaavn: { prefix: "jssearch", label: "JioSaavn" },
+ lf: { prefix: "lfsearch", label: "Last.fm" },
+ lastfm: { prefix: "lfsearch", label: "Last.fm" },
+ pd: { prefix: "pdsearch", label: "Pandora" },
+ pandora: { prefix: "pdsearch", label: "Pandora" },
+ vk: { prefix: "vksearch", label: "VK Music" },
+ mc: { prefix: "mcsearch", label: "Mixcloud" },
+ mixcloud: { prefix: "mcsearch", label: "Mixcloud" },
+ nc: { prefix: "ncsearch", label: "NicoVideo" },
+ nicovideo: { prefix: "ncsearch", label: "NicoVideo" },
+ bb: { prefix: "bilibili", label: "Bilibili" },
+ bilibili: { prefix: "bilibili", label: "Bilibili" },
+ sh: { prefix: "shsearch", label: "Shazam" },
+ shazam: { prefix: "shsearch", label: "Shazam" },
+ sl: { prefix: "slsearch", label: "Songlink" },
+ songlink: { prefix: "slsearch", label: "Songlink" },
+ qb: { prefix: "qbsearch", label: "Qobuz" },
+ qobuz: { prefix: "qbsearch", label: "Qobuz" },
+ ym: { prefix: "ymsearch", label: "Yandex Music" },
+ yandex: { prefix: "ymsearch", label: "Yandex Music" },
+ au: { prefix: "ausearch", label: "Audius" },
+ audius: { prefix: "ausearch", label: "Audius" },
+ az: { prefix: "azsearch", label: "Amazon Music" },
+ amazon: { prefix: "azsearch", label: "Amazon Music" },
+ ag: { prefix: "agsearch", label: "Anghami" },
+ anghami: { prefix: "agsearch", label: "Anghami" },
+ bk: { prefix: "bksearch", label: "Bluesky" },
+ bluesky: { prefix: "bksearch", label: "Bluesky" },
+ // ── Recommendations ──────────────────────────────────────────────────────
+ ytrec: { prefix: "ytrec", label: "YouTube (recommended)" },
+ sprec: { prefix: "sprec", label: "Spotify (recommended)" },
+ dzrec: { prefix: "dzrec", label: "Deezer (recommended)" },
+ tdrec: { prefix: "tdrec", label: "Tidal (recommended)" },
+ jsrec: { prefix: "jsrec", label: "JioSaavn (recommended)" },
+ vkrec: { prefix: "vkrec", label: "VK Music (recommended)" },
+ // ── TTS ──────────────────────────────────────────────────────────────────
+ gtts: { prefix: "gtts", label: "Google TTS" },
+ tts: { prefix: "gtts", label: "Google TTS" },
+ ftts: { prefix: "ftts", label: "Flowery TTS" },
+};
+
+/** Label-only map — convenience alias for display use (e.g. Player.mjs). */
+export const PROVIDER_NAMES = Object.fromEntries(
+ Object.entries(PROVIDERS).map(([k, v]) => [k, v.label])
+);
+
+export const PROVIDER_CHOICES = [
+ "ytm", "yt", "scld", "sc",
+ "sp", "spotify",
+ "am", "apple",
+ "dz", "deezer",
+ "td", "tidal",
+ "bc", "bandcamp",
+ "adm", "audiomack",
+ "gaana",
+ "js", "jiosaavn",
+ "lf", "lastfm",
+ "pd", "pandora",
+ "vk",
+ "mc", "mixcloud",
+ "nc", "nicovideo",
+ "bb", "bilibili",
+ "sh", "shazam",
+ "sl", "songlink",
+ "qb", "qobuz",
+ "ym", "yandex",
+ "au", "audius",
+ "az", "amazon",
+ "ag", "anghami",
+ "bk", "bluesky",
+ "ytrec", "sprec", "dzrec", "tdrec", "jsrec", "vkrec",
+ "gtts", "tts", "ftts",
+];
diff --git a/src/probe.mjs b/src/probe.mjs
new file mode 100644
index 0000000..527be23
--- /dev/null
+++ b/src/probe.mjs
@@ -0,0 +1,43 @@
+import ffprobe from "ffprobe-static";
+import { spawn } from "node:child_process";
+
+export default function probe(file) {
+ return new Promise((res, rej) => {
+ // Pass args as an array — splitting a string on " " breaks paths that contain spaces.
+ const args = [
+ "-hide_banner",
+ "-show_entries", "format_tags:format=duration",
+ "-print_format", "json",
+ "-i", file,
+ ];
+ const proc = spawn(ffprobe.path, args);
+ const chunks = [];
+ const errChunks = [];
+
+ proc.stdout.on("data", (d) => { chunks.push(d); });
+ proc.stderr.on("data", (d) => { errChunks.push(d); });
+
+ proc.on("error", (err) => {
+ rej(new Error("[probe] Failed to spawn ffprobe: " + err.message));
+ });
+
+ proc.on("close", (code) => {
+ try {
+ const raw = Buffer.concat(chunks).toString();
+ if (!raw.trim()) {
+ const errMsg = Buffer.concat(errChunks).toString().trim();
+ return rej(new Error("[probe] ffprobe produced no output" + (errMsg ? ": " + errMsg : "")));
+ }
+ const data = JSON.parse(raw);
+ res({
+ album: data.format?.tags?.album,
+ artist: data.format?.tags?.artist,
+ title: data.format?.tags?.StreamTitle || data.format?.tags?.title || "Unknown",
+ duration: (data.format?.duration ?? 0) * 1000
+ });
+ } catch (e) {
+ rej(new Error("[probe] Failed to parse ffprobe output: " + e.message));
+ }
+ });
+ });
+}
diff --git a/src/worker.mjs b/src/worker.mjs
new file mode 100644
index 0000000..412287f
--- /dev/null
+++ b/src/worker.mjs
@@ -0,0 +1,362 @@
+/**
+ * worker.mjs — NodeLink REST edition (moonlink.js session-aware)
+ *
+ * Track resolution runs in a Worker thread so it never blocks the main loop.
+ * The Manager's active session ID is forwarded via workerData so all REST
+ * requests carry the correct Session-Id header (populated by moonlink.js).
+ *
+ * No direct moonlink.js import here — Worker threads can't share the Manager
+ * instance, so we call NodeLink REST directly (same protocol moonlink uses).
+ */
+
+import { workerData, parentPort } from "worker_threads";
+import { EventEmitter } from "events";
+import http from "http";
+import https from "https";
+import { Utils } from "./Utils.mjs";
+import { PROVIDERS } from "./constants/providers.mjs";
+import { logger } from "./constants/Logger.mjs";
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// NodeLink Configuration (forwarded from Player via workerData)
+// ═══════════════════════════════════════════════════════════════════════════════
+
+const nl = workerData?.data?.nodelink ?? {};
+const NL_HOST = nl.host ?? "localhost";
+const NL_PORT = nl.port ?? 3000;
+const NL_PASSWORD = nl.password ?? "youshallnotpass";
+const NL_SESSION_ID = nl.sessionId ?? null; // provided by moonlink.js Manager
+const NL_GUILD_ID = workerData?.data?.guildId ?? null;
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// HTTP Helper
+// ═══════════════════════════════════════════════════════════════════════════════
+
+/**
+ * Make a GET request to NodeLink and return the parsed JSON body.
+ * @param {string} path - API path (e.g. "/v4/loadtracks?identifier=…")
+ * @returns {Promise}
+ */
+function nlGet(path) {
+ return new Promise((resolve, reject) => {
+ const isHttps = NL_PORT === 443;
+ const mod = isHttps ? https : http;
+ const protocol = isHttps ? "https" : "http";
+
+ const req = mod.get(
+ `${protocol}://${NL_HOST}:${NL_PORT}${path}`,
+ {
+ headers: {
+ Authorization: NL_PASSWORD,
+ ...(NL_SESSION_ID ? { "Session-Id": NL_SESSION_ID } : {}),
+ ...(NL_GUILD_ID ? { "Guild-Id": NL_GUILD_ID } : {}),
+ }
+ },
+ (res) => {
+ const chunks = [];
+ res.on("data", d => chunks.push(d));
+ res.on("end", () => {
+ try {
+ resolve(JSON.parse(Buffer.concat(chunks).toString()));
+ } catch (e) {
+ reject(new Error(`NodeLink JSON parse error: ${e.message}`));
+ }
+ });
+ }
+ );
+
+ req.on("error", reject);
+ req.setTimeout(30_000, () => {
+ req.destroy();
+ reject(new Error("NodeLink request timeout"));
+ });
+ });
+}
+
+/**
+ * Call NodeLink /v4/loadtracks.
+ * @param {string} identifier
+ * @returns {Promise}
+ */
+async function loadTracks(identifier) {
+ return nlGet(`/v4/loadtracks?identifier=${encodeURIComponent(identifier)}`);
+}
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// Track Conversion
+// ═══════════════════════════════════════════════════════════════════════════════
+
+/**
+ * Convert a NodeLink track object to the internal video format.
+ * @param {object} track
+ * @returns {object|null}
+ */
+function trackToVideo(track) {
+ if (!track || typeof track !== "object") return null;
+
+ const info = track.info ?? {};
+ const ms = info.length ?? 0;
+
+ return {
+ videoId: info.identifier ?? "",
+ encoded: track.encoded ?? "",
+ sourceName: info.sourceName ?? "unknown",
+ title: Utils.cleanTitle(info.title ?? "Unknown"),
+ url: info.uri ?? `https://www.youtube.com/watch?v=${info.identifier}`,
+ thumbnail: info.artworkUrl ?? null,
+ spotifyUrl: null,
+ duration: {
+ timestamp: Utils.prettifyMS(ms),
+ seconds: Math.floor(ms / 1000),
+ },
+ author: {
+ name: info.author ?? "Unknown",
+ url: info.uri ?? null,
+ },
+ artists: null,
+ };
+}
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// Provider Configuration (imported from constants/providers.mjs)
+// ═══════════════════════════════════════════════════════════════════════════════
+
+const TYPE_MODIFIERS = ["track","playlist","album","artist","channel","user"];
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// YTUtils Class
+// ═══════════════════════════════════════════════════════════════════════════════
+
+class YTUtils extends EventEmitter {
+ constructor() { super(); }
+
+ isValidUrl(str) { return Utils.isValidUrl(str); }
+ _prefix(p) { return PROVIDERS[p]?.prefix ?? "ytmsearch"; }
+ _providerLabel(p) { return PROVIDERS[p]?.label ?? "YouTube Music"; }
+
+ _buildIdentifier(provider, query) {
+ const prefix = this._prefix(provider);
+ const colonIdx = query.indexOf(":");
+ if (colonIdx !== -1) {
+ const maybeType = query.slice(0, colonIdx).toLowerCase();
+ if (TYPE_MODIFIERS.includes(maybeType)) return `${prefix}:${query}`;
+ }
+ return `${prefix}:track:${query}`;
+ }
+
+ /**
+ * Clean YouTube Radio/Mix URLs to extract just the video
+ * YouTube Radio URLs (list=RD...) often cause metadata mismatches
+ */
+ _cleanYouTubeUrl(url) {
+ try {
+ const urlObj = new URL(url);
+
+ // Check if it's a YouTube Radio/Mix URL
+ const list = urlObj.searchParams.get("list");
+ if (list && list.startsWith("RD")) {
+ // Extract just the video ID and create clean URL
+ const videoId = urlObj.searchParams.get("v");
+ if (videoId) {
+ logger.worker(`[Worker] Cleaning YouTube Radio URL, extracted video: ${videoId}`);
+ return `https://www.youtube.com/watch?v=${videoId}`;
+ }
+ }
+
+ // Remove start_radio parameter if present
+ if (urlObj.searchParams.has("start_radio")) {
+ urlObj.searchParams.delete("start_radio");
+ return urlObj.toString();
+ }
+
+ return url;
+ } catch (e) {
+ return url;
+ }
+ }
+
+ async getResults(query, limit = 5, provider = "ytm") {
+ const id = this.isValidUrl(query) ? query : this._buildIdentifier(provider, query);
+ const data = await loadTracks(id);
+
+ let tracks = [];
+ if (data.loadType === "search") tracks = data.data ?? [];
+ else if (data.loadType === "track") tracks = [data.data];
+ else if (data.loadType === "playlist") tracks = data.data?.tracks ?? [];
+
+ const validTracks = tracks.filter(track => {
+ const info = track.info ?? {};
+ const uri = info.uri || "";
+ if (uri.includes("/channel/")) return false;
+ if (uri.includes("/c/") && !uri.includes("/watch")) return false;
+ if (uri.includes("/playlist?")) return false;
+ if (uri.includes("/user/")) return false;
+ if (!info.length || info.length === 0) return false;
+ return true;
+ });
+
+ const resultTracks = validTracks.length > 0 ? validTracks : tracks;
+ return { data: resultTracks.slice(0, limit).map(trackToVideo) };
+ }
+
+ async getVideoData(query, provider = "ytm") {
+ // Handle URLs (including YouTube Radio/Mix)
+ if (this.isValidUrl(query)) {
+ this.emit("message", "Loading...");
+
+ // Clean YouTube Radio URLs to prevent metadata mismatches
+ const cleanedUrl = this._cleanYouTubeUrl(query);
+ if (cleanedUrl !== query) {
+ logger.worker(`[Worker] URL cleaned: ${query} -> ${cleanedUrl}`);
+ }
+
+ let data;
+ try {
+ data = await loadTracks(cleanedUrl);
+ } catch (e) {
+ this.emit("message", `**Failed to load: ${e.message}**`);
+ return { type: "error", data: null, error: e.message };
+ }
+
+ // Handle playlist results
+ if (data.loadType === "playlist") {
+ const tracks = (data.data?.tracks ?? []).map(trackToVideo);
+ tracks.forEach(t => { t.playlistName = data.data?.info?.name ?? null; });
+ this.emit("message", `Successfully added **${tracks.length}** songs to the queue.`);
+ return { type: "list", data: tracks };
+ }
+
+ // Handle single track
+ if (data.loadType === "track") {
+ const video = trackToVideo(data.data);
+ this.emit("message", `Successfully added [${video.title}](${video.url}) to the queue.`);
+ return { type: "video", data: video };
+ }
+
+ // Handle search results (take first)
+ if (data.loadType === "search" && data.data?.length) {
+ const video = trackToVideo(data.data[0]);
+ this.emit("message", `Successfully added [${video.title}](${video.url}) to the queue.`);
+ return { type: "video", data: video };
+ }
+
+ // No recognizable loadType
+ this.emit("message", `**Could not load that URL.** (loadType: ${data.loadType || "unknown"})`);
+ return { type: "error", data: null, error: "Unknown loadType: " + (data.loadType || "none") };
+ }
+
+ // Handle search queries (non-URLs)
+ this.emit("message", `Searching ${this._providerLabel(provider)}...`);
+
+ let data;
+ try {
+ data = await loadTracks(this._buildIdentifier(provider, query));
+ } catch (e) {
+ this.emit("message", `**Search failed: ${e.message}**`);
+ return { type: "error", data: null, error: e.message };
+ }
+
+ // Handle search results
+ if (data.loadType === "search" && data.data?.length) {
+ const validTrack = data.data.find(track => {
+ const info = track.info ?? {};
+ const uri = info.uri || "";
+ if (uri.includes("/channel/")) return false;
+ if (uri.includes("/c/") && !uri.includes("/watch")) return false;
+ if (!info.length || info.length === 0) return false;
+ return true;
+ });
+ const trackToUse = validTrack || data.data[0];
+ const video = trackToVideo(trackToUse);
+ this.emit("message", `Successfully added [${video.title}](${video.url}) to the queue.`);
+ return { type: "video", data: video };
+ }
+
+ // Handle playlist from search
+ if (data.loadType === "playlist") {
+ const tracks = (data.data?.tracks ?? []).map(trackToVideo);
+ if (tracks.length > 0) {
+ this.emit("message", `Successfully added **${tracks.length}** songs to the queue.`);
+ return { type: "list", data: tracks };
+ }
+ }
+
+ // Single track from search
+ if (data.loadType === "track") {
+ const video = trackToVideo(data.data);
+ this.emit("message", `Successfully added [${video.title}](${video.url}) to the queue.`);
+ return { type: "video", data: video };
+ }
+
+ // Nothing found
+ this.emit("message", `**No results found for '${query}'.**`);
+ return { type: "error", data: null, error: "No results found" };
+ }
+}
+
+// ═══════════════════════════════════════════════════════════════════════════════
+// Worker Entry Point
+// ═══════════════════════════════════════════════════════════════════════════════
+
+const jobId = workerData?.jobId;
+const data = workerData?.data;
+
+if (!jobId) {
+ logger.error("No jobId provided to worker");
+ process.exit(1);
+}
+
+const utils = new YTUtils();
+
+const post = (event, payload) => {
+ parentPort.postMessage(JSON.stringify({ event, data: payload }));
+};
+
+utils.on("message", (m) => {
+ if (jobId === "dev") { logger.worker("[Message]", m); return; }
+ post("message", m);
+});
+
+utils.on("error", (m) => {
+ if (jobId === "dev") { logger.worker("[Error]", m); return; }
+ post("error", m);
+});
+
+(async () => {
+ if (jobId === "dev") {
+ try {
+ const result = await utils.getVideoData("Neoni funeral", "ytm");
+ logger.worker("[Worker result]", result);
+ } catch (e) {
+ logger.error("[Worker error]", e);
+ }
+ return;
+ }
+
+ try {
+ switch (jobId) {
+ case "generalQuery": {
+ const result = await utils.getVideoData(data.query, data.provider);
+ post("finished", result);
+ break;
+ }
+ case "searchResults": {
+ const result = await utils.getResults(data.query, data.resultCount, data.provider);
+ post("finished", result);
+ break;
+ }
+ case "search": {
+ const result = await utils.getVideoData(String(data), "ytm");
+ post("finished", result?.data ?? null);
+ break;
+ }
+ default:
+ logger.error("Invalid jobId:", jobId);
+ post("error", `Unknown jobId: ${jobId}`);
+ }
+ } catch (err) {
+ post("error", err.message);
+ } finally {
+ process.exit(0);
+ }
+})();
\ No newline at end of file
diff --git a/storage/defaults.json b/storage/defaults.json
new file mode 100644
index 0000000..5302ff7
--- /dev/null
+++ b/storage/defaults.json
@@ -0,0 +1,20 @@
+{
+ "values": {
+ "songAnnouncements": true,
+ "prefix": "%",
+ "pfp": "default",
+ "locale": "en",
+ "stay_247": "none",
+ "stay_247_mode": "off",
+ "volume": 100
+ },
+ "descriptions": {
+ "songAnnouncements": "Whether the bot should announce every song in a new message when it starts playing. Set to `true` or `1` to enable.",
+ "prefix": "The prefix used to trigger commands.",
+ "pfp": "What profile picture the bot should use. Presets: `default | dark | light | mono | `.",
+ "locale": "The preferred language of your server.",
+ "stay_247": "24/7 mode channels. Managed automatically by %247 — do not edit manually.",
+ "stay_247_mode": "Controls 247 behaviour. Set via %247 off/on/auto. off = disabled, on = stay but no rejoin on force-kick, auto = stay and always rejoin.",
+ "volume": "The default playback volume for this server (1-200). Saved automatically when you use %volume. Restored every time the bot joins a channel."
+ }
+}
\ No newline at end of file
diff --git a/storage/locales/bot/ar-SA.json b/storage/locales/bot/ar-SA.json
new file mode 100644
index 0000000..e2e10d1
--- /dev/null
+++ b/storage/locales/bot/ar-SA.json
@@ -0,0 +1,118 @@
+{
+ "cmdBuilder" : {
+ "requirement" : {
+ "permission" : "ليس لديك الصلاحية لكي تأمر هذا الأمر!"
+ },
+ "subcommand" : {
+ "invalid" : "أمر فرعي لا يوجد. جرب أحد من الأمور الآتية: `$previousCmd <$cmdlist>`"
+ }
+ },
+ "cmdHandler" : {
+ "command" : {
+ "invalid" : "أمر مجهول {{command}}!",
+ "suggestion" : "هل كنت تقصد {{command}}؟ (أكتب {{acceptCommand}} لكي تأمر بهذا الأمر)"
+ },
+ "help" : {
+ "pageStructure" : "الأوامر المتوفرة (صفحة $currPage/$maxPage): $content أَصدر أمر `$prefix$helpCmd <أمر>` لكي تستعلم عن الأمر. لديك أيضاً القدرة أن تستعلم عن الأمور الفرعية. علي سبيل المثال: `$prefix$helpCmd settings get` نصيحة: استخدم الأسهم أسفل هذه الرسالة لتقليب الصفحات، أو اختر الصفحة المطلوبة باستخدام `$prefix$helpCmd <رقم الصفحة>`"
+ },
+ "invalidFlag" : "خيار غير صالح `$invalidFlag`. إنه لا يطابق أي خيارات لهذا الأمر. `$previousCmd $invalidFlag`",
+ "page" : {
+ "invalid" : "{{number}} ليس رقم لصفحة صحيح!"
+ },
+ "permissions" : {
+ "message" : "الرجاء الإعطاء لي إذن {{permission}} في قناة {{channel}} أو اتصل بمسؤول السيرفر. أنا ليس لدي القدرة أن أعمل من غير هذا الإذن."
+ }
+ },
+ "commands" : {
+ "clear" : "أزل جميع الأغاني من القائمة.",
+ "join" : "اجعل البوت يدخل لقناة صوتية محددة.",
+ "leave" : "اجعل البوت يغادر القناة الصوتية الحالية لك",
+ "list" : "درج الأغاني في القائمة الخاصة بقناة الصوت الحالية.",
+ "login" : "أكد تسجيل الدخول لحسابك علي الموقع",
+ "loop" : "بدل تكرار القائمة لديك أو الأغنية.",
+ "lyrics" : "جلب كلمات الأغنية الحالية. يرجي الملاحظة أن الكلمات قد تكون مختلفة عن الكلمات الفعلية لأن Genius لا يجد الأغنية الصحيحة دائما.",
+ "np" : "أطلب الاسم والرابط للأغنية الحالية.",
+ "pause" : "توقيف الصوت في القناة الصوتية",
+ "ping" : "بادئتي في هذا الخادم هي: {{prefix}}. استخدم {{helpCmd}} لكي تبدأ!",
+ "play" : "شغل فيديو يوتيوب من رابط أو بحث أو قائمة تشغيل علي يوتيوب من رابط. بعض الخدمات الأخري مدعومة أيضاً.",
+ "player" : "إنشاء رسالة تحكم بالإيموجي لقناتك الصوتية",
+ "playnext" : "مثل %play. النتيجة ستضاف في أعلي قائمة الإنتظار.",
+ "remove" : "مسح أغنية معينة من قائمة الانتظار.",
+ "resume" : "تكملة تشغيل الصوت في قناتك الصوتية",
+ "search" : "عرض نتائج البحث عن بحث ما",
+ "settings" : "تغيير أو جلب الإعدادات للسيرفر الحالي.",
+ "shuffle" : "يرتب قائمة الإنتظار عشوائياً.",
+ "skip" : "تخطي الأغنية الحالية.",
+ "stats" : "عرض إحصائيات عن البوت مثل مدة التشغيل.",
+ "support" : "سيرفر الدعم لRemix. لا تتردد في طلب المساعدة، التبليغ عن المشاكل أو التحادث :)",
+ "thumbnail" : "طلب فن الأغنية الحالية.",
+ "volume" : "تغيير مقدار الصوت."
+ },
+ "options" : {
+ "join" : {
+ "channel" : "حدد القناة الذي يدخل إليها البوت. هذا ضروري لدي قيود Revolt الحالية."
+ },
+ "login" : {
+ "id" : "المعرف الذي استلمته عند تسجيل الدخول عند لوحة القيادة."
+ },
+ "loop" : {
+ "type" : "يحدد ما يكرر (قائمة الإنتظار كاملاً أم الأغنية الحالية)."
+ },
+ "play" : {
+ "query" : "رابط أو بحث علي يوتيوب أو رابط قائمة تشغيل أو رابط لأغنية Spotify أو SoundCloud أو YouTube Music."
+ },
+ "playnext" : {
+ "query" : "رابط أو بحث علي يوتيوب أو رابط قائمة تشغيل أو رابط لأغنية Spotify أو SoundCloud أو YouTube Music."
+ },
+ "remove" : {
+ "index" : "موضع الأغنية في قائمة الإنتظار. يمكنك عرض الأرقام التسلسلية بأمر 'list'"
+ },
+ "search" : {
+ "provider" : "مزود البحث (YouTube أو YouTube Music). الإفتراضي: YouTube Music",
+ "query" : "كلمات البحث."
+ },
+ "settings" : {
+ "get" : {
+ "setting" : "جلب قيمة لإعداد ما."
+ },
+ "set" : {
+ "setting" : "اسم الإعداد الذي تود أن تعدله.",
+ "value" : "القيمة الجديدة."
+ }
+ },
+ "volume" : {
+ "volume" : "حجم الصوت الجديد بالنسب المئوية (علي سبيل المثال `30` أو `100`). إذا كبرت حجم الصوت فوق 100% قد يكون هناك فقدان للجودة."
+ }
+ },
+ "pagination" : {
+ "embed" : {
+ "sclosedContent" : "{{content}} الجلسة مغلقة - قلب الصفحات **لن يعمل** من هنا.",
+ "sclosedTitle" : "الجلسة مغلقة"
+ },
+ "error" : {
+ "perms" : {
+ "messages" : "لا يمكنني إرسال رسائل في {{channel}}. يرجى الاتصال بمسؤول الخادم ومنحي إذن \"SendMessage\".",
+ "reactions" : "أحتاج إلى أذونات رد الفعل للعمل. الرجاء الاتصال بمسؤول الخادم لمعالجة هذا."
+ }
+ }
+ },
+ "subcommands" : {
+ "settings" : {
+ "get" : "جلب قيمة إعداد معين أو إعدادات السيرفر.",
+ "set" : "تعديل قيمة إعداد معين."
+ }
+ },
+ "voice" : {
+ "join" : {
+ "cancelled" : "الغاء!",
+ "error" : {
+ "dc" : "لا يبدو أننا في نفس القناة الصوتية.",
+ "invalid" : "قناة صوتية غير صالحة. يرجى المحاولة مرة أخرى والتحقق من الأحرف الكبيرة! (`x` للإلغاء)",
+ "perms" : "حدث خطأ ما. غير قادر على الانضمام إلى {{channel}}. هل لدي الإذن المطلوب؟"
+ },
+ "warning" : {
+ "nc" : "لا يبدو أنك متصل ب {{channel}}. هل نسيت الانضمام؟"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/storage/locales/bot/ckb.json b/storage/locales/bot/ckb.json
new file mode 100644
index 0000000..005b347
--- /dev/null
+++ b/storage/locales/bot/ckb.json
@@ -0,0 +1,118 @@
+{
+ "cmdBuilder" : {
+ "requirement" : {
+ "permission" : "تۆ مۆڵەتی پێویستت نییە بۆ جێبەجێکردنی ئەم فەرمانە!"
+ },
+ "subcommand" : {
+ "invalid" : "فەرمانی لاوەکی نادروست. یەکێک لەم هەڵبژاردنانەی خوارەوە تاقی بکەرەوە: `$previousCmd <$cmdlist>`"
+ }
+ },
+ "cmdHandler" : {
+ "command" : {
+ "invalid" : "فەرمانی نەناسراو {{command}}!",
+ "suggestion" : "مەبەستت {{command}} بوو؟ (بۆ جێبەجێکردنی ئەمە بنووسە {{acceptCommand}})"
+ },
+ "help" : {
+ "pageStructure" : "فەرمانە بەردەستەکان (لاپەڕە $currPage/$maxPage): \n\n$content\n\n`$prefix$helpCmd <فەرمان>` بنووسە بۆ زانینی زیاتر. دەتوانیت فەرمانی لاوەکیش لەخۆبگرێت.\nنموونە: `$prefix$helpCmd settings get`\n\nتێبینی: تیرەکانی خوارەوەی ئەم نامەیە بەکاربهێنە بۆ گۆڕینی لاپەڕەکان، یان ژمارەی لاپەڕەی پێویست دیاریبکە بە `$prefix$helpCmd <ژمارەی لاپەڕە>`"
+ },
+ "invalidFlag" : "ئاڵای نادروست `$invalidFlag`. لەگەڵ هیچ هەڵبژاردنێکی ئەم فەرمانە نایگونجێت.\n`$previousCmd $invalidFlag`",
+ "page" : {
+ "invalid" : "{{number}} ژمارەی لاپەڕەیەکی دروست نییە!"
+ },
+ "permissions" : {
+ "message" : "تکایە مۆڵەتی {{permission}} م پێ بدە لە {{channel}} یان پەیوەندی بە بەڕێوەبەری سێرڤەرەوە بکە. من بەبێ ئەمە ناتوانم نەشتەرگەری بکەم."
+ }
+ },
+ "commands" : {
+ "clear" : "هەموو گۆرانییەکان لە ڕیزەکە بسڕەوە.",
+ "join" : "بۆتەکە بکە بچێتە کەناڵێکی دەنگی دیاریکراو.",
+ "leave" : "وا لە بۆتەکە بکە کەناڵی دەنگی ئێستات بەجێبهێڵێت",
+ "list" : "گۆرانییەکانی ڕیزەکەی کەناڵی دەنگی ئێستات لیست بکە.",
+ "login" : "چوونەژوورەوەی ئەکاونتەکەت لە ماڵپەڕەکەدا پشتڕاست بکەرەوە",
+ "loop" : "گەڕانەوەی ڕیزە/گۆرانییەکە کوز بکەرەوە.",
+ "lyrics" : "دەقی گۆرانییەکەی ئێستا بهێنەوە. تکایە تێبینی بکە کە دەقەکە لەوانەیە جیاواز بێت لە دەقی ڕاستەقینەکە، چونکە Genius هەمیشە گۆرانییەکەی دروست نادۆزێتەوە.",
+ "np" : "ناو و بەستەری گۆرانییەکەی ئێستا داوا بکە.",
+ "pause" : "وەستاندنی پەخشکردنەکە لە کەناڵی دەنگیدا",
+ "ping" : "پێشگرەکەی من لەم سێرڤەرەدا بریتییە لە: {{prefix}}\n\n{{helpCmd}} بەکاربهێنە بۆ دەستپێکردن!",
+ "play" : "ڤیدیۆیەکی یوتیوب پەخش بکە بە url/پرسیار یان پلەی لیست بە url. خزمەتگوزارییە تریش پشتگیری دەکرێن.\nبە شێوەیەکی بنەڕەتی گەڕان لەسەر `Youtube Music` دەکرێت.\nئەگەر دەتەوێت لەسەر `YouTube` بگەڕێیت دەبێت ئەمەش بە ئاشکرا دیاری بکەیت بە `-u yt`.",
+ "player" : "کۆنتڕۆڵی پەخشکەری ئیموجی بۆ کەناڵی دەنگیت دروست بکە",
+ "playnext" : "وەکوو %play. ئەنجامەکە لە سەرەوەی ڕیزەکە زیاد دەکرێت.",
+ "remove" : "گۆرانییەکێکی دیاریکراو لە ڕیزەکە دەربهێنە.",
+ "resume" : "بەردەوامکردنی پەخشکردنەکە لە کەناڵی دەنگیدا",
+ "search" : "ئەنجامی گەڕان بۆ پرسیارێکی دیاریکراو نیشان بدە",
+ "settings" : "ڕێکخستنەکان لە سێرڤەری ئێستادا بگۆڕە/بهێنەوە.",
+ "shuffle" : "ڕیزەکە بە شێوازێکی هەڕەمەکی دووبارە ڕیز بکەرەوە.",
+ "skip" : "گۆرانییەکەی ئێستا بتێپەڕێ.",
+ "stats" : "ئامارەکانی بۆت نیشان بدە وەکوو کاتی فعال.",
+ "support" : "سێرڤەری پشتگیری Remix. بە ئازادی داوای یارمەتی بکە، هەڵەکان ڕاپۆرت بکە یان تەنها چاوپێکەوتن بکە :)",
+ "thumbnail" : "وێنەی بچووکی گۆرانییەکەی ئێستا داوا بکە.",
+ "volume" : "دەنگی ئێستا بگۆڕە."
+ },
+ "options" : {
+ "join" : {
+ "channel" : "کەناڵێک دیاری بکە کە بۆت پێیدا بچێت. ئەمە پێویستە بەهۆی سنووردارییەکانی (ئێستای) Revolt."
+ },
+ "login" : {
+ "id" : "ناسنامەکەی کە لە کاتی چوونەژوورەوە لە داشبۆردەکەدا وەرت گرتووە."
+ },
+ "loop" : {
+ "type" : "دیاریدەکات کام loop دەبێت کوز بکرێتەوە."
+ },
+ "play" : {
+ "query" : "پرسیار/url ی یوتیوب، url ی پلەی لیست، یان بەستەرێک بۆ گۆرانییەکی Spotify، SoundCloud، یان YouTube Music."
+ },
+ "playnext" : {
+ "query" : "پرسیار/url ی یوتیوب، url ی پلەی لیست، یان بەستەرێک بۆ گۆرانییەکی Spotify، SoundCloud، یان YouTube Music."
+ },
+ "remove" : {
+ "index" : "شوێنی گۆرانییەکە لە ڕیزەکەدا. دەتوانیت بە فرمانی 'list' سەیری پێوەرەکان بکەیت"
+ },
+ "search" : {
+ "provider" : "دابینکەری ئەنجامی گەڕان. (YouTube یان YouTube Music)",
+ "query" : "ئەو پرسیارەی کە پێویستە بەدوایدا بگەڕێیت."
+ },
+ "settings" : {
+ "get" : {
+ "setting" : "بەهای ئێستای ڕێکخستنێک بەدەست بهێنە."
+ },
+ "set" : {
+ "setting" : "ناوی ئەو ڕێکخستنەی کە دەتەوێت ڕێکی بخەیت.",
+ "value" : "بەها نوێیەکە."
+ }
+ },
+ "volume" : {
+ "volume" : "قەبارەی نوێ بە ڕێژەی سەدی (بۆ نموونە `30` یان `100`). ئەگەر بچیتە سەرووی 100% لەوانەیە لەدەستدانی کوالیتی هەبێت."
+ }
+ },
+ "pagination" : {
+ "embed" : {
+ "sclosedContent" : "{{content}}\nدانیشتنەکە داخراوە - گۆڕینی لاپەڕەکان **کارناکات** لێرەوە.",
+ "sclosedTitle" : "دانیشتن داخرا"
+ },
+ "error" : {
+ "perms" : {
+ "messages" : "من ناتوانم نامە بنێرم لە {{channel}}. تکایە پەیوەندی بە بەڕێوەبەری سێرڤەرێکەوە بکەن و مۆڵەتی \"SendMessage\"م پێ بدەن.",
+ "reactions" : "بۆ کارکردن پێویستم بە مۆڵەتی کاردانەوە هەیە. تکایە پەیوەندی بە بەڕێوەبەری سێرڤەرێکەوە بکە بۆ چارەسەرکردنی ئەمە."
+ }
+ }
+ },
+ "subcommands" : {
+ "settings" : {
+ "get" : "بەهای ڕێکخستنێکی دیاریکراو یان ڕێکخستنەکانی سێرڤەرەکە بەدەستبهێنە.",
+ "set" : "بەهای ڕێکخستنێکی دیاریکراو دابنێ."
+ }
+ },
+ "voice" : {
+ "join" : {
+ "cancelled" : "هەڵوەشایەوە!",
+ "error" : {
+ "dc" : "پێناچێت لە یەک کەناڵی دەنگیدا بین.",
+ "invalid" : "کەناڵی دەنگی نادروست. تکایە دووبارە هەوڵبدەرەوە و پیتی گەورە بزانە! (`x` بۆ هەڵوەشاندنەوە)",
+ "perms" : "هەندێ شت بە هەڵە ڕۆیشت. ناتوانرێت بەشداری {{channel}} بکەیت. ئایا مۆڵەتی پێویستم هەیە؟"
+ },
+ "warning" : {
+ "nc" : "پێناچێت تۆ پەیوەندیت بە {{channel}}ەوە هەبێت. لەبیرت چوو بەشداری بکەیت؟"
+ }
+ }
+ }
+}
diff --git a/storage/locales/bot/de-DE.json b/storage/locales/bot/de-DE.json
new file mode 100644
index 0000000..b08b36e
--- /dev/null
+++ b/storage/locales/bot/de-DE.json
@@ -0,0 +1,118 @@
+{
+ "cmdBuilder" : {
+ "requirement" : {
+ "permission" : "Du hast nicht die notwendigen Berechtigungen, dieses Kommando hier auszuführen."
+ },
+ "subcommand" : {
+ "invalid" : "Ungültiger Unterbefehl. Versuche es bitte mit einer dieser Optionen `$previousCmd <$cmdlist>`"
+ }
+ },
+ "cmdHandler" : {
+ "command" : {
+ "invalid" : "Unbekanntes Kommando {{command}}!",
+ "suggestion" : "Meintest du {{command}}? (Nutze {{acceptCommand}}, um dies auszuführen)"
+ },
+ "help" : {
+ "pageStructure" : "Verfügbare Kommandos (page $currPage/$maxPage): $content Nutze das Kommando `$prefix$helpCmd ` um mehr zu erfahren. Du kannst auch zusätzliche Unterbefehle nutzen, wie zum Beispiel: `$prefix$helpCmd command subcommandName` Noch ein Tip: Nutze die Pfeile unter dieser Nachricht, um Seiten umzublättern, oder gib eine gewünschte Seitenzahl mit `$prefix$helpCmd ` an!"
+ },
+ "invalidFlag" : "Ungültige Flag `$invalidFlag`. Sie stimmt mit keiner der Optionen im Kommando überein. `$previousCmd $invalidFlag`",
+ "page" : {
+ "invalid" : "{{number}} ist keine gültige Seiten-Nummer!"
+ },
+ "permissions" : {
+ "message" : "Bitte erteile mir die {{permission}}-Berechtigung in {{channel}} oder informiere einen Server-Admin. Ich habe in diesem Zustand keinen Zugriff, um zu arbeiten."
+ }
+ },
+ "commands" : {
+ "clear" : "Entferne alle Songs aus der Warteschlange.",
+ "join" : "Lasse den Bot einem bestimmten Sprachkanal beitreten",
+ "leave" : "Lasse den Bot deinen aktuellen Sprachkanal verlassen",
+ "list" : "Listet die Songs in der Warteschlange deines Kanals auf.",
+ "login" : "Bestätige die Anmeldung deines Kontos auf der Webseite",
+ "loop" : "Aktiviere/Deaktiviere die Schleife des aktuellen Songs oder der Warteschlange.",
+ "lyrics" : "Rufe den Songtext des aktuellen Liedes auf. Bitte beachte, dass dieser vom tatsächlichen Text abweichen kann, da Genius nicht immer den richtigen Song findet.",
+ "np" : "Rufe den Namen und die URL des Songs ab, der gerade abgespielt wird.",
+ "pause" : "Pausiere die Wiedergabe in deinem Sprachkanal",
+ "ping" : "Mein Präfix in diesem Server ist: {{prefix}}\n\nFühre {{helpCmd}} aus, um loszulegen!",
+ "play" : "Spiele ein YouTube-Video mithilfe einer URL/einem Suchbegriff, oder eine Playlist von einer URL. Einige andere Dienste sind auch unterstützt. \nSuchen werden standardmäßig über `Youtube Music` ausgeführt. Um `Youtube` zu verwenden, muss das mit der Option `-u yt` explizit angegeben werden.",
+ "player" : "Erstellen eine Emoji-Steuerung für deinen Sprachkanal",
+ "playnext" : "Siehe %play. Die gefundenen Songs werden am Anfang der Warteschlange eingefügt.",
+ "remove" : "Entferne einen bestimmten Song von der Warteschlange.",
+ "resume" : "Setze die Wiedergabe in deinem Sprachkanal fort",
+ "search" : "Listet die Suchergebnisse für eine bestimmte Suchanfrage auf",
+ "settings" : "Rufe die Einstellungen eines Servers ab, oder ändere diese.",
+ "shuffle" : "Ordnet die Warteschlange zufällig an.",
+ "skip" : "Überspringe den aktuellen Song.",
+ "stats" : "Rufe Statistiken über den Bot ab.",
+ "support" : "Der Support-Server für Remix. Zögere nicht, um Hilfe zu bitten, Bugs zu melden oder einfach zu chatten :)",
+ "thumbnail" : "Rufe das Thumbnail des aktuellen Songs ab.",
+ "volume" : "Ändere die aktuelle Lautstärke."
+ },
+ "options" : {
+ "join" : {
+ "channel" : "Gebe den Kanal an, dem der Bot beitreten soll. Dies ist aufgrund Revolt-Einschränkungen notwendig."
+ },
+ "login" : {
+ "id" : "Die ID, die du beim Einloggen auf dem Dashboard erhalten hast."
+ },
+ "loop" : {
+ "type" : "Gibt an, welcher Schleifentyp gesetzt werden soll."
+ },
+ "play" : {
+ "query" : "Eine YouTube-Suchanfrage/URL, Playlist-URL oder ein Link zu einem Song auf Spotify, SoundCloud oder YouTube Music."
+ },
+ "playnext" : {
+ "query" : "Eine YouTube-Suchanfrage/URL, Playlist-URL oder ein Link zu einem Song auf Spotify, SoundCloud oder YouTube Music."
+ },
+ "remove" : {
+ "index" : "Die Position des Liedes in der Warteschlange. Die Position aller Lieder kann mit dem `list` Befehl aufgerufen werden."
+ },
+ "search" : {
+ "provider" : "Der Anbieter der Suchergebnisse (YouTube oder YouTube Music). Standard: YouTube Music",
+ "query" : "Der Such-Text, nach dem gesucht werden soll."
+ },
+ "settings" : {
+ "get" : {
+ "setting" : "Rufe den Wert einer bestimmten Einstellung ab."
+ },
+ "set" : {
+ "setting" : "Der Name der Einstellung, die bearbeitet werden soll.",
+ "value" : "Der neue Wert der Einstellung."
+ }
+ },
+ "volume" : {
+ "volume" : "Die neue Lautstärke in Prozent (z.B.: `30` oder `100`). Werte über 100 % können Qualitätsverluste verursachen."
+ }
+ },
+ "pagination" : {
+ "embed" : {
+ "sclosedContent" : "{{content}}\nSitzung geschlossen - Das Umblättern funktioniert ab jetzt **nicht mehr**.",
+ "sclosedTitle" : "Sitzung geschlossen"
+ },
+ "error" : {
+ "perms" : {
+ "messages" : "Ich kann keine Nachrichten in {{channel}} senden. Bitte wende dich an einen Serveradministrator und erteile mir die Berechtigung \"SendMessage\"",
+ "reactions" : "Ich brauche die Berechtigung, auf Nachrichten zu reagieren. Bitte wende dich an einen Serveradministrator, um dies zu klären."
+ }
+ }
+ },
+ "subcommands" : {
+ "settings" : {
+ "get" : "Rufe den Wert einer bestimmten Einstellung oder eine Liste der Einstellungen des gesamten Servers auf.",
+ "set" : "Lege den Wert einer bestimmten Einstellung fest."
+ }
+ },
+ "voice" : {
+ "join" : {
+ "cancelled" : "Abgebrochen!",
+ "error" : {
+ "dc" : "Es scheint, als wären wir nicht im selben Sprachkanal.",
+ "invalid" : "Ungültiger Sprachkanal. Bitte versuche es erneut und überprüfe deine Eingabe auf Groß- und Kleinschreibung! (`x` zum Abbrechen)",
+ "perms" : "Etwas ist schiefgelaufen. Ich kann {{channel}} nicht betreten. Habe ich die nötigen Berechtigungen?"
+ },
+ "warning" : {
+ "nc" : "Es scheint, als wärst du nicht mit {{channel}} verbunden. Hast du vergessen, dort beizutreten?"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/storage/locales/bot/en.json b/storage/locales/bot/en.json
new file mode 100644
index 0000000..583b8ad
--- /dev/null
+++ b/storage/locales/bot/en.json
@@ -0,0 +1,118 @@
+{
+ "cmdBuilder" : {
+ "requirement" : {
+ "permission" : "You don't have the needed permissions to run this command!"
+ },
+ "subcommand" : {
+ "invalid" : "Invalid subcommand. Try one of the following options: `$previousCmd <$cmdlist>`"
+ }
+ },
+ "cmdHandler" : {
+ "command" : {
+ "invalid" : "Unknown command {{command}}!",
+ "suggestion" : "Did you mean {{command}}? (Type {{acceptCommand}} to run this)"
+ },
+ "help" : {
+ "pageStructure" : "Available Commands (page $currPage/$maxPage): \n\n$content\n\nRun `$prefix$helpCmd ` to learn more about it. You can also include subcommands.\nFor example: `$prefix$helpCmd settings get`\n\nTip: Use the arrows beneath this message to turn pages, or specify the required page by using `$prefix$helpCmd `"
+ },
+ "invalidFlag" : "Invalid flag `$invalidFlag`. It doesn't match any options on this command.\n`$previousCmd $invalidFlag`",
+ "page" : {
+ "invalid" : "{{number}} is not a valid page number!"
+ },
+ "permissions" : {
+ "message" : "Please grant me the {{permission}} permission in {{channel}} or contact a server administrator. I am unable to operate without this."
+ }
+ },
+ "commands" : {
+ "clear" : "Remove all songs from the queue.",
+ "join" : "Make the bot join a specific voice channel.",
+ "leave" : "Make the bot leave your current voice channel",
+ "list" : "List the songs in the queue of your current voice channel.",
+ "login" : "Confirm the login of your account on the website",
+ "loop" : "Toggle the looping of your queue/song.",
+ "lyrics" : "Fetch the lyrics of the current song. Please note that the lyrics might differ from the actual ones, as Genius doesn't always find the right song.",
+ "np" : "Request the name and url of the currently playing song.",
+ "pause" : "Pause the playback in your voice channel",
+ "ping" : "My prefix in this server is: {{prefix}}\n\nUse {{helpCmd}} to get started!",
+ "play" : "Play a youtube video from url/query or a playlist by url. Other services are supported as well.\nSearches will be done on `Youtube Music` by default.\nIf you want to search on `YouTube` you will have to specify that with `-u yt` explicitly.",
+ "player" : "Create an emoji player control for your voice channel",
+ "playnext" : "Same as %play. The result will be added to the top of the queue.",
+ "remove" : "Remove a specific song from the queue.",
+ "resume" : "Resume the playback in your voice channel",
+ "search" : "Display the search results for a given query",
+ "settings" : "Change/Get settings in the current server.",
+ "shuffle" : "Re-orders the queue randomly.",
+ "skip" : "Skip the current playing song.",
+ "stats" : "Display stats about the bot like the uptime.",
+ "support" : "The support server for Remix. Feel free to ask help, report bugs or just chat :)",
+ "thumbnail" : "Request the thumbnail of the currently playing song.",
+ "volume" : "Change the current volume."
+ },
+ "options" : {
+ "join" : {
+ "channel" : "Specify the channel, the bot should join. This is necessary due to (current) Revolt limitations."
+ },
+ "login" : {
+ "id" : "The id you got from logging in at the dashboard."
+ },
+ "loop" : {
+ "type" : "Specifies what loop should be toggled."
+ },
+ "play" : {
+ "query" : "A YouTube query/url, playlist url, or a link to a Spotify, SoundCloud, or YouTube Music song."
+ },
+ "playnext" : {
+ "query" : "A YouTube query/url, playlist url, or a link to a Spotify, SoundCloud, or YouTube Music song."
+ },
+ "remove" : {
+ "index" : "The position of the song in the queue. You can view the indices with the 'list' command"
+ },
+ "search" : {
+ "provider" : "The search result provider (YouTube or YouTube Music). Default: Youtube Music",
+ "query" : "The query to search for."
+ },
+ "settings" : {
+ "get" : {
+ "setting" : "Get the current value of a setting."
+ },
+ "set" : {
+ "setting" : "The name of the setting you want to set.",
+ "value" : "The new value."
+ }
+ },
+ "volume" : {
+ "volume" : "The new volume in percentages (e.g. `30` or `100`). If you go above 100% there might be quality loss."
+ }
+ },
+ "pagination" : {
+ "embed" : {
+ "sclosedContent" : "{{content}}\nSession closed - Changing pages **won't work** from here.",
+ "sclosedTitle" : "Session Closed"
+ },
+ "error" : {
+ "perms" : {
+ "messages" : "I am unable to send messages in {{channel}}. Please contact a server administrator and grant me the \"SendMessage\" permission.",
+ "reactions" : "I need reaction permissions to work. Please contact a server administrator to address this."
+ }
+ }
+ },
+ "subcommands" : {
+ "settings" : {
+ "get" : "Get the value of a specific setting or the settings of the server.",
+ "set" : "Set the value of a specific setting."
+ }
+ },
+ "voice" : {
+ "join" : {
+ "cancelled" : "Cancelled!",
+ "error" : {
+ "dc" : "It doesn't look like we're in the same voice channel.",
+ "invalid" : "Invalid voice channel. Please try again and check capitalization! (`x` to cancel)",
+ "perms" : "Something went wrong. Unable to join {{channel}}. Do I have the needed permissions?"
+ },
+ "warning" : {
+ "nc" : "You don't seem to be connected to {{channel}}. Did you forget to join?"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/storage/locales/bot/pt-BR.json b/storage/locales/bot/pt-BR.json
new file mode 100644
index 0000000..c1b339e
--- /dev/null
+++ b/storage/locales/bot/pt-BR.json
@@ -0,0 +1,18 @@
+{
+ "cmdBuilder" : {
+ "requirement" : {
+ "permission" : "Você não tem as permissões necessárias para executar este comando!"
+ }
+ },
+ "cmdHandler" : {
+ "command" : {
+ "invalid" : "Comando desconhecido {{command}}!"
+ },
+ "page" : {
+ "invalid" : "{{number}} não é um n"
+ }
+ },
+ "commands" : {
+ "clear" : "Remover todas m"
+ }
+}
\ No newline at end of file
diff --git a/storage/modules.json b/storage/modules.json
new file mode 100644
index 0000000..1d0937b
--- /dev/null
+++ b/storage/modules.json
@@ -0,0 +1,12 @@
+[
+ {
+ "name": "wb-dashboard",
+ "index": "./dashboard/index.js",
+ "enabled": false
+ },
+ {
+ "name": "rbl-stats",
+ "index": "./rbl.js",
+ "enabled": false
+ }
+]
diff --git a/storage/stats.json b/storage/stats.json
new file mode 100644
index 0000000..12922e1
--- /dev/null
+++ b/storage/stats.json
@@ -0,0 +1,4 @@
+{
+ "playlists": 30,
+ "songs": 600
+}