mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e30cdc6a3 | ||
|
|
e9d0a0b54b | ||
|
|
c9cf813e6a | ||
|
|
e31c77e0d8 | ||
|
|
64e69275a4 | ||
|
|
d6c233c311 | ||
|
|
af23db1255 | ||
|
|
784458f387 | ||
|
|
ee1b9be917 | ||
|
|
351336ea19 | ||
|
|
90a53f047f | ||
|
|
665be29a16 | ||
|
|
08e5d363fc | ||
|
|
04aece8af3 |
No files matched your search
@@ -82,7 +82,7 @@ Configuration (config.json, all optional — defaults shown):
|
||||
"spawnTimeout": 30000, "spawnDelay": 5000 }
|
||||
```
|
||||
|
||||
`FLUXER_TOTAL_SHARDS` / `FLUXER_SHARDS_PER_PROCESS` env vars override the config (useful in Docker, where you switch the container command to `node shard.mjs`). Prefer an explicit `totalShards` — Fluxer's `/gateway/bot` always reports `shards: 1`, so there is no reliable `"auto"`.
|
||||
`FLUXER_TOTAL_SHARDS` / `FLUXER_SHARDS_PER_PROCESS` env vars override the config (Docker Compose runs `node shard.mjs` by default). Prefer an explicit `totalShards` — Fluxer's `/gateway/bot` always reports `shards: 1`, so there is no reliable `"auto"`.
|
||||
|
||||
Beta caveats worth knowing: DMs and guild-less events only reach shard 0 (library limitation); each child opens its own MySQL/Redis/Lavalink connections and its own dashboard RPC subscription, so the dashboard is currently single-process-first — guilds on other shards won't be reachable from it, and concurrent `storage/stats.json` writes across children can race. The stock `node index.mjs` deployment has none of these issues.
|
||||
|
||||
@@ -129,12 +129,14 @@ A few things worth knowing:
|
||||
- **Seek** — jump to a specific position in the current track
|
||||
- **Track options** — set custom start/end times per track, great for album compilations and hidden tracks
|
||||
- **Queue move** — reorder tracks by moving them to a different position
|
||||
- **Audio filters** — bassboost, speed, nightcore and more (applied server-side by NodeLink)
|
||||
- **Audio filters & DSP effects** — real-time equalizer bassboost (low/medium/hard), nightcore, vaporwave, 8D audio, and fine-grained `%speed` & `%pitch` controls
|
||||
- **Dynamic volume normalization** — ReplayGain & EBU R128 loudness leveling across YouTube, Spotify, and SoundCloud (`%normalize`)
|
||||
- **Large playlist streaming** — background chunked ingestion for massive Spotify & SoundCloud playlists (>100 tracks) with instant playback start
|
||||
- **Server settings** — per-guild configuration (prefix, volume, locale, 24/7 channels, …) stored in MySQL
|
||||
- **Dashboard backend** — optional Redis-RPC backend that an external web frontend uses to monitor players and control playback remotely
|
||||
- **Multi-language support** — English, Arabic, German, Kurdish (Sorani), and Brazilian Portuguese
|
||||
- **Multi-language support** — English, Arabic, German, Kurdish (Sorani), Brazilian Portuguese, and Turkish
|
||||
- **Configurable logging** — granular control over which log categories appear in the console
|
||||
- **Graceful shutdown** — destroys players and closes MySQL/Redis/NodeLink sessions cleanly on SIGINT/SIGTERM/SIGUSR2
|
||||
- **Graceful shutdown & Queue Persistence** — flushes active player queues and playback positions into MySQL (`player_state`) before cleanly destroying players and closing MySQL/Redis/NodeLink sessions on SIGINT/SIGTERM/SIGUSR2
|
||||
- **Module system** — pluggable module architecture for extending bot functionality (`storage/modules.json`)
|
||||
|
||||
---
|
||||
@@ -174,7 +176,11 @@ Below is the complete list of Remix's commands. The default prefix is `%`.
|
||||
| `lyrics` | Display synced lyrics from NodeLink | `%lyrics` | `lyric`, `ly` |
|
||||
| `thumbnail` | Get the thumbnail of the current track | `%thumbnail` | `thumb` |
|
||||
| `radio` | Play a built-in or custom radio station | `%radio` | `r` |
|
||||
| `filter` | Manage audio filters (bass, speed, nightcore, etc.) | `%filter bass 50` | `filters`, `fx`, `effect` |
|
||||
| `filter` | Interactive audio filter picker (bass, speed, nightcore, 8D, etc.) | `%filter` | `filters`, `fx`, `effect` |
|
||||
| `bassboost` | Apply a low, medium, or hard bass boost equalizer | `%bassboost hard` | `bb`, `bass` |
|
||||
| `speed` | Adjust playback speed multiplier (0.5×–2.0×) in real time | `%speed 1.25` | `rate`, `tempo` |
|
||||
| `pitch` | Adjust audio pitch multiplier (0.5×–2.0×) in real time | `%pitch 1.2` | `semitone`, `tune` |
|
||||
| `normalize` | Toggle dynamic volume normalization & ReplayGain leveling | `%normalize` / `%normalize on` | `replaygain`, `volumenormalize`, `norm` |
|
||||
| `player` | Create an interactive emoji control panel with live progress | `%player` | |
|
||||
| `join` | Make the bot join a specific voice channel | `%join 123456789` | |
|
||||
| `leave` | Make the bot leave the current voice channel | `%leave` | `l`, `stop` |
|
||||
@@ -188,12 +194,14 @@ Below is the complete list of Remix's commands. The default prefix is `%`.
|
||||
|
||||
| Command | Description | Usage | Aliases |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `ping` | Check the bot's latency and connection health | `%ping` | `latency`, `pong` |
|
||||
| `settings` | View or change server settings (requires Manage Server) | `%settings set` | `prefix`, `pfx`, `247` |
|
||||
| `stats` | Display bot stats (uptime, ping, player count, stored scrobbles) | `%stats` | `info` |
|
||||
| `stats` | Display bot stats (uptime, ping, player count, stored scrobbles) | `%stats` | `info`, `botinfo`, `about` |
|
||||
| `invite` | Get the bot invite link | `%invite` | `addbot`, `remix` |
|
||||
| `support` | Get an invite to the support server | `%support` | `server` |
|
||||
| `lastfm` | Link Last.fm, toggle scrobbling, view profile, love/unlove tracks, top artists, play tracks, leaderboard | `%lastfm link` / `%lastfm love` / `%lastfm artists` / `%lastfm lb` | `lf`, `lfm` |
|
||||
| `vote` | Check FluxerList voters for the bot | `%vote` | |
|
||||
| `logtest` | Send a test entry to your error-log channel (owner) | `%logtest` | |
|
||||
| `reload` | Reload commands or modules at runtime (owner) | `%reload` | |
|
||||
| `servers` | List servers the bot is in (owner) | `%servers` | |
|
||||
| `eval` | Evaluate JavaScript (owner only) | `%eval 1+1` | |
|
||||
@@ -403,6 +411,7 @@ Key configuration options in `config.json`:
|
||||
| Option | Type | Default | Description |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `token` | string | — | **Required.** Fluxer bot token |
|
||||
| `instanceUrl` | string/null | `null` | Base URL of a self-hosted Fluxer instance (leave null for fluxer.app) |
|
||||
| `prefix` | string | `%` | Default command prefix |
|
||||
| `embedColor` | string | `0xe9196c` | Hex color for embed messages |
|
||||
| `owners` | string[] | `[]` | User IDs with owner privileges |
|
||||
@@ -410,14 +419,18 @@ Key configuration options in `config.json`:
|
||||
| `customStatsFooter` | string | — | Custom text shown in the `%stats` embed footer |
|
||||
| `presenceInterval` | number | `30000` | Interval in ms for rotating bot presence status |
|
||||
| `presenceContents` | array | `[]` | Presence status messages to cycle through (strings or objects with `text`/`emoji_name`/`emoji_id`/`activity`) |
|
||||
| `mysql` | object | — | **Required.** MySQL connection settings |
|
||||
| `mysql` | object | — | **Required.** MySQL connection settings (`host`, `port`, `user`, `password`, `database`, `connectionLimit`) |
|
||||
| `nodelink` | object | — | NodeLink connection (`host`, `port`, `password`, `requestTimeout`) |
|
||||
| `audio` | object | — | Audio streaming options (`allowLoadstream: false` for zero-re-encode `/v4/trackstream`) |
|
||||
| `bilibili` | object | — | Anonymous Bilibili proxy (`enabled`, `bind`, `port`, `advertiseHost`, `remoteProxy`, `remoteSecret`) |
|
||||
| `lastfm` | object | — | Last.fm integration (`apiKey`, `apiSecret`, `scrobbleThreshold`, `scrobbleMinMs`) |
|
||||
| `fluxerlist` | object | — | FluxerList integration (`apiKey`, `serverId`, `botId`, `serverSlug`, `botSlug`) |
|
||||
| `dashboard` | object | — | Dashboard backend: `enabled`, `redis.url` |
|
||||
| `errorLogChannel` | object | — | Error log forwarding to Fluxer channel (`enabled`, `channelId`, `forwardWarn`, `forwardInfo`, `startupMessage`) |
|
||||
| `radio` | array | `[]` | Custom radio station definitions |
|
||||
| `logging` | object | — | Per-category log toggles: `enabled`, `warn`, and 14 categories (`player`, `inactivity`, `aloneCheck`, `voiceState`, `voice247`, `voice`, `mediaplayer`, `commands`, `guild`, `recovery`, `settings`, `lavalink`, `dashboard`, `redis`) |
|
||||
| `timers` | object | — | Timing values in ms: `inactivityTimeout`, `aloneCheckInterval`, `aloneCheckDebounce`, `rejoin247Delay`, `leave247RejoinDelay`, `playerUpdateInterval`, `searchSessionTimeout`, `playerSessionTimeout`, `intentionalLeaveTTL` |
|
||||
| `sharding` | object | — | Sharding supervisor options (`totalShards`, `shardsPerProcess`, `respawn`, `spawnTimeout`, `spawnDelay`) |
|
||||
| `fluxer.js` | object | — | Fluxer.js REST options (`timeout`, `retries`) |
|
||||
|
||||
---
|
||||
@@ -432,7 +445,7 @@ fluxer/
|
||||
│ # one child process per shard slice, each running index.mjs
|
||||
├── config_example.json # Configuration template
|
||||
├── package.json
|
||||
├── commands/ # 37 command entry files (one per command); the three
|
||||
├── commands/ # 43 command entry files (one per command); the three
|
||||
│ │ # largest (lastfm, settings, debug) are split into action-family
|
||||
│ │ # modules inside commands/<name>/ subdirectories
|
||||
│ ├── lastfm/ # lastfm action families (account, playback, listening,
|
||||
@@ -511,6 +524,7 @@ fluxer/
|
||||
│ ├── constants.mjs # Signed API-call plumbing
|
||||
│ └── urlUtils.mjs # lastfm:// URL parsing
|
||||
├── db/ # Persistence
|
||||
│ ├── PoolManager.mjs # Unified MySQL pool manager (callback & promise APIs)
|
||||
│ ├── Settings.mjs # SettingsManager / ServerSettings / RemoteSettingsManager
|
||||
│ │ # (MySQL-backed, debounced JSON_SET writes)
|
||||
│ └── DatabaseManager.mjs # mysql2 pool + parameterized queries + bcrypt helpers
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @module commands/bassboost
|
||||
* @description Quick equalizer bass boost filter with low, medium, and hard presets.
|
||||
*/
|
||||
|
||||
import { CommandBuilder } from "../src/commands/index.mjs";
|
||||
import { EmbedBuilder } from "@fluxerjs/core";
|
||||
import { getGlobalColor } from "../src/ui/index.mjs";
|
||||
|
||||
export const BASSBOOST_PRESETS = {
|
||||
low: {
|
||||
label: "Low",
|
||||
equalizer: [
|
||||
{ band: 0, gain: 0.25 },
|
||||
{ band: 1, gain: 0.20 },
|
||||
{ band: 2, gain: 0.15 },
|
||||
{ band: 3, gain: 0.10 },
|
||||
],
|
||||
},
|
||||
medium: {
|
||||
label: "Medium",
|
||||
equalizer: [
|
||||
{ band: 0, gain: 0.60 },
|
||||
{ band: 1, gain: 0.70 },
|
||||
{ band: 2, gain: 0.50 },
|
||||
{ band: 3, gain: 0.25 },
|
||||
{ band: 4, gain: 0.00 },
|
||||
{ band: 5, gain: -0.25 },
|
||||
{ band: 6, gain: -0.45 },
|
||||
{ band: 7, gain: -0.55 },
|
||||
{ band: 8, gain: -0.60 },
|
||||
],
|
||||
},
|
||||
hard: {
|
||||
label: "Hard",
|
||||
equalizer: [
|
||||
{ band: 0, gain: 1.00 },
|
||||
{ band: 1, gain: 1.10 },
|
||||
{ band: 2, gain: 0.80 },
|
||||
{ band: 3, gain: 0.50 },
|
||||
{ band: 4, gain: 0.25 },
|
||||
{ band: 5, gain: -0.20 },
|
||||
{ band: 6, gain: -0.45 },
|
||||
{ band: 7, gain: -0.65 },
|
||||
{ band: 8, gain: -0.80 },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {CommandBuilder}
|
||||
* @description Command definition for the bassboost command.
|
||||
*/
|
||||
export const command = new CommandBuilder()
|
||||
.setName("bassboost")
|
||||
.setDescription("Apply a low, medium, or hard bass boost equalizer effect.", "commands.bassboost")
|
||||
.setCategory("music")
|
||||
.addChoiceOption(o =>
|
||||
o.setName("level")
|
||||
.setDescription("Bass boost level: 'low', 'medium', 'hard', or 'off'.", "options.bassboost.level")
|
||||
.addChoices("low", "medium", "hard", "off")
|
||||
.setRequired(false)
|
||||
)
|
||||
.addAliases("bb", "bass");
|
||||
|
||||
/**
|
||||
* Run handler for the bassboost command.
|
||||
*
|
||||
* @param {object} message - The command message wrapper.
|
||||
* @param {object} data - Parsed command data.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function run(message, data) {
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
if (!p) return;
|
||||
|
||||
const levelArg = data.get("level")?.value?.toLowerCase() || "medium";
|
||||
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor());
|
||||
|
||||
if (levelArg === "off" || levelArg === "none" || levelArg === "reset") {
|
||||
await p.applyFilter({}, null);
|
||||
embed.setDescription(this.t(message, "responses.bassboost.disabled"));
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
const preset = BASSBOOST_PRESETS[levelArg] || BASSBOOST_PRESETS.medium;
|
||||
const filterMeta = {
|
||||
key: `bassboost_${levelArg}`,
|
||||
label: `Bass Boost (${preset.label})`,
|
||||
emoji: "🔊",
|
||||
};
|
||||
|
||||
const res = await p.applyFilter({ equalizer: preset.equalizer }, filterMeta);
|
||||
if (!res.ok) {
|
||||
embed.setDescription(this.t(message, "responses.bassboost.failed", { reason: res.reason || "Unknown error" }));
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
embed.setDescription(this.t(message, "responses.bassboost.applied", { level: preset.label }));
|
||||
message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
+27
-4
@@ -13,20 +13,43 @@ import { getGlobalColor } from "../src/ui/index.mjs";
|
||||
*/
|
||||
export const command = new CommandBuilder()
|
||||
.setName("clear")
|
||||
.setDescription("Remove all songs from the queue.", "commands.clear")
|
||||
.setDescription("Remove all songs, or a slice of songs, from the queue.", "commands.clear")
|
||||
.addAliases("c")
|
||||
.setCategory("music");
|
||||
.setCategory("music")
|
||||
.addNumberOption(o =>
|
||||
o.setName("from")
|
||||
.setDescription("Starting queue position to clear from (optional, 1-based).")
|
||||
.setRequired(false)
|
||||
)
|
||||
.addNumberOption(o =>
|
||||
o.setName("to")
|
||||
.setDescription("Ending queue position to clear to (optional, 1-based).")
|
||||
.setRequired(false)
|
||||
);
|
||||
|
||||
/**
|
||||
* Run handler for the clear command.
|
||||
* Clears the entire queue and sends a confirmation embed.
|
||||
* Clears the entire queue, or a specified range of tracks, and sends a confirmation embed.
|
||||
*
|
||||
* @param {object} msg - The command message wrapper.
|
||||
* @param {object} [data] - Parsed options.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function run(msg) {
|
||||
export async function run(msg, data) {
|
||||
const p = await this.getPlayer(msg, false, false, false);
|
||||
if (!p) return;
|
||||
|
||||
const fromVal = data?.get?.("from")?.value;
|
||||
const toVal = data?.get?.("to")?.value;
|
||||
|
||||
if (fromVal != null && fromVal !== undefined) {
|
||||
if (fromVal < 1) return msg.replyEmbed("Queue position must be 1 or greater.").catch(() => {});
|
||||
const startIdx = Math.floor(fromVal) - 1;
|
||||
const endIdx = (toVal != null && toVal !== undefined && toVal >= 1) ? Math.floor(toVal) - 1 : startIdx;
|
||||
const res = p.removeRange(startIdx, endIdx);
|
||||
return msg.replyEmbed(res).catch(() => {});
|
||||
}
|
||||
|
||||
p.clear();
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(getGlobalColor())
|
||||
|
||||
@@ -20,6 +20,20 @@ const FILTERS = [
|
||||
desc: "Remove all filters — restore original audio",
|
||||
payload: {},
|
||||
},
|
||||
{
|
||||
emoji: "🔉",
|
||||
key: "bassboost_low",
|
||||
label: "Bass Boost (Low)",
|
||||
desc: "Subtle low-end boost for acoustic & gentle tracks",
|
||||
payload: {
|
||||
equalizer: [
|
||||
{ band: 0, gain: 0.25 },
|
||||
{ band: 1, gain: 0.20 },
|
||||
{ band: 2, gain: 0.15 },
|
||||
{ band: 3, gain: 0.10 },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
emoji: "🔊",
|
||||
key: "bassboost",
|
||||
@@ -44,6 +58,25 @@ const FILTERS = [
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
emoji: "💥",
|
||||
key: "bassboost_hard",
|
||||
label: "Bass Boost (Hard)",
|
||||
desc: "Maximum sub-bass boost — skull-shattering low end",
|
||||
payload: {
|
||||
equalizer: [
|
||||
{ band: 0, gain: 1.00 },
|
||||
{ band: 1, gain: 1.10 },
|
||||
{ band: 2, gain: 0.80 },
|
||||
{ band: 3, gain: 0.50 },
|
||||
{ band: 4, gain: 0.25 },
|
||||
{ band: 5, gain: -0.20 },
|
||||
{ band: 6, gain: -0.45 },
|
||||
{ band: 7, gain: -0.65 },
|
||||
{ band: 8, gain: -0.80 },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
emoji: "🌙",
|
||||
key: "nightcore",
|
||||
|
||||
+126
-13
@@ -13,51 +13,164 @@ import { EMOJI_REMOVE_TIMEOUT } from "../src/utils/UI.mjs";
|
||||
/** @type {CommandBuilder} @description Command definition for the lyrics command. */
|
||||
export const command = new CommandBuilder()
|
||||
.setName("lyrics")
|
||||
.setDescription("Display synced lyrics from NodeLink", "commands.lyrics")
|
||||
.setDescription("Display synced or unsynced lyrics for the current track or a queried song.", "commands.lyrics")
|
||||
.addAliases("lyric", "ly")
|
||||
.setCategory("music");
|
||||
.setCategory("music")
|
||||
.addTextOption(o =>
|
||||
o.setName("query")
|
||||
.setDescription("The song title and artist to search lyrics for (optional).", "options.lyrics.query")
|
||||
.setRequired(false)
|
||||
);
|
||||
|
||||
/** @private @type {string[]} Loading animation frames. */
|
||||
const LOADING_FRAMES = ["◐", "◓", "◑", "◒"];
|
||||
/** @private @type {number} Session timeout in milliseconds (3 minutes). */
|
||||
const SESSION_MS = 180_000;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Search LRCLIB and NodeLink directly for lyrics when no player is active or a custom query is passed.
|
||||
* @param {object|null} lavalink
|
||||
* @param {string} rawQuery
|
||||
* @param {string} searchTitle
|
||||
* @param {string|null} searchArtist
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
async function fetchDirectLyrics(lavalink, rawQuery, searchTitle, searchArtist) {
|
||||
const headers = { "User-Agent": "FluxerBot/1.0 (music bot lyrics lookup)" };
|
||||
const urls = [];
|
||||
if (searchArtist) {
|
||||
const p1 = new URLSearchParams({ track_name: searchTitle, artist_name: searchArtist });
|
||||
urls.push("https://lrclib.net/api/search?" + p1.toString());
|
||||
}
|
||||
const p2 = new URLSearchParams({ q: rawQuery });
|
||||
urls.push("https://lrclib.net/api/search?" + p2.toString());
|
||||
|
||||
let candidates = [];
|
||||
for (const url of urls) {
|
||||
try {
|
||||
const res = await fetch(url, { headers, signal: AbortSignal.timeout(10_000) });
|
||||
if (!res.ok) continue;
|
||||
const body = await res.json();
|
||||
if (Array.isArray(body) && body.length) {
|
||||
candidates = body;
|
||||
break;
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
if (candidates.length) {
|
||||
const best = Utils.pickBestLyrics(candidates, {
|
||||
title: searchTitle,
|
||||
artist: searchArtist,
|
||||
durationSec: null,
|
||||
}) || candidates[0];
|
||||
|
||||
if (best) {
|
||||
if (best.instrumental) {
|
||||
return { text: "", source: "LRCLIB", synced: false, lines: [], title: best.trackName, artist: best.artistName };
|
||||
}
|
||||
const parsed = Utils.parseSyncedLyrics(best.syncedLyrics);
|
||||
if (parsed) {
|
||||
return {
|
||||
text: parsed.map(l => l.text).join("\n"),
|
||||
source: "LRCLIB",
|
||||
synced: true,
|
||||
lines: parsed,
|
||||
title: best.trackName,
|
||||
artist: best.artistName,
|
||||
};
|
||||
}
|
||||
if (best.plainLyrics) {
|
||||
const text = String(best.plainLyrics).trim();
|
||||
return {
|
||||
text,
|
||||
source: "LRCLIB",
|
||||
synced: false,
|
||||
lines: text.split("\n").map(l => ({ text: l })),
|
||||
title: best.trackName,
|
||||
artist: best.artistName,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const node = lavalink?.getNode?.() ?? null;
|
||||
if (node) {
|
||||
try {
|
||||
const path = `/loadlyrics?identifier=${encodeURIComponent(rawQuery)}`;
|
||||
const results = await node.request(path);
|
||||
if (results?.data?.lines?.length) {
|
||||
return {
|
||||
text: results.data.lines.map(l => l.text).join("\n"),
|
||||
source: "Lavalink",
|
||||
synced: results.data.lines.some(l => l.startTimeMs != null),
|
||||
lines: results.data.lines,
|
||||
title: searchTitle,
|
||||
artist: searchArtist,
|
||||
};
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @async
|
||||
* Run handler for the lyrics command.
|
||||
* Fetches lyrics for the currently playing track and displays them with
|
||||
* paginated embeds and reaction-based navigation.
|
||||
* @param {object} message - The command message wrapper.
|
||||
* @param {object} [data] - Parsed options.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function run(message) {
|
||||
export async function run(message, data) {
|
||||
const query = data?.get?.("query")?.value?.trim() || null;
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
if (!p) return;
|
||||
|
||||
const current = p.queue.getCurrent();
|
||||
let searchTitle = null;
|
||||
let searchArtist = null;
|
||||
let current = null;
|
||||
|
||||
if (query) {
|
||||
searchTitle = query;
|
||||
const parts = query.split(/\s*[-–—]\s*/);
|
||||
if (parts.length >= 2) {
|
||||
searchArtist = parts[0].trim();
|
||||
searchTitle = parts.slice(1).join(" - ").trim();
|
||||
}
|
||||
} else {
|
||||
current = p?.queue?.getCurrent() ?? null;
|
||||
if (!current) {
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(this.t(message, "responses.lyrics.nothingPlaying"));
|
||||
return message.reply({ embeds: [embed] });
|
||||
}
|
||||
searchTitle = current.title;
|
||||
searchArtist = current.artists?.[0]?.name || current.author?.name || "Unknown Artist";
|
||||
}
|
||||
|
||||
let frame = 0;
|
||||
const loadingMsg = await message.reply({ embeds: [
|
||||
new EmbedBuilder().setColor(getGlobalColor())
|
||||
.setDescription(`${LOADING_FRAMES[0]} ` + this.t(message, "responses.lyrics.searching", { title: Utils.truncate(current.title, 40) }))
|
||||
|
||||
.setDescription(`${LOADING_FRAMES[0]} ` + this.t(message, "responses.lyrics.searching", { title: Utils.truncate(searchTitle, 40) }))
|
||||
] });
|
||||
|
||||
const loadingInterval = setInterval(() => {
|
||||
frame = (frame + 1) % LOADING_FRAMES.length;
|
||||
loadingMsg.edit({ embeds: [
|
||||
new EmbedBuilder().setColor(getGlobalColor())
|
||||
.setDescription(`${LOADING_FRAMES[frame]} ` + this.t(message, "responses.lyrics.searching", { title: Utils.truncate(current.title, 40) }))
|
||||
|
||||
.setDescription(`${LOADING_FRAMES[frame]} ` + this.t(message, "responses.lyrics.searching", { title: Utils.truncate(searchTitle, 40) }))
|
||||
] }).catch(() => {});
|
||||
}, 800);
|
||||
|
||||
try {
|
||||
const result = await p.lyrics();
|
||||
let result = null;
|
||||
if (p) {
|
||||
result = await p.lyrics(query);
|
||||
} else {
|
||||
result = await fetchDirectLyrics(this.lavalink, query, searchTitle, searchArtist);
|
||||
}
|
||||
|
||||
clearInterval(loadingInterval);
|
||||
|
||||
@@ -65,7 +178,7 @@ export async function run(message) {
|
||||
return loadingMsg.edit({ embeds: [
|
||||
new EmbedBuilder().setColor(getGlobalColor())
|
||||
.setDescription(
|
||||
this.t(message, "responses.lyrics.noLyrics", { title: Utils.truncate(current.title, 40) })
|
||||
this.t(message, "responses.lyrics.noLyrics", { title: Utils.truncate(searchTitle, 40) })
|
||||
)
|
||||
] });
|
||||
}
|
||||
@@ -73,8 +186,8 @@ export async function run(message) {
|
||||
try { await loadingMsg.message.delete(); } catch(e) { logger.warn("[Lyrics] Error:", e?.message); }
|
||||
|
||||
const syncIndicator = result.synced ? this.t(message, "responses.lyrics.syncedBadge") : "";
|
||||
const displayTitle = Utils.cleanTitle(current.title);
|
||||
const artist = current.artists?.[0]?.name || current.author?.name || "Unknown Artist";
|
||||
const displayTitle = result.title || (current ? Utils.cleanTitle(current.title) : Utils.cleanTitle(searchTitle));
|
||||
const artist = result.artist || (current?.artists?.[0]?.name || current?.author?.name) || searchArtist || "Unknown Artist";
|
||||
const lines = result.text.split("\n").filter(l => l.trim());
|
||||
const totalLines = lines.length;
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @module commands/normalize
|
||||
* @description Toggle dynamic volume normalization & ReplayGain leveling (EBU R128 standard).
|
||||
* Prevents ear-blasting volume differences between YouTube, Spotify, and SoundCloud.
|
||||
*/
|
||||
|
||||
import { CommandBuilder } from "../src/commands/index.mjs";
|
||||
import { EmbedBuilder } from "@fluxerjs/core";
|
||||
import { getGlobalColor } from "../src/ui/index.mjs";
|
||||
import { calculateNormalizationGain, detectTrackSource } from "../src/music/audio/VolumeNormalizer.mjs";
|
||||
|
||||
/**
|
||||
* @type {CommandBuilder}
|
||||
* @description Command definition for the normalize command.
|
||||
*/
|
||||
export const command = new CommandBuilder()
|
||||
.setName("normalize")
|
||||
.setDescription("Toggle dynamic volume normalization (ReplayGain leveling) across music sources.", "commands.normalize")
|
||||
.setCategory("music")
|
||||
.addChoiceOption(o =>
|
||||
o.setName("state")
|
||||
.setDescription("Turn on/off or check status ('on', 'off', 'status'). Omit to toggle.", "options.normalize.state")
|
||||
.addChoices("on", "off", "status")
|
||||
.setRequired(false)
|
||||
)
|
||||
.addAliases("replaygain", "volumenormalize", "norm");
|
||||
|
||||
/**
|
||||
* Run handler for the normalize command.
|
||||
*
|
||||
* @param {object} message - The command message wrapper.
|
||||
* @param {object} data - Parsed command data.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function run(message, data) {
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
const guildSettings = this.getSettings ? this.getSettings(message) : null;
|
||||
const currentSetting = guildSettings?.get ? (guildSettings.get("normalize") ?? true) : true;
|
||||
|
||||
const stateArg = data.get("state")?.value?.toLowerCase();
|
||||
let newState;
|
||||
|
||||
if (stateArg === "status") {
|
||||
newState = currentSetting;
|
||||
} else if (stateArg === "on" || stateArg === "enable" || stateArg === "true") {
|
||||
newState = true;
|
||||
} else if (stateArg === "off" || stateArg === "disable" || stateArg === "false") {
|
||||
newState = false;
|
||||
} else {
|
||||
// Toggle
|
||||
newState = !currentSetting;
|
||||
}
|
||||
|
||||
if (stateArg !== "status") {
|
||||
if (guildSettings?.set) {
|
||||
guildSettings.set("normalize", newState);
|
||||
}
|
||||
if (p) {
|
||||
p.volumeNormalization = newState;
|
||||
if (p._voiceConn) {
|
||||
try {
|
||||
p._voiceConn.setVolume(p.getEffectiveVolume());
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor());
|
||||
const statusMsg = newState
|
||||
? this.t(message, "responses.normalize.statusEnabled")
|
||||
: this.t(message, "responses.normalize.statusDisabled");
|
||||
const infoMsg = this.t(message, "responses.normalize.info");
|
||||
|
||||
let desc = `${statusMsg}\n\n*${infoMsg}*`;
|
||||
|
||||
if (p) {
|
||||
const current = p.queue?.getCurrent?.();
|
||||
if (current) {
|
||||
const source = detectTrackSource(current);
|
||||
const gain = calculateNormalizationGain(current);
|
||||
const gainDb = (20 * Math.log10(gain)).toFixed(1);
|
||||
const gainSign = gain >= 1 ? "+" : "";
|
||||
desc += "\n\n" + this.t(message, "responses.normalize.trackInfo", {
|
||||
source,
|
||||
gainDb: `${gainSign}${gainDb}`,
|
||||
gainPct: (gain * 100).toFixed(0),
|
||||
effective: Math.round(p.getEffectiveVolume()),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
message.reply({ embeds: [embed.setDescription(desc)] }).catch(() => {});
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @module commands/pitch
|
||||
* @description Adjust real-time audio pitch (0.5× to 2.0×) using timescale DSP filters.
|
||||
*/
|
||||
|
||||
import { CommandBuilder } from "../src/commands/index.mjs";
|
||||
import { EmbedBuilder } from "@fluxerjs/core";
|
||||
import { getGlobalColor } from "../src/ui/index.mjs";
|
||||
import { Utils } from "../src/utils/Utils.mjs";
|
||||
|
||||
/**
|
||||
* @type {CommandBuilder}
|
||||
* @description Command definition for the pitch command.
|
||||
*/
|
||||
export const command = new CommandBuilder()
|
||||
.setName("pitch")
|
||||
.setDescription("Adjust the audio pitch of the current track (0.5× to 2.0×).", "commands.pitch")
|
||||
.setCategory("music")
|
||||
.addNumberOption(o =>
|
||||
o.setName("pitch")
|
||||
.setDescription("Audio pitch multiplier between 0.5 and 2.0 (e.g. 1.25). Omit to reset to 1.0×.", "options.pitch.pitch")
|
||||
.setRequired(false)
|
||||
)
|
||||
.addAliases("semitone", "tune");
|
||||
|
||||
/**
|
||||
* Run handler for the pitch command.
|
||||
*
|
||||
* @param {object} message - The command message wrapper.
|
||||
* @param {object} data - Parsed command data.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function run(message, data) {
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
if (!p) return;
|
||||
|
||||
const rawPitch = data.get("pitch")?.value;
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor());
|
||||
|
||||
if (rawPitch === null || rawPitch === undefined || isNaN(Number(rawPitch))) {
|
||||
const currentTimescale = p.activeFilterPayload?.timescale;
|
||||
const currentPitch = currentTimescale?.pitch ?? 1.0;
|
||||
if (currentPitch !== 1.0) {
|
||||
const existingPayload = { ...(p.activeFilterPayload || {}) };
|
||||
delete existingPayload.timescale;
|
||||
await p.applyFilter(existingPayload, Object.keys(existingPayload).length > 0 ? p.activeFilter : null);
|
||||
embed.setDescription(this.t(message, "responses.pitch.reset"));
|
||||
} else {
|
||||
const prefix = this.handler?.getPrefix?.(message.message?.guildId ?? message.guild?.id) ?? "%";
|
||||
embed.setDescription(this.t(message, "responses.pitch.current", { pitch: "1.0", prefix }));
|
||||
}
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
const pitch = Utils.clamp(Number(rawPitch), 0.5, 2.0);
|
||||
|
||||
const existingTimescale = p.activeFilterPayload?.timescale || {};
|
||||
const newTimescale = {
|
||||
...existingTimescale,
|
||||
speed: existingTimescale.speed ?? 1.0,
|
||||
pitch,
|
||||
rate: 1.0,
|
||||
};
|
||||
|
||||
const payload = {
|
||||
...(p.activeFilterPayload || {}),
|
||||
timescale: newTimescale,
|
||||
};
|
||||
|
||||
const filterMeta = {
|
||||
key: `pitch_${pitch}`,
|
||||
label: `${pitch}× Pitch`,
|
||||
emoji: pitch > 1 ? "🐿️" : "🗣️",
|
||||
};
|
||||
|
||||
const res = await p.applyFilter(payload, filterMeta);
|
||||
if (!res.ok) {
|
||||
embed.setDescription(this.t(message, "responses.pitch.failed", { reason: res.reason || "Unknown error" }));
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
embed.setDescription(this.t(message, "responses.pitch.set", { pitch }));
|
||||
message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
+21
-9
@@ -8,26 +8,38 @@ import { CommandBuilder } from "../src/commands/index.mjs";
|
||||
/** @type {CommandBuilder} @description Command definition for the remove command. */
|
||||
export const command = new CommandBuilder()
|
||||
.setName("remove")
|
||||
.setDescription("Remove a specific song from the queue.", "commands.remove")
|
||||
.setDescription("Remove a specific song or range of songs (e.g. `3` or `3-6`) 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")
|
||||
.addTextOption(opt =>
|
||||
opt.setName("position")
|
||||
.setDescription("The position or range of the song(s) to remove (e.g. `3` or `3-6`).", "options.remove.index")
|
||||
.setRequired(true));
|
||||
|
||||
/**
|
||||
* @async
|
||||
* Run handler for the remove command.
|
||||
* Removes a track at the specified 1-based index from the queue.
|
||||
* Removes a track or range of tracks at the specified 1-based indices from the queue.
|
||||
* @param {object} message - The command message wrapper.
|
||||
* @param {object} data - Parsed command data containing the index option.
|
||||
* @param {object} data - Parsed command data containing the position option.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function run(message, data) {
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
if (!p) return;
|
||||
const index = data.get("index")?.value;
|
||||
if (index === null || index === undefined || index < 1) return message.replyEmbed("Queue position must be 1 or greater.").catch(() => {});
|
||||
const res = p.remove(index - 1);
|
||||
const raw = String(data.get("position")?.value ?? "").trim();
|
||||
if (!raw) return message.replyEmbed("Please provide a queue position or range (e.g. `3` or `3-6`).").catch(() => {});
|
||||
|
||||
const rangeMatch = raw.match(/^(\d+)\s*[-–—to:]+\s*(\d+)$/i) || raw.match(/^(\d+)\s+(\d+)$/);
|
||||
if (rangeMatch) {
|
||||
const from = parseInt(rangeMatch[1], 10);
|
||||
const to = parseInt(rangeMatch[2], 10);
|
||||
if (from < 1 || to < 1) return message.replyEmbed("Queue positions must be 1 or greater.").catch(() => {});
|
||||
const res = p.removeRange(from - 1, to - 1);
|
||||
return message.replyEmbed(res).catch(() => {});
|
||||
}
|
||||
|
||||
const single = parseInt(raw, 10);
|
||||
if (isNaN(single) || single < 1) return message.replyEmbed("Queue position must be 1 or greater.").catch(() => {});
|
||||
const res = p.remove(single - 1);
|
||||
message.replyEmbed(res).catch(() => {});
|
||||
}
|
||||
@@ -143,6 +143,7 @@ export async function run(msg, data) {
|
||||
await clearReactions();
|
||||
|
||||
if (e.emoji_id === CANCEL_EMOJI) {
|
||||
p.searches.delete(msg.authorId);
|
||||
rawMsg.edit({
|
||||
embeds: [makeEmbed(this.t(msg, "responses.search.cancelled"), null, this.t(msg, "responses.search.resultsTitle", { provider: name }))]
|
||||
}).catch(() => {});
|
||||
@@ -167,6 +168,7 @@ export async function run(msg, data) {
|
||||
const SESSION_MS = this.config?.timers?.searchSessionTimeout ?? 30_000;
|
||||
const timer = setTimeout(() => {
|
||||
unobserve();
|
||||
p.searches.delete(msg.authorId);
|
||||
clearReactions().catch(() => {});
|
||||
rawMsg.edit({
|
||||
embeds: [makeEmbed(this.t(msg, "responses.search.timedOut"), this.t(msg, "responses.search.sessionClosed"), this.t(msg, "responses.search.resultsTitle", { provider: name }))]
|
||||
|
||||
+4
-2
@@ -48,8 +48,10 @@ export async function run(msg, data) {
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.live"))] });
|
||||
}
|
||||
|
||||
let seekMs = Utils.parseDuration(positionInput);
|
||||
if (!seekMs || seekMs < 0) {
|
||||
const trimmed = String(positionInput ?? "").trim();
|
||||
const isZero = /^0+(:0+)?(:0+)?$/.test(trimmed);
|
||||
const seekMs = isZero ? 0 : Utils.parseDuration(trimmed);
|
||||
if (seekMs === null || isNaN(seekMs) || seekMs < 0 || (!isZero && seekMs === 0)) {
|
||||
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.invalidFormat"))] });
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* @module commands/speed
|
||||
* @description Adjust real-time playback speed (0.5× to 2.0×) using timescale DSP filters.
|
||||
*/
|
||||
|
||||
import { CommandBuilder } from "../src/commands/index.mjs";
|
||||
import { EmbedBuilder } from "@fluxerjs/core";
|
||||
import { getGlobalColor } from "../src/ui/index.mjs";
|
||||
import { Utils } from "../src/utils/Utils.mjs";
|
||||
|
||||
/**
|
||||
* @type {CommandBuilder}
|
||||
* @description Command definition for the speed command.
|
||||
*/
|
||||
export const command = new CommandBuilder()
|
||||
.setName("speed")
|
||||
.setDescription("Adjust the playback speed of the current track (0.5× to 2.0×).", "commands.speed")
|
||||
.setCategory("music")
|
||||
.addNumberOption(o =>
|
||||
o.setName("rate")
|
||||
.setDescription("Playback speed multiplier between 0.5 and 2.0 (e.g. 1.25). Omit to reset to 1.0×.", "options.speed.rate")
|
||||
.setRequired(false)
|
||||
)
|
||||
.addAliases("rate", "tempo");
|
||||
|
||||
/**
|
||||
* Run handler for the speed command.
|
||||
*
|
||||
* @param {object} message - The command message wrapper.
|
||||
* @param {object} data - Parsed command data.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function run(message, data) {
|
||||
const p = await this.getPlayer(message, false, false, false);
|
||||
if (!p) return;
|
||||
|
||||
const rawRate = data.get("rate")?.value;
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor());
|
||||
|
||||
if (rawRate === null || rawRate === undefined || isNaN(Number(rawRate))) {
|
||||
// Reset to 1.0 or show current speed
|
||||
const currentTimescale = p.activeFilterPayload?.timescale;
|
||||
const currentSpeed = currentTimescale?.speed ?? 1.0;
|
||||
if (currentSpeed !== 1.0) {
|
||||
// Reset
|
||||
const existingPayload = { ...(p.activeFilterPayload || {}) };
|
||||
delete existingPayload.timescale;
|
||||
await p.applyFilter(existingPayload, Object.keys(existingPayload).length > 0 ? p.activeFilter : null);
|
||||
embed.setDescription(this.t(message, "responses.speed.reset"));
|
||||
} else {
|
||||
const prefix = this.handler?.getPrefix?.(message.message?.guildId ?? message.guild?.id) ?? "%";
|
||||
embed.setDescription(this.t(message, "responses.speed.current", { speed: "1.0", prefix }));
|
||||
}
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
const speed = Utils.clamp(Number(rawRate), 0.5, 2.0);
|
||||
|
||||
// Preserve other active filters if present, update only timescale speed
|
||||
const existingTimescale = p.activeFilterPayload?.timescale || {};
|
||||
const newTimescale = {
|
||||
...existingTimescale,
|
||||
speed,
|
||||
pitch: existingTimescale.pitch ?? 1.0,
|
||||
rate: 1.0,
|
||||
};
|
||||
|
||||
const payload = {
|
||||
...(p.activeFilterPayload || {}),
|
||||
timescale: newTimescale,
|
||||
};
|
||||
|
||||
const filterMeta = {
|
||||
key: `speed_${speed}`,
|
||||
label: `${speed}× Speed`,
|
||||
emoji: speed > 1 ? "⏩" : "🐢",
|
||||
};
|
||||
|
||||
const res = await p.applyFilter(payload, filterMeta);
|
||||
if (!res.ok) {
|
||||
embed.setDescription(this.t(message, "responses.speed.failed", { reason: res.reason || "Unknown error" }));
|
||||
return message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
|
||||
embed.setDescription(this.t(message, "responses.speed.set", { emoji: speed > 1 ? "⏩" : "🐢", speed }));
|
||||
message.reply({ embeds: [embed] }).catch(() => {});
|
||||
}
|
||||
+172
-33
@@ -10,6 +10,7 @@ import { Utils } from "../src/utils/Utils.mjs";
|
||||
import { EmbedBuilder } from "@fluxerjs/core";
|
||||
import { getGlobalColor } from "../src/ui/index.mjs";
|
||||
import { logger } from "../src/core/Logger.mjs";
|
||||
import * as ShardingUtils from "../src/utils/ShardingUtils.mjs";
|
||||
|
||||
/**
|
||||
* @type {CommandBuilder}
|
||||
@@ -226,18 +227,18 @@ async function withRateLimitRetry(fn, label = "send") {
|
||||
}
|
||||
|
||||
/**
|
||||
* Count players with active voice connections.
|
||||
* Gather real-time music playback and player statistics.
|
||||
* Deduplicates active players by instance and computes connected, playing,
|
||||
* total queued tracks, and 24/7 radio sessions.
|
||||
* @private
|
||||
* @param {Map} playerMap - The player map from PlayerManager.
|
||||
* @returns {number} Number of live connected players.
|
||||
* @returns {{totalPlayers: number, playingCount: number, queuedTracks: number, radios247: number}}
|
||||
*/
|
||||
function getLivePlayerCount(playerMap) {
|
||||
let live = 0;
|
||||
|
||||
for (const [mapKey, player] of playerMap ?? []) {
|
||||
if (!player || player._destroyed || player.leaving) continue;
|
||||
if (player._isJoining) continue;
|
||||
|
||||
function getMusicStats(playerMap) {
|
||||
const uniquePlayers = new Set();
|
||||
if (playerMap) {
|
||||
for (const player of playerMap.values()) {
|
||||
if (!player || player._destroyed || player.leaving || player._isJoining) continue;
|
||||
const conn = player.connection;
|
||||
if (conn) {
|
||||
const room = conn.room;
|
||||
@@ -249,38 +250,87 @@ function getLivePlayerCount(playerMap) {
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
live++;
|
||||
uniquePlayers.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return live;
|
||||
let totalPlayers = uniquePlayers.size;
|
||||
let playingCount = 0;
|
||||
let queuedTracks = 0;
|
||||
let radios247 = 0;
|
||||
|
||||
for (const player of uniquePlayers) {
|
||||
const cur = player.queue?.getCurrent?.();
|
||||
const isPlaying = !!cur && !player.paused;
|
||||
if (isPlaying) playingCount++;
|
||||
|
||||
const qSize = (player.queue?.size?.() ?? 0) + (cur ? 1 : 0);
|
||||
queuedTracks += qSize;
|
||||
|
||||
if (player._is247Enabled?.()) {
|
||||
radios247++;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
totalPlayers,
|
||||
playingCount,
|
||||
queuedTracks,
|
||||
radios247,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate with a hardcoded fallback. Locale lookups that miss (custom or
|
||||
* outdated locale files make translate() return the raw dot-notation key)
|
||||
* Resolve the current shard assignment string (e.g. "0/2" when sharded, or "0" in single-process mode).
|
||||
* @private
|
||||
* @param {object} client - The bot client instance.
|
||||
* @param {string|null} guildId - The guild ID where the command was invoked.
|
||||
* @returns {string} Formatted shard info.
|
||||
*/
|
||||
function getShardInfo(client, guildId) {
|
||||
try {
|
||||
const isSharded = ShardingUtils.isShardedProcess();
|
||||
const currentShard = ShardingUtils.shardIdForGuild(client, guildId);
|
||||
const totalShards = isSharded ? (Number(process.env.FLUXER_SHARD_COUNT) || 1) : 1;
|
||||
return `${currentShard}/${totalShards}`;
|
||||
} catch (_) {
|
||||
return "0/1";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate with a hardcoded fallback and optional placeholders. Locale lookups
|
||||
* that miss (custom or outdated locale files make translate() return the raw dot-notation key)
|
||||
* render the readable fallback instead of an ugly key path in the embed.
|
||||
* @private
|
||||
* @param {Function} t - Translation function.
|
||||
* @param {object} msg - The command message wrapper.
|
||||
* @param {string} key - Locale key.
|
||||
* @param {string} fallback - Label used when the key is missing.
|
||||
* @param {object} [vars={}] - Optional interpolation variables.
|
||||
* @returns {string}
|
||||
*/
|
||||
function tOr(t, msg, key, fallback) {
|
||||
const value = t(msg, key);
|
||||
function tOr(t, msg, key, fallback, vars = {}) {
|
||||
const value = t(msg, key, vars);
|
||||
return value === key ? fallback : value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the stats embed with all bot information.
|
||||
* Uses a clean multi-column grid layout (addFields) with category sections
|
||||
* and a top-right bot avatar thumbnail.
|
||||
* @private
|
||||
* @param {Function} t - Translation function.
|
||||
* @param {object} msg - The command message wrapper.
|
||||
* @param {object} s - Statistics data object.
|
||||
* @param {number} s.guildCount - Number of guilds.
|
||||
* @param {number} s.userCount - Number of users.
|
||||
* @param {number} s.playerCount - Number of active players.
|
||||
* @param {number} s.playerCount - Number of active connected players.
|
||||
* @param {number} s.playingCount - Number of players actively streaming.
|
||||
* @param {number} s.queuedTracks - Total tracks across all player queues.
|
||||
* @param {number} s.radios247 - Number of active 24/7 radio sessions.
|
||||
* @param {string} s.shard - Shard assignment string.
|
||||
* @param {string|null} [s.botIcon] - Bot avatar URL.
|
||||
* @param {number} s.scrobbleCount - Total Last.fm scrobbles.
|
||||
* @param {number} s.linkedUsers - Number of Last.fm linked users.
|
||||
* @param {number} s.ping - Bot response ping in ms (REST reply round trip).
|
||||
@@ -298,38 +348,110 @@ function buildEmbed(t, msg, s, pending = []) {
|
||||
const num = (v) => Utils.formatNumber(v);
|
||||
const field = (key, value) => `\`${pending.includes(key) ? "..." : value}\``;
|
||||
|
||||
const description = [
|
||||
const playerVal = s.playingCount > 0
|
||||
? tOr(t, msg, "responses.stats.playersWithPlaying", `${num(s.playerCount)} (${num(s.playingCount)} playing)`, {
|
||||
total: num(s.playerCount),
|
||||
playing: num(s.playingCount),
|
||||
})
|
||||
: num(s.playerCount);
|
||||
|
||||
const fields = [];
|
||||
|
||||
const overviewParts = [
|
||||
`${t(msg, "responses.stats.servers")} — ${field("guilds", num(s.guildCount))}`,
|
||||
`${t(msg, "responses.stats.users")} — ${field("users", num(s.userCount))}`,
|
||||
`${t(msg, "responses.stats.players")} — ${field("players", num(s.playerCount))}`,
|
||||
`${tOr(t, msg, "responses.stats.shard", "🧩 **Shard**")} — \`${s.shard}\``,
|
||||
];
|
||||
fields.push({
|
||||
name: tOr(t, msg, "responses.stats.categoryOverview", "📊 Overview"),
|
||||
value: overviewParts.join(" • "),
|
||||
inline: false,
|
||||
});
|
||||
|
||||
const musicLines = [
|
||||
`${t(msg, "responses.stats.players")} — ${field("players", playerVal)}`,
|
||||
];
|
||||
const musicExtra = [];
|
||||
if (s.queuedTracks > 0) {
|
||||
musicExtra.push(`${tOr(t, msg, "responses.stats.queuedTracks", "🎶 **Queued Tracks**")} — ${field("queuedTracks", num(s.queuedTracks))}`);
|
||||
}
|
||||
if (s.radios247 > 0) {
|
||||
musicExtra.push(`${tOr(t, msg, "responses.stats.radios", "📻 **24/7 Radios**")} — ${field("radios", num(s.radios247))}`);
|
||||
}
|
||||
if (musicExtra.length > 0) {
|
||||
musicLines.push(musicExtra.join(" • "));
|
||||
}
|
||||
fields.push({
|
||||
name: tOr(t, msg, "responses.stats.categoryMusic", "🎧 Music Activity"),
|
||||
value: musicLines.join("\n"),
|
||||
inline: false,
|
||||
});
|
||||
|
||||
if (s.lastfmEnabled) {
|
||||
description.push(
|
||||
const lastfmParts = [
|
||||
`${t(msg, "responses.stats.scrobbles")} — ${field("scrobbles", num(s.scrobbleCount))}`,
|
||||
`${t(msg, "responses.stats.linkedUsers")} — ${field("linkedUsers", num(s.linkedUsers))}`,
|
||||
);
|
||||
];
|
||||
fields.push({
|
||||
name: tOr(t, msg, "responses.stats.categoryLastfm", "🎵 Last.fm"),
|
||||
value: lastfmParts.join(" • "),
|
||||
inline: false,
|
||||
});
|
||||
}
|
||||
|
||||
description.push(
|
||||
const latencyParts = [
|
||||
`${t(msg, "responses.stats.ping")} — ${field("ping", `${num(s.ping)}ms`)}`,
|
||||
s.gatewayPing >= 0 ? `${tOr(t, msg, "responses.stats.gateway", GATEWAY_FALLBACK_LABEL)} — \`${num(s.gatewayPing)}ms\`` : null,
|
||||
];
|
||||
if (s.gatewayPing >= 0) {
|
||||
latencyParts.push(`${tOr(t, msg, "responses.stats.gateway", GATEWAY_FALLBACK_LABEL)} — \`${num(s.gatewayPing)}ms\``);
|
||||
}
|
||||
const perfLines = [
|
||||
latencyParts.join(" • "),
|
||||
`${t(msg, "responses.stats.uptime")} — \`${s.uptime}\``,
|
||||
`${t(msg, "responses.stats.build")} — [\`${s.comHash}\`](${s.comLink})`,
|
||||
s.reason ? `${t(msg, "responses.stats.lastRestart")} — \`${s.reason}\`` : null,
|
||||
``,
|
||||
t(msg, "responses.stats.supportKofi"),
|
||||
t(msg, "responses.stats.community"),
|
||||
);
|
||||
];
|
||||
fields.push({
|
||||
name: tOr(t, msg, "responses.stats.categoryPerformance", "⚡ System & Network"),
|
||||
value: perfLines.join("\n"),
|
||||
inline: false,
|
||||
});
|
||||
|
||||
const desc = description.filter(l => l !== null).join("\n");
|
||||
const bottomLines = [
|
||||
`${t(msg, "responses.stats.build")} — [\`${s.comHash}\`](${s.comLink})` +
|
||||
(s.reason ? ` • ${t(msg, "responses.stats.lastRestart")} — \`${s.reason}\`` : ""),
|
||||
`${t(msg, "responses.stats.supportKofi")} • ${t(msg, "responses.stats.community")}`,
|
||||
];
|
||||
fields.push({
|
||||
name: "\u200B",
|
||||
value: bottomLines.join("\n"),
|
||||
inline: false,
|
||||
});
|
||||
|
||||
const authorOptions = { name: t(msg, "responses.stats.title") };
|
||||
if (typeof s.botIcon === "string" && s.botIcon.startsWith("http")) {
|
||||
authorOptions.iconURL = s.botIcon;
|
||||
}
|
||||
|
||||
const builder = new EmbedBuilder()
|
||||
.setColor(getGlobalColor())
|
||||
.setAuthor({ name: t(msg, "responses.stats.title") })
|
||||
.setDescription(desc)
|
||||
.setAuthor(authorOptions)
|
||||
.setFooter({ text: s.footer || t(msg, "responses.stats.title") });
|
||||
|
||||
if (fields.length > 0) {
|
||||
try {
|
||||
builder.addFields(...fields);
|
||||
} catch (_) {
|
||||
if (typeof builder.setFields === "function") {
|
||||
try { builder.setFields(fields); } catch (__) { builder.data.fields = fields; }
|
||||
} else {
|
||||
builder.data.fields = fields;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof s.botIcon === "string" && s.botIcon.startsWith("http")) {
|
||||
try { builder.setThumbnail(s.botIcon); } catch (_) {}
|
||||
}
|
||||
|
||||
if (typeof builder.setTimestamp === "function") builder.setTimestamp();
|
||||
return builder;
|
||||
}
|
||||
@@ -349,6 +471,13 @@ export async function run(message) {
|
||||
const t = (...a) => this.t(...a);
|
||||
|
||||
const totals = getTotals(this.client);
|
||||
const music = getMusicStats(this.players?.playerMap);
|
||||
const shard = getShardInfo(this.client, message.guildId ?? message.guild?.id);
|
||||
let botIcon = null;
|
||||
try {
|
||||
const raw = this.client?.user?.displayAvatarURL?.() || this.client?.user?.avatarURL?.();
|
||||
if (typeof raw === "string" && raw.startsWith("http")) botIcon = raw;
|
||||
} catch (_) {}
|
||||
|
||||
scheduleBackgroundRefresh(this.client, lastfmEnabled ? lastfm : null);
|
||||
|
||||
@@ -363,7 +492,12 @@ export async function run(message) {
|
||||
const embedData = {
|
||||
guildCount: totals.guildCount,
|
||||
userCount: totals.userCount,
|
||||
playerCount: getLivePlayerCount(this.players.playerMap),
|
||||
playerCount: music.totalPlayers,
|
||||
playingCount: music.playingCount,
|
||||
queuedTracks: music.queuedTracks,
|
||||
radios247: music.radios247,
|
||||
shard,
|
||||
botIcon,
|
||||
scrobbleCount: lastfmEnabled ? (cache.scrobbles ?? 0) : 0,
|
||||
linkedUsers: lastfmEnabled ? (cache.linkedUsers ?? 0) : 0,
|
||||
lastfmEnabled,
|
||||
@@ -406,10 +540,15 @@ export async function run(message) {
|
||||
}
|
||||
|
||||
const fresh = getTotals(this.client);
|
||||
const freshMusic = getMusicStats(this.players?.playerMap);
|
||||
const fill = {
|
||||
...embedData,
|
||||
guildCount: fresh.guildCount,
|
||||
userCount: fresh.userCount,
|
||||
playerCount: freshMusic.totalPlayers,
|
||||
playingCount: freshMusic.playingCount,
|
||||
queuedTracks: freshMusic.queuedTracks,
|
||||
radios247: freshMusic.radios247,
|
||||
scrobbleCount: lastfmEnabled ? (cache.scrobbles ?? 0) : 0,
|
||||
linkedUsers: lastfmEnabled ? (cache.linkedUsers ?? 0) : 0,
|
||||
ping: lastPing ?? 0,
|
||||
|
||||
+3
-1
@@ -97,7 +97,9 @@
|
||||
"port": 3306,
|
||||
"user": "youruser",
|
||||
"password": "password of your user",
|
||||
"database": "name of the target database"
|
||||
"database": "name of the target database",
|
||||
"connectionLimit": 15,
|
||||
"connectionLimit-Comment": "Maximum simultaneous MySQL connections shared across all bot services (default: 15). Prevents connection pool exhaustion in multi-shard deployments."
|
||||
},
|
||||
"dashboard": {
|
||||
"enabled": false,
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ USER 10001:10001
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD pgrep -f "node .*index.mjs" >/dev/null 2>&1 || pgrep -f "node .*shard.mjs" >/dev/null 2>&1 || exit 1
|
||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=45s --retries=3 \
|
||||
CMD node -e "const fs = require('fs'); try { const diff = Date.now() - fs.statSync('/tmp/.remix-health').mtimeMs; process.exit(diff < 30000 ? 0 : 1); } catch { process.exit(1); }"
|
||||
|
||||
ENTRYPOINT ["/usr/bin/tini", "--", "/app/docker/docker-entrypoint.sh"]
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"port": 3306,
|
||||
"user": "remix",
|
||||
"password": "remix_pw",
|
||||
"database": "remix"
|
||||
"database": "remix",
|
||||
"connectionLimit": 15
|
||||
},
|
||||
"nodelink": {
|
||||
"host": "nodelink",
|
||||
|
||||
@@ -20,6 +20,12 @@ services:
|
||||
- TZ=${TZ:-UTC}
|
||||
ports:
|
||||
- "${WEB_PORT:-8080}:80"
|
||||
healthcheck:
|
||||
test: ["CMD", "node", "-e", "const fs = require('fs'); try { const diff = Date.now() - fs.statSync('/tmp/.remix-health').mtimeMs; process.exit(diff < 30000 ? 0 : 1); } catch { process.exit(1); }"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 45s
|
||||
networks:
|
||||
- remix-net
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
"defaultSource": "ytmusic",
|
||||
"fallback": true
|
||||
},
|
||||
"spotify": {
|
||||
"playlistLoadLimit": 10
|
||||
},
|
||||
"soundcloud": {
|
||||
"playlistLoadLimit": 10
|
||||
},
|
||||
"audio": {
|
||||
"normalization": true
|
||||
},
|
||||
|
||||
@@ -140,60 +140,18 @@ process.on("uncaughtExceptionMonitor", (err, origin) => {
|
||||
});
|
||||
|
||||
/**
|
||||
* Graceful shutdown handler: destroys all active players, closes Lavalink,
|
||||
* Redis, and Dashboard DB connections, then exits.
|
||||
* Graceful shutdown handler: flushes player queue snapshots to MySQL,
|
||||
* cleans up active players, services, and connections, then exits.
|
||||
* @async
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
const saveAndExit = async () => {
|
||||
logger.recovery("\n[Shutdown] Cleaning up before exit...");
|
||||
try {
|
||||
await remix.playerState?.saveAllFrom?.(remix.players);
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] Player state save failed:", e?.message);
|
||||
}
|
||||
try {
|
||||
if (remix.players?.playerMap) {
|
||||
for (const [channelId, player] of remix.players.playerMap) {
|
||||
try { player.destroy(); } catch (e) { logger.warn("[Shutdown] Player destroy error:", e?.message); }
|
||||
}
|
||||
remix.players.playerMap.clear();
|
||||
if (remix?.gracefulShutdown) {
|
||||
await remix.gracefulShutdown();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] Player cleanup error:", e?.message);
|
||||
}
|
||||
try {
|
||||
if (remix.lavalink) {
|
||||
remix.lavalink.destroy();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] Lavalink cleanup error:", e?.message);
|
||||
}
|
||||
try {
|
||||
if (remix.dashboard?.redis?.destroy) {
|
||||
await remix.dashboard.redis.destroy();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error("[Shutdown] Failed to close Redis:", e.message);
|
||||
}
|
||||
try {
|
||||
if (remix.dashboard?.db?.close) {
|
||||
await remix.dashboard.db.close();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error("[Shutdown] Failed to close Dashboard DB:", e.message);
|
||||
}
|
||||
try {
|
||||
remix.gatewayHandler?.stop247Watchdog?.();
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] Watchdog stop error:", e?.message);
|
||||
}
|
||||
try {
|
||||
if (remix.settingsMgr?.shutdown) {
|
||||
await remix.settingsMgr.shutdown();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error("[Shutdown] Settings flush failed:", e.message);
|
||||
logger.error("[Shutdown] Error during graceful shutdown:", e?.message ?? e);
|
||||
}
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
*/
|
||||
|
||||
import * as fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { ShardingManager } from "@fluxerjs/sharding";
|
||||
import { logger } from "./src/core/Logger.mjs";
|
||||
@@ -126,18 +128,58 @@ manager.on("error", (err) => {
|
||||
logger.error("[Sharding] Manager error:", err?.message ?? err);
|
||||
});
|
||||
|
||||
/** Graceful shutdown: destroy all children, then exit.
|
||||
// Event loop health heartbeat for Docker container healthcheck (Issue #12)
|
||||
const healthFile = path.join(os.tmpdir(), ".remix-health");
|
||||
const updateHealth = () => {
|
||||
try {
|
||||
fs.writeFile(healthFile, Date.now().toString(), () => {});
|
||||
} catch (_) {}
|
||||
};
|
||||
updateHealth();
|
||||
const healthInterval = setInterval(updateHealth, 10_000);
|
||||
healthInterval.unref?.();
|
||||
|
||||
/** Graceful shutdown: signal shard children to flush queue snapshots, await exit, then destroy.
|
||||
* @param {string} sig - The received signal name. */
|
||||
let shuttingDown = false;
|
||||
const shutdown = async (sig) => {
|
||||
if (shuttingDown) return;
|
||||
shuttingDown = true;
|
||||
logger.recovery(`\n[Sharding] ${sig} received — destroying shard processes...`);
|
||||
manager.respawn = false;
|
||||
logger.recovery(`\n[Sharding] ${sig} received — waiting for shard processes to flush queue snapshots and exit...`);
|
||||
|
||||
// Send SIGTERM to all child processes so their saveAndExit / Bot.gracefulShutdown runs
|
||||
const exitPromises = [];
|
||||
if (manager.shards) {
|
||||
for (const shard of manager.shards.values()) {
|
||||
const cp = shard.process;
|
||||
if (cp && !cp.killed) {
|
||||
exitPromises.push(new Promise((resolve) => {
|
||||
cp.once("exit", resolve);
|
||||
setTimeout(resolve, 8000);
|
||||
}));
|
||||
try {
|
||||
cp.kill("SIGTERM");
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exitPromises.length > 0) {
|
||||
await Promise.all(exitPromises);
|
||||
}
|
||||
|
||||
try {
|
||||
await manager.destroy();
|
||||
} catch (e) {
|
||||
logger.warn("[Sharding] destroy error:", e?.message);
|
||||
}
|
||||
|
||||
try {
|
||||
clearInterval(healthInterval);
|
||||
fs.unlink(healthFile, () => {});
|
||||
} catch (_) {}
|
||||
|
||||
process.exit(0);
|
||||
};
|
||||
process.once("SIGINT", () => shutdown("SIGINT"));
|
||||
|
||||
+129
-5
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import * as fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import childProcess from "node:child_process";
|
||||
import { Client, Events } from "@fluxerjs/core";
|
||||
@@ -20,6 +21,7 @@ import { resolveIsBotUser } from "../voice/VoiceStateResolver.mjs";
|
||||
import * as ShardingUtils from "../utils/ShardingUtils.mjs";
|
||||
import { RemoteSettingsManager } from "../db/Settings.mjs";
|
||||
import { PlayerStateStore } from "../db/PlayerStateStore.mjs";
|
||||
import { getSharedMysqlPool, getSharedPromisePool, closeSharedMysqlPool } from "../db/PoolManager.mjs";
|
||||
import { PlayerManager } from "../music/PlayerManager.mjs";
|
||||
import { LavalinkManager } from "../music/LavalinkManager.mjs";
|
||||
import { Dashboard } from "../dashboard/Dashboard.mjs";
|
||||
@@ -134,10 +136,14 @@ class Remix {
|
||||
this.locale = new Locale(typeof config.prefix === "string" && config.prefix ? config.prefix : "%");
|
||||
this.locale.load();
|
||||
|
||||
// Centralized MySQL connection pool (Issue #21)
|
||||
const sharedPool = getSharedMysqlPool(config.mysql);
|
||||
const sharedPromisePool = getSharedPromisePool(config.mysql);
|
||||
|
||||
this.dashboard = new Dashboard(this, {
|
||||
enabled: config.dashboard?.enabled,
|
||||
redis: config.dashboard?.redis,
|
||||
mysql: config.mysql,
|
||||
mysql: sharedPromisePool,
|
||||
});
|
||||
|
||||
const presenceContents = config.presenceContents ?? [];
|
||||
@@ -192,10 +198,10 @@ class Remix {
|
||||
const messages = new MessageHandler(this.client);
|
||||
this.messages = messages;
|
||||
|
||||
const settings = new RemoteSettingsManager(config.mysql, "./storage/defaults.json");
|
||||
const settings = new RemoteSettingsManager(sharedPool, "./storage/defaults.json");
|
||||
this.settingsMgr = settings;
|
||||
|
||||
this.playerState = new PlayerStateStore(settings.db);
|
||||
this.playerState = new PlayerStateStore(sharedPool);
|
||||
|
||||
const configPrefix = config.prefix ?? null;
|
||||
if (configPrefix && settings.defaults) {
|
||||
@@ -255,9 +261,28 @@ class Remix {
|
||||
this.gatewayHandler = new GatewayHandler(this);
|
||||
this.gatewayHandler.setupEventHandlers();
|
||||
|
||||
this.lastfm = new LastFmManager(config.lastfm, config.mysql);
|
||||
this.lastfm = new LastFmManager(config.lastfm, sharedPromisePool);
|
||||
this.fluxerlist = new FluxerListManager(config.fluxerlist);
|
||||
this.trackOptions = new TrackOptionsManager(config.mysql);
|
||||
this.trackOptions = new TrackOptionsManager(sharedPool);
|
||||
|
||||
// Event loop health heartbeat for Docker container healthcheck (Issue #12)
|
||||
const healthFile = path.join(os.tmpdir(), ".remix-health");
|
||||
const updateHealth = () => {
|
||||
try {
|
||||
fs.writeFile(healthFile, Date.now().toString(), () => {});
|
||||
} catch (_) {}
|
||||
};
|
||||
updateHealth();
|
||||
this._healthInterval = setInterval(updateHealth, 10_000);
|
||||
this._healthInterval.unref?.();
|
||||
|
||||
// Direct process signal fallback handlers
|
||||
process.once("SIGINT", () => {
|
||||
this.gracefulShutdown().then(() => process.exit(0)).catch(() => process.exit(1));
|
||||
});
|
||||
process.once("SIGTERM", () => {
|
||||
this.gracefulShutdown().then(() => process.exit(0)).catch(() => process.exit(1));
|
||||
});
|
||||
|
||||
settings.on("ready", () => this._onSettingsReady());
|
||||
|
||||
@@ -288,12 +313,21 @@ class Remix {
|
||||
this.lavalink = new LavalinkManager(config.nodelink ?? {}, client, { id: botId, username: client.user?.username ?? "bot" });
|
||||
this.lavalink.on("ready", () => {
|
||||
logger.lavalink("[Lavalink] Session ready");
|
||||
if (this._hasBooted) {
|
||||
this.players?.resumeAllOnNodeReconnect?.();
|
||||
}
|
||||
});
|
||||
this.lavalink.on("nodeReconnect", () => {
|
||||
if (this._hasBooted) {
|
||||
this.players?.resumeAllOnNodeReconnect?.();
|
||||
}
|
||||
});
|
||||
await this.lavalink.init();
|
||||
this.playerContext.lavalink = this.lavalink;
|
||||
}
|
||||
|
||||
this.gatewayHandler.onReady();
|
||||
this._hasBooted = true;
|
||||
|
||||
this.fluxerlist?.startAutoStats?.(client);
|
||||
|
||||
@@ -610,6 +644,96 @@ class Remix {
|
||||
logger.warn("[WS] Failed to attach WS error handlers:", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Graceful shutdown: flush player queue snapshots to MySQL (Issue #12),
|
||||
* destroy players, close Lavalink, Redis, dashboard DB, settings, and pool.
|
||||
* @async
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async gracefulShutdown() {
|
||||
if (this._shuttingDown) return;
|
||||
this._shuttingDown = true;
|
||||
logger.recovery("\n[Shutdown] Cleaning up before exit...");
|
||||
|
||||
// 1. Flush active player queue snapshots to MySQL (Issue #12)
|
||||
try {
|
||||
if (this.playerState && this.players) {
|
||||
await this.playerState.saveAllFrom(this.players);
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] Player state save failed:", e?.message);
|
||||
}
|
||||
|
||||
// 2. Destroy live players
|
||||
try {
|
||||
if (this.players?.playerMap) {
|
||||
for (const [channelId, player] of this.players.playerMap) {
|
||||
try { player.destroy(); } catch (e) { logger.warn("[Shutdown] Player destroy error:", e?.message); }
|
||||
}
|
||||
this.players.playerMap.clear();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] Player cleanup error:", e?.message);
|
||||
}
|
||||
|
||||
// 3. Destroy Lavalink
|
||||
try {
|
||||
if (this.lavalink) {
|
||||
this.lavalink.destroy();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] Lavalink cleanup error:", e?.message);
|
||||
}
|
||||
|
||||
// 4. Close Redis if dashboard enabled
|
||||
try {
|
||||
if (this.dashboard?.redis?.destroy) {
|
||||
await this.dashboard.redis.destroy();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error("[Shutdown] Failed to close Redis:", e.message);
|
||||
}
|
||||
|
||||
// 5. Close Dashboard DB if present
|
||||
try {
|
||||
if (this.dashboard?.db?.close) {
|
||||
await this.dashboard.db.close();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error("[Shutdown] Failed to close Dashboard DB:", e.message);
|
||||
}
|
||||
|
||||
// 6. Stop 24/7 watchdog
|
||||
try {
|
||||
this.gatewayHandler?.stop247Watchdog?.();
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] Watchdog stop error:", e?.message);
|
||||
}
|
||||
|
||||
// 7. Flush pending settings writes
|
||||
try {
|
||||
if (this.settingsMgr?.shutdown) {
|
||||
await this.settingsMgr.shutdown();
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error("[Shutdown] Settings flush failed:", e.message);
|
||||
}
|
||||
|
||||
// 8. Close unified shared MySQL pool (Issue #21)
|
||||
try {
|
||||
await closeSharedMysqlPool();
|
||||
} catch (e) {
|
||||
logger.warn("[Shutdown] MySQL pool close failed:", e?.message);
|
||||
}
|
||||
|
||||
// 9. Clean up event-loop health heartbeat
|
||||
try {
|
||||
if (this._healthInterval) clearInterval(this._healthInterval);
|
||||
const healthFile = path.join(os.tmpdir(), ".remix-health");
|
||||
fs.unlink(healthFile, () => {});
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
||||
applyMixins(Remix, BotVoiceMixin);
|
||||
|
||||
@@ -556,6 +556,7 @@ const BotVoiceMixin = {
|
||||
logger.player(`[Restore] Guild ${guildId}: ${applied.count} track(s) restored, resuming at ${applied.pos}ms.`);
|
||||
} catch (e) {
|
||||
logger.warn(`[Restore] Failed to restore guild ${guildId}:`, e?.message ?? e);
|
||||
await store.clearSnapshot(guildId).catch(() => {});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -8,6 +8,7 @@ import { compare, genSalt, hash } from "bcryptjs";
|
||||
import { createPool } from "mysql2/promise";
|
||||
import { logger } from "../core/Logger.mjs";
|
||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
||||
import { getSharedPromisePool } from "./PoolManager.mjs";
|
||||
|
||||
/**
|
||||
* @class
|
||||
@@ -17,14 +18,19 @@ import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
||||
export class DatabaseManager {
|
||||
/**
|
||||
* Create a new DatabaseManager.
|
||||
* @param {object} config - mysql2 pool configuration (host, user, password, database, etc.).
|
||||
* @param {object} config - mysql2 pool configuration or shared PromisePool instance.
|
||||
*/
|
||||
constructor(config) {
|
||||
this.db = createPool({
|
||||
...MYSQL_POOL_DEFAULTS,
|
||||
connectionLimit: 15,
|
||||
...config,
|
||||
});
|
||||
if (config && typeof config.execute === "function") {
|
||||
this.db = config;
|
||||
this._ownsPool = false;
|
||||
} else if (config && typeof config.promise === "function") {
|
||||
this.db = config.promise();
|
||||
this._ownsPool = false;
|
||||
} else {
|
||||
this.db = getSharedPromisePool(config);
|
||||
this._ownsPool = false;
|
||||
}
|
||||
attachMysqlPoolGuard(this.db, "DashboardDB");
|
||||
}
|
||||
|
||||
@@ -73,10 +79,13 @@ export class DatabaseManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the underlying MySQL connection pool.
|
||||
* Close the underlying MySQL connection pool (no-op if using a shared pool).
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
close() {
|
||||
if (this._ownsPool && this.db?.end) {
|
||||
return this.db.end();
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @module src/db/PoolManager
|
||||
* @description Centralized MySQL connection pool manager for the Remix bot.
|
||||
* Provides a single shared connection pool instance across all services (Settings,
|
||||
* TrackOptions, Last.fm, Dashboard, PlayerStateStore), preventing connection exhaustion.
|
||||
* Supports both callback-style queries and Promise-based execution via `pool.promise()`.
|
||||
*/
|
||||
|
||||
import mysql from "mysql2";
|
||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
||||
import { logger } from "../core/Logger.mjs";
|
||||
|
||||
/** @type {import('mysql2').Pool|null} */
|
||||
let _sharedPool = null;
|
||||
|
||||
/** @type {import('mysql2/promise').Pool|null} */
|
||||
let _sharedPromisePool = null;
|
||||
|
||||
/**
|
||||
* Get or create the shared MySQL callback-style pool.
|
||||
* If config is omitted, returns the existing pool if one was already initialized.
|
||||
* @param {object} [config] - MySQL configuration (host, user, password, database, connectionLimit, etc.)
|
||||
* @returns {import('mysql2').Pool}
|
||||
*/
|
||||
export function getSharedMysqlPool(config = null) {
|
||||
if (_sharedPool) return _sharedPool;
|
||||
if (!config || !config.host) {
|
||||
throw new Error("[PoolManager] Cannot initialize MySQL pool: missing host or config.");
|
||||
}
|
||||
const connectionLimit = Number(config.connectionLimit) > 0 ? Number(config.connectionLimit) : 15;
|
||||
const poolConfig = {
|
||||
...MYSQL_POOL_DEFAULTS,
|
||||
...config,
|
||||
connectionLimit,
|
||||
};
|
||||
|
||||
_sharedPool = mysql.createPool(poolConfig);
|
||||
attachMysqlPoolGuard(_sharedPool, "SharedMySQL");
|
||||
_sharedPool.on("error", (err) => {
|
||||
logger.error("[MySQL] Shared pool error:", err.code ?? err.message);
|
||||
});
|
||||
logger.db?.(`[PoolManager] Initialized shared MySQL pool (connectionLimit=${connectionLimit}).`);
|
||||
return _sharedPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Promise-based wrapper around the shared MySQL pool (`pool.promise()`).
|
||||
* Shares the exact same underlying connections as the callback pool.
|
||||
* @param {object} [config] - MySQL configuration if not yet initialized.
|
||||
* @returns {import('mysql2/promise').Pool}
|
||||
*/
|
||||
export function getSharedPromisePool(config = null) {
|
||||
if (_sharedPromisePool) return _sharedPromisePool;
|
||||
const pool = getSharedMysqlPool(config);
|
||||
_sharedPromisePool = pool.promise();
|
||||
return _sharedPromisePool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gracefully close the shared MySQL pool on shutdown.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function closeSharedMysqlPool() {
|
||||
if (_sharedPool) {
|
||||
try {
|
||||
await new Promise((resolve) => _sharedPool.end(() => resolve()));
|
||||
logger.recovery?.("[PoolManager] Shared MySQL pool closed.");
|
||||
} catch (e) {
|
||||
logger.warn?.("[PoolManager] Error closing shared MySQL pool:", e?.message);
|
||||
}
|
||||
_sharedPool = null;
|
||||
_sharedPromisePool = null;
|
||||
}
|
||||
}
|
||||
+11
-4
@@ -9,6 +9,7 @@ import fs from "node:fs";
|
||||
import mysql from "mysql2";
|
||||
import { EventEmitter } from "node:events";
|
||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
||||
import { getSharedMysqlPool } from "./PoolManager.mjs";
|
||||
import { logger } from "../core/Logger.mjs";
|
||||
|
||||
/**
|
||||
@@ -180,16 +181,22 @@ export class RemoteSettingsManager extends SettingsManager {
|
||||
|
||||
/**
|
||||
* Create a new RemoteSettingsManager backed by a MySQL pool.
|
||||
* @param {object} config - mysql2 pool configuration (host, user, password, database).
|
||||
* @param {object} config - mysql2 pool or configuration (host, user, password, database).
|
||||
* @param {string} defaultsPath - Path to a JSON file with default values and descriptions.
|
||||
* @param {string|null} [botId=null] - The bot user ID for multi-bot support.
|
||||
*/
|
||||
constructor(config, defaultsPath, botId = null) {
|
||||
super();
|
||||
this.botId = botId;
|
||||
this.db = mysql.createPool({ ...MYSQL_POOL_DEFAULTS, connectionLimit: 15, ...config });
|
||||
if (config && typeof config.query === "function") {
|
||||
this.db = config;
|
||||
this._ownsPool = false;
|
||||
} else {
|
||||
this.db = getSharedMysqlPool(config);
|
||||
this._ownsPool = false;
|
||||
}
|
||||
attachMysqlPoolGuard(this.db, "DB");
|
||||
this.db.on('error', (err) => {
|
||||
this.db.on?.('error', (err) => {
|
||||
logger.error('[DB] MySQL pool error:', err.code ?? err.message);
|
||||
});
|
||||
if (defaultsPath) this.loadDefaultsSync(defaultsPath);
|
||||
@@ -219,7 +226,7 @@ export class RemoteSettingsManager extends SettingsManager {
|
||||
}
|
||||
await Promise.allSettled(pendingServers.map(server => this._doSave(server)));
|
||||
try {
|
||||
if (this.db?.end) {
|
||||
if (this._ownsPool && this.db?.end) {
|
||||
await new Promise(r => this.db.end(() => r()));
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
@@ -416,6 +416,7 @@ export class LavalinkManager extends EventEmitter {
|
||||
"[Lavalink] Node ready: " + node.id + " | session: " + this._sessionId
|
||||
);
|
||||
this.emit("ready", this._sessionId);
|
||||
this.emit("nodeConnect", node);
|
||||
} catch (e) {
|
||||
logger.warn(
|
||||
"[Lavalink] nodeConnect handler error:",
|
||||
@@ -425,6 +426,10 @@ export class LavalinkManager extends EventEmitter {
|
||||
};
|
||||
|
||||
this.lavalink.on("nodeConnect", onNodeConnect);
|
||||
this.lavalink.on("nodeReconnect", (node) => {
|
||||
onNodeConnect(node);
|
||||
this.emit("nodeReconnect", node);
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (!this._nodeConnected) {
|
||||
|
||||
@@ -126,6 +126,21 @@ export class PlayerManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-resume all active players after a Lavalink/NodeLink node reconnection.
|
||||
* @async
|
||||
*/
|
||||
async resumeAllOnNodeReconnect() {
|
||||
const activePlayers = [...new Set(this.playerMap.values())].filter(p => p && !p._destroyed && !p.leaving);
|
||||
if (activePlayers.length === 0) return;
|
||||
logger.lavalink(`[PlayerManager] Auto-resuming ${activePlayers.length} player(s) after node reconnection...`);
|
||||
for (const player of activePlayers) {
|
||||
player.resumePlaybackAfterNodeReconnect?.().catch(e =>
|
||||
logger.warn(`[PlayerManager] Resume failed for guild ${player._guildId}:`, e?.message)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a player counts as "busy" — i.e. the bot is actively
|
||||
* serving that channel: a track is loaded (playing or paused), the queue
|
||||
|
||||
@@ -97,11 +97,7 @@ export class FluxerAudioBridge extends EventEmitter {
|
||||
const seekMs = Math.floor((options.seekSeconds ?? 0) * 1000);
|
||||
let durationMs = options.durationMs || 0;
|
||||
const filterPayload = options.filterPayload ?? null;
|
||||
const loadstreamEnabled = isLoadstreamEnabled();
|
||||
|
||||
if (filterPayload && !loadstreamEnabled) {
|
||||
logger.warn("[AudioBridge] Audio filter ignored — the loadstream route is disabled (config.json -> audio.allowLoadstream). Playing unfiltered.");
|
||||
}
|
||||
const loadstreamEnabled = isLoadstreamEnabled() || !!filterPayload;
|
||||
|
||||
try {
|
||||
// ── Route A: /v4/trackstream — primary path, never touches /v4/loadstream.
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* @module src/music/audio/VolumeNormalizer
|
||||
* @description Dynamic volume normalization and ReplayGain / EBU R128 loudness leveling.
|
||||
* Balances acoustic/quiet recordings against loud EDM/rock tracks across YouTube,
|
||||
* Spotify, SoundCloud, and Bilibili.
|
||||
*/
|
||||
|
||||
import { Utils } from "../../utils/Utils.mjs";
|
||||
|
||||
/** Target loudness reference according to EBU R128 / international streaming standards (LUFS). */
|
||||
export const TARGET_LUFS = -14.0;
|
||||
|
||||
/** Baseline perceived loudness offsets per audio source platform (relative gain multipliers). */
|
||||
export const SOURCE_GAIN_OFFSETS = {
|
||||
youtube: 1.00, // YouTube standard master target (-14 LUFS)
|
||||
ytmusic: 1.00, // YouTube Music target (-14 LUFS)
|
||||
spotify: 1.00, // Spotify standard target (-14 LUFS)
|
||||
soundcloud: 0.82, // SoundCloud tracks average -10 to -8 LUFS (uncompressed loud mastering) -> -2.5dB
|
||||
bilibili: 1.15, // Bilibili audio averages -17 to -20 LUFS -> +1.5dB boost
|
||||
deezer: 0.95, // Deezer averages -13 LUFS
|
||||
apple: 1.05, // Apple Music Sound Check averages -16 LUFS
|
||||
bandcamp: 0.90, // Bandcamp self-mastered tracks average -11 LUFS
|
||||
};
|
||||
|
||||
/**
|
||||
* Detect the audio source key for a given track object.
|
||||
* @param {object} track - Track or video metadata object.
|
||||
* @returns {string} Source platform identifier.
|
||||
*/
|
||||
export function detectTrackSource(track) {
|
||||
if (!track) return "youtube";
|
||||
const sourceName = (track.sourceName || track.source || "").toLowerCase();
|
||||
if (sourceName) {
|
||||
if (sourceName.includes("soundcloud")) return "soundcloud";
|
||||
if (sourceName.includes("spotify")) return "spotify";
|
||||
if (sourceName.includes("bilibili")) return "bilibili";
|
||||
if (sourceName.includes("deezer")) return "deezer";
|
||||
if (sourceName.includes("apple")) return "apple";
|
||||
if (sourceName.includes("bandcamp")) return "bandcamp";
|
||||
if (sourceName.includes("youtube")) return "youtube";
|
||||
}
|
||||
|
||||
const url = (track.url || track.uri || "").toLowerCase();
|
||||
if (url.includes("soundcloud.com")) return "soundcloud";
|
||||
if (url.includes("spotify.com")) return "spotify";
|
||||
if (url.includes("bilibili.com")) return "bilibili";
|
||||
if (url.includes("deezer.com")) return "deezer";
|
||||
if (url.includes("music.apple.com"))return "apple";
|
||||
if (url.includes("bandcamp.com")) return "bandcamp";
|
||||
|
||||
return "youtube";
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the normalization gain multiplier for a given track.
|
||||
* Uses EBU R128 loudness tags if present, otherwise applies calibrated source offset.
|
||||
* Clamped between 0.50x (-6 dB) and 1.50x (+3.5 dB) to prevent clipping.
|
||||
*
|
||||
* @param {object|null} track - Track object.
|
||||
* @returns {number} Gain multiplier (e.g. 1.0 = unity gain, 0.82 = -2.5dB).
|
||||
*/
|
||||
export function calculateNormalizationGain(track) {
|
||||
if (!track) return 1.0;
|
||||
|
||||
// Check for explicit ReplayGain or LUFS loudness tags in metadata
|
||||
const measuredLufs = track.pluginInfo?.loudness ??
|
||||
track.info?.loudness ??
|
||||
track.loudness ??
|
||||
track.info?.replaygain;
|
||||
|
||||
if (typeof measuredLufs === "number" && !isNaN(measuredLufs)) {
|
||||
// EBU R128 formula: gain = 10 ^ ((Target - Measured) / 20)
|
||||
const deltaDb = TARGET_LUFS - measuredLufs;
|
||||
const gain = Math.pow(10, deltaDb / 20);
|
||||
return Utils.clamp(gain, 0.50, 1.50);
|
||||
}
|
||||
|
||||
// Fallback to platform-calibrated baseline offset
|
||||
const source = detectTrackSource(track);
|
||||
const baseline = SOURCE_GAIN_OFFSETS[source] ?? 1.0;
|
||||
return Utils.clamp(baseline, 0.50, 1.50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the effective output volume percentage (0-200) given a user's preferred volume,
|
||||
* current track, and normalization setting.
|
||||
*
|
||||
* @param {number} preferredVolume - Base volume fraction (e.g. 1.0 = 100%).
|
||||
* @param {object|null} track - Currently playing track.
|
||||
* @param {boolean} [normalizationEnabled=true] - Whether normalization is active.
|
||||
* @returns {number} Effective volume percentage (0-200).
|
||||
*/
|
||||
export function getEffectiveVolume(preferredVolume = 1.0, track = null, normalizationEnabled = true) {
|
||||
const base = Number.isFinite(preferredVolume) ? preferredVolume : 1.0;
|
||||
if (!normalizationEnabled) {
|
||||
return Utils.clamp(Math.round(base * 100), 0, 200);
|
||||
}
|
||||
const gain = calculateNormalizationGain(track);
|
||||
return Utils.clamp(Math.round(base * gain * 100), 0, 200);
|
||||
}
|
||||
@@ -146,8 +146,9 @@ const PlaybackMixin = {
|
||||
|
||||
if (!this._voiceConn || this.leaving) return;
|
||||
|
||||
if (this.preferredVolume !== 1 && this._voiceConn) {
|
||||
try { this._voiceConn.setVolume(this.preferredVolume * 100); } catch(_) {}
|
||||
if (this._voiceConn) {
|
||||
const vol = this.getEffectiveVolume ? this.getEffectiveVolume(songData) : (this.preferredVolume * 100);
|
||||
try { this._voiceConn.setVolume(vol); } catch(_) {}
|
||||
}
|
||||
|
||||
if (!this._voiceConn || this.leaving) return;
|
||||
@@ -491,24 +492,24 @@ const PlaybackMixin = {
|
||||
return { ok: false, reason: "Player not bound to a guild." };
|
||||
}
|
||||
|
||||
if (filterMeta && !isLoadstreamEnabled()) {
|
||||
logger.warn("[Player] applyFilter rejected — loadstream route disabled (audio.allowLoadstream), filters are NodeLink server-side effects");
|
||||
return {
|
||||
ok: false,
|
||||
reason: "filters need the NodeLink loadstream route — set audio.allowLoadstream to true in config.json; playback is unfiltered in trackstream mode",
|
||||
};
|
||||
}
|
||||
|
||||
const current = this.queue.getCurrent();
|
||||
|
||||
this.activeFilter = filterMeta ?? null;
|
||||
this.activeFilterPayload = filterMeta ? filterPayload : null;
|
||||
this.activeFilterPayload = filterMeta && Object.keys(filterPayload || {}).length > 0 ? filterPayload : null;
|
||||
this.emit("filter", this.activeFilter);
|
||||
|
||||
if (!current?.encoded || !this._voiceConn) {
|
||||
return { ok: true, pending: true };
|
||||
}
|
||||
|
||||
// Hot-apply filter immediately to currently playing song
|
||||
const pos = this.computePosition ? this.computePosition() : (Date.now() - (this.startedPlaying || Date.now()));
|
||||
try {
|
||||
await this.seekToPosition(Math.max(0, pos));
|
||||
} catch (e) {
|
||||
logger.warn("[Player] Hot-apply filter re-seek error:", e?.message);
|
||||
}
|
||||
|
||||
return { ok: true };
|
||||
},
|
||||
|
||||
@@ -643,12 +644,27 @@ const PlaybackMixin = {
|
||||
* @this {import('./Player.mjs').Player}
|
||||
* @returns {Promise<{text: string, source: string, synced: boolean, lines: Array}|null>}
|
||||
*/
|
||||
async lyrics() {
|
||||
async lyrics(customQuery = null) {
|
||||
let query;
|
||||
if (customQuery) {
|
||||
const parts = String(customQuery).split(/\s*[-–—]\s*/);
|
||||
let artist = null;
|
||||
let title = customQuery.trim();
|
||||
if (parts.length >= 2) {
|
||||
artist = parts[0].trim();
|
||||
title = parts.slice(1).join(" - ").trim();
|
||||
}
|
||||
query = {
|
||||
title: Utils.cleanTitle(title),
|
||||
artist: artist ? Utils.cleanTitle(artist) : null,
|
||||
candidates: [customQuery.trim(), `${artist || ""} ${title}`.trim()].filter(Boolean)
|
||||
};
|
||||
} else {
|
||||
const current = this.queue.getCurrent();
|
||||
if (!current) return null;
|
||||
|
||||
const query = this._buildLyricsQuery(current);
|
||||
query = this._buildLyricsQuery(current);
|
||||
if (!query.title) return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await this._fetchVerifiedLyrics(query);
|
||||
@@ -725,8 +741,9 @@ const PlaybackMixin = {
|
||||
* @returns {Promise<{text: string, source: string, synced: boolean, lines: Array}|null>}
|
||||
*/
|
||||
async _fetchVerifiedLyrics(query) {
|
||||
const durationMs = this._getTrackDurationMs(this.queue.getCurrent());
|
||||
const durationSec = Math.round(durationMs / 1000);
|
||||
const current = this.queue.getCurrent();
|
||||
const durationMs = current ? this._getTrackDurationMs(current) : 0;
|
||||
const durationSec = durationMs > 0 ? Math.round(durationMs / 1000) : null;
|
||||
const headers = { "User-Agent": "FluxerBot/1.0 (music bot lyrics lookup)" };
|
||||
|
||||
const urls = [];
|
||||
@@ -753,7 +770,7 @@ const PlaybackMixin = {
|
||||
title: query.title,
|
||||
artist: query.artist,
|
||||
durationSec,
|
||||
});
|
||||
}) || candidates[0];
|
||||
if (!best) return null;
|
||||
|
||||
if (best.instrumental) {
|
||||
|
||||
@@ -11,13 +11,14 @@ import { getVoiceManager } from "@fluxerjs/voice";
|
||||
import { EventEmitter } from "node:events";
|
||||
import http from "node:http";
|
||||
import https from "node:https";
|
||||
import { EmbedBuilder } from "@fluxerjs/core";
|
||||
import { EmbedBuilder, PermissionFlags } from "@fluxerjs/core";
|
||||
import { getGlobalColor } from "../../ui/index.mjs";
|
||||
import { Utils, cleanId } from "../../utils/Utils.mjs";
|
||||
import { logger } from "../../core/Logger.mjs";
|
||||
import { get247ChannelMode, detachPlayerFromManager } from "../../utils/Helpers247.mjs";
|
||||
import { hasHumansInChannel } from "../../voice/VoiceStateResolver.mjs";
|
||||
import { FluxerAudioBridge } from "../audio/FluxerAudioBridge.mjs";
|
||||
import { getEffectiveVolume } from "../audio/VolumeNormalizer.mjs";
|
||||
import { applyMixins } from "../../utils/mixins.mjs";
|
||||
import { Queue } from "./Queue.mjs";
|
||||
import PlaybackMixin from "./PlaybackMixin.mjs";
|
||||
@@ -515,6 +516,23 @@ class Player extends EventEmitter {
|
||||
this._lastConnectedAt = Date.now();
|
||||
this.leaving = false;
|
||||
|
||||
try {
|
||||
const me = channel.guild?.members?.me ?? (this.client?.user?.id ? channel.guild?.members?.get?.(this.client.user.id) : null);
|
||||
if (me) {
|
||||
const perms = channel.permissionsFor?.(me) ?? me.permissionsIn?.(channel);
|
||||
if (perms && !perms.has?.(PermissionFlags?.Administrator)) {
|
||||
if (PermissionFlags?.ViewChannel && !perms.has(PermissionFlags.ViewChannel)) {
|
||||
throw new Error(`Bot lacks ViewChannel permission in channel ${channelId}`);
|
||||
}
|
||||
if (PermissionFlags?.Connect && !perms.has(PermissionFlags.Connect)) {
|
||||
throw new Error(`Bot lacks Connect permission in channel ${channelId}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (permErr) {
|
||||
if (permErr?.message?.includes?.("Bot lacks")) throw permErr;
|
||||
}
|
||||
|
||||
logger.player(`[Player] Joining channel ${channelId} via vm.join() (LiveKit)...`);
|
||||
const vm = getVoiceManager(this.client);
|
||||
if (!vm) {
|
||||
@@ -786,6 +804,41 @@ class Player extends EventEmitter {
|
||||
return ":arrow_forward: Resumed";
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the current track playback position in milliseconds.
|
||||
* @returns {number} Elapsed playback position in ms.
|
||||
*/
|
||||
computePosition() {
|
||||
if (!this.startedPlaying) return 0;
|
||||
if (this._paused && this._pausedAt) {
|
||||
return Math.max(0, this._pausedAt - this.startedPlaying);
|
||||
}
|
||||
return Math.max(0, Date.now() - this.startedPlaying);
|
||||
}
|
||||
|
||||
/**
|
||||
* Seamlessly resume playback after a NodeLink/Lavalink node reconnects.
|
||||
* Re-requests the stream at the last computed position so listeners experience
|
||||
* minimal interruption.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async resumePlaybackAfterNodeReconnect() {
|
||||
if (this._destroyed || this.leaving || !this._voiceConn) return false;
|
||||
const current = this.queue?.getCurrent();
|
||||
if (!current || !this._audioBridge?.playing) return false;
|
||||
|
||||
const posMs = this.computePosition();
|
||||
logger.player(`[Player:${this._guildId}] Node reconnected — resuming "${current.title}" at ${Math.round(posMs / 1000)}s`);
|
||||
|
||||
try {
|
||||
await this._playTrackViaBridge(current, { seekSeconds: posMs / 1000 });
|
||||
return true;
|
||||
} catch (err) {
|
||||
logger.warn(`[Player:${this._guildId}] Failed to auto-resume on node reconnect:`, err?.message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Skip the current track and advance to the next. Emits "trackSkip" with
|
||||
* the skipped track so autoplay (when enabled) can replenish the queue.
|
||||
@@ -854,6 +907,18 @@ class Player extends EventEmitter {
|
||||
return `:track_next: Skipped to position ${position}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the effective playback volume percentage (0-200), applying dynamic
|
||||
* volume normalization (ReplayGain / EBU R128) if enabled.
|
||||
* @param {object|null} [track=null]
|
||||
* @returns {number} Effective volume percentage (0-200).
|
||||
*/
|
||||
getEffectiveVolume(track = null) {
|
||||
const cur = track || this.queue?.getCurrent?.();
|
||||
const isNorm = this.volumeNormalization !== false;
|
||||
return getEffectiveVolume(this.preferredVolume, cur, isNorm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the playback volume.
|
||||
* @param {number} v - Volume as a decimal (0–2, where 1 = 100%).
|
||||
@@ -863,7 +928,9 @@ class Player extends EventEmitter {
|
||||
this.preferredVolume = Utils.clamp(v, 0, 2);
|
||||
this.emit("volume", this.preferredVolume);
|
||||
if (this._voiceConn) {
|
||||
this._voiceConn.setVolume(this.preferredVolume * 100);
|
||||
try {
|
||||
this._voiceConn.setVolume(this.getEffectiveVolume());
|
||||
} catch (_) {}
|
||||
}
|
||||
if (!this._voiceConn)
|
||||
return `Volume set to \`${Math.round(this.preferredVolume * 100)}%\` — will apply when connected.`;
|
||||
@@ -971,6 +1038,25 @@ class Player extends EventEmitter {
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a slice or range of tracks from the queue (0-based indices, inclusive).
|
||||
* @param {number} from - Starting 0-based index.
|
||||
* @param {number} to - Ending 0-based index.
|
||||
* @returns {string} Result message.
|
||||
*/
|
||||
removeRange(from, to) {
|
||||
if (this.isEmpty()) return "The queue is empty.";
|
||||
const oldSize = this.queue.size();
|
||||
const result = this.queue.removeRange(from, to);
|
||||
if (typeof result === "string") return result;
|
||||
if (oldSize !== this.queue.size()) this.emit("update", "queue");
|
||||
|
||||
if (this.isEmpty() && !this.queue.getCurrent()) {
|
||||
this._startInactivityTimer();
|
||||
}
|
||||
return `:wastebasket: Successfully removed **${result.count}** track${result.count === 1 ? "" : "s"} from the queue.`;
|
||||
}
|
||||
|
||||
/** @private Stop the audio bridge if currently playing. */
|
||||
_bridgeStop() {
|
||||
if (this._audioBridge?.playing) {
|
||||
|
||||
@@ -76,6 +76,23 @@ export class Queue extends EventEmitter {
|
||||
return `Successfully removed **${title}** from the queue.`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a range of tracks from the queue (0-based indices, inclusive).
|
||||
* @param {number} from - Starting 0-based index.
|
||||
* @param {number} to - Ending 0-based index.
|
||||
* @returns {{ count: number, removed: Array<object> }|string}
|
||||
*/
|
||||
removeRange(from, to) {
|
||||
if (this.isEmpty()) return "The queue is empty.";
|
||||
const start = Math.max(0, Math.min(from, to));
|
||||
const end = Math.min(this.data.length - 1, Math.max(from, to));
|
||||
if (start >= this.data.length) return "Index out of bounds";
|
||||
const deleteCount = (end - start) + 1;
|
||||
const removed = this.data.splice(start, deleteCount);
|
||||
this.emit("queue", { type: "removeRange", data: { start, end, count: removed.length, old: this.data.slice(), removed, new: this.data } });
|
||||
return { count: removed.length, removed };
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a track from one position to another (0-based indices).
|
||||
* @param {number} from - Source index.
|
||||
|
||||
@@ -554,9 +554,78 @@ const SearchMixin = {
|
||||
}
|
||||
|
||||
if (isUrl && !fromTitleFallback && lcTracks.length > 1) {
|
||||
const videos = lcTracks.map(t => this._lcTrackToVideo(t, trackMeta)).filter(Boolean);
|
||||
const playlistName = result?.playlistInfo?.name ?? result?.info?.name ?? "playlist";
|
||||
const allRawTracks = [...lcTracks];
|
||||
|
||||
// Check if there are additional pages from NodeLink / LavaSrc pagination (Issue #17)
|
||||
let nextPageToken = result?.pluginInfo?.nextPageToken ?? result?.playlistInfo?.nextPageToken;
|
||||
let page = 1;
|
||||
const maxPages = 10;
|
||||
while (nextPageToken && page < maxPages) {
|
||||
try {
|
||||
page++;
|
||||
events.emit("message", `Fetching next page of **${playlistName}** (page ${page})...`);
|
||||
const nextResult = await this._lavalink.search(query, {
|
||||
page,
|
||||
pageToken: nextPageToken,
|
||||
});
|
||||
const nextTracks = nextResult?.tracks ?? [];
|
||||
if (nextTracks.length === 0) break;
|
||||
allRawTracks.push(...nextTracks);
|
||||
nextPageToken = nextResult?.pluginInfo?.nextPageToken ?? nextResult?.playlistInfo?.nextPageToken;
|
||||
} catch (pageErr) {
|
||||
logger.warn(`[Player] Playlist pagination page ${page} error:`, pageErr?.message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const BATCH_SIZE = 50;
|
||||
if (allRawTracks.length <= BATCH_SIZE) {
|
||||
const videos = allRawTracks.map(t => this._lcTrackToVideo(t, trackMeta)).filter(Boolean);
|
||||
this.addManyToQueue(videos, top);
|
||||
events.emit("message", "Successfully added **" + videos.length + "** songs to the queue.");
|
||||
events.emit("message", `Successfully added **${videos.length}** songs to the queue.`);
|
||||
} else {
|
||||
// Paginated background queue ingestion (Issue #17)
|
||||
const initialRaw = allRawTracks.slice(0, BATCH_SIZE);
|
||||
const initialVideos = initialRaw.map(t => this._lcTrackToVideo(t, trackMeta)).filter(Boolean);
|
||||
this.addManyToQueue(initialVideos, top);
|
||||
|
||||
// Start playing immediately if idle so user hears music right away!
|
||||
if (!this.queue.getCurrent()) {
|
||||
this.playNext().catch(e => logger.error("[Player] playNext error:", e.message));
|
||||
}
|
||||
|
||||
events.emit("message", `Queued first **${initialVideos.length}** songs and started playback! Ingesting **${allRawTracks.length - initialVideos.length}** more tracks in the background...`);
|
||||
|
||||
// Ingest remaining tracks in the background without blocking the event loop
|
||||
(async () => {
|
||||
let loaded = initialVideos.length;
|
||||
let lastStatusTime = Date.now();
|
||||
const remainingRaw = allRawTracks.slice(BATCH_SIZE);
|
||||
|
||||
for (let i = 0; i < remainingRaw.length; i += BATCH_SIZE) {
|
||||
await new Promise(r => setTimeout(r, 150));
|
||||
if (this._destroyed || this.leaving) break;
|
||||
|
||||
const chunk = remainingRaw.slice(i, i + BATCH_SIZE)
|
||||
.map(t => this._lcTrackToVideo(t, trackMeta))
|
||||
.filter(Boolean);
|
||||
this.addManyToQueue(chunk, false);
|
||||
loaded += chunk.length;
|
||||
|
||||
const now = Date.now();
|
||||
if (now - lastStatusTime >= 2000 && loaded < allRawTracks.length) {
|
||||
lastStatusTime = now;
|
||||
events.emit("message", `Importing playlist: **${loaded}/${allRawTracks.length}** tracks queued...`);
|
||||
}
|
||||
}
|
||||
|
||||
events.emit("message", `Successfully added all **${loaded}** songs to the queue from **${playlistName}**.`);
|
||||
})().catch(ingestErr => {
|
||||
logger.warn("[Player] Background playlist ingestion error:", ingestErr?.message);
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const video = this._lcTrackToVideo(firstTrack, trackMeta);
|
||||
if (video) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import mysql from "mysql2";
|
||||
import { logger } from "../core/Logger.mjs";
|
||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "../db/MysqlGuard.mjs";
|
||||
import { getSharedMysqlPool } from "../db/PoolManager.mjs";
|
||||
|
||||
const DEFAULT_ALIAS = "default";
|
||||
const MAX_ALIAS_LEN = 32;
|
||||
@@ -23,11 +24,15 @@ export class TrackOptionsManager {
|
||||
/** @private @type {number} */
|
||||
_cacheMaxSize = 2000;
|
||||
|
||||
/** @param {object} mysqlConfig - MySQL connection config. */
|
||||
/** @param {object} mysqlConfig - MySQL connection config or shared Pool instance. */
|
||||
constructor(mysqlConfig) {
|
||||
this.db = mysql.createPool({ ...MYSQL_POOL_DEFAULTS, connectionLimit: 10, ...mysqlConfig });
|
||||
if (mysqlConfig && typeof mysqlConfig.query === "function") {
|
||||
this.db = mysqlConfig;
|
||||
} else {
|
||||
this.db = getSharedMysqlPool(mysqlConfig);
|
||||
}
|
||||
attachMysqlPoolGuard(this.db, "TrackOptions");
|
||||
this.db.on("error", (err) => {
|
||||
this.db.on?.("error", (err) => {
|
||||
logger.error("[TrackOptions] MySQL pool error:", err.code ?? err.message);
|
||||
});
|
||||
this._readyPromise = this._ensureTable();
|
||||
|
||||
@@ -15,6 +15,7 @@ import { normalizeTrackText } from "./constants.mjs";
|
||||
import { applyMixins } from "../../utils/mixins.mjs";
|
||||
import { parseLastFmUrl, isLastFmUrl } from "./urlUtils.mjs";
|
||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "../../db/MysqlGuard.mjs";
|
||||
import { getSharedPromisePool } from "../../db/PoolManager.mjs";
|
||||
import UserStoreMixin from "./UserStoreMixin.mjs";
|
||||
import ScrobblingMixin from "./ScrobblingMixin.mjs";
|
||||
import TrackQueriesMixin from "./TrackQueriesMixin.mjs";
|
||||
@@ -139,15 +140,13 @@ export class LastFmManager {
|
||||
/** @private @async Get or create the MySQL connection pool. @returns {Promise<object>} */
|
||||
async _getPool() {
|
||||
if (this._pool) return this._pool;
|
||||
const mysql = await import("mysql2/promise");
|
||||
this._pool = mysql.createPool({
|
||||
...MYSQL_POOL_DEFAULTS,
|
||||
host: this._mysqlConfig.host,
|
||||
port: this._mysqlConfig.port ?? 3306,
|
||||
user: this._mysqlConfig.user,
|
||||
password: this._mysqlConfig.password,
|
||||
database: this._mysqlConfig.database,
|
||||
});
|
||||
if (this._mysqlConfig && typeof this._mysqlConfig.execute === "function") {
|
||||
this._pool = this._mysqlConfig;
|
||||
} else if (this._mysqlConfig && typeof this._mysqlConfig.promise === "function") {
|
||||
this._pool = this._mysqlConfig.promise();
|
||||
} else {
|
||||
this._pool = getSharedPromisePool(this._mysqlConfig);
|
||||
}
|
||||
attachMysqlPoolGuard(this._pool, "LastFm");
|
||||
await this._initTable();
|
||||
return this._pool;
|
||||
|
||||
+20
-23
@@ -222,25 +222,7 @@ export class RichPaginator {
|
||||
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(() => {});
|
||||
});
|
||||
let unobserve = () => {};
|
||||
|
||||
/** @private Clear all reactions on the paginator message. */
|
||||
const clearReactions = async () => {
|
||||
@@ -279,12 +261,27 @@ export class RichPaginator {
|
||||
timer = setTimeout(closeSession, this._timeout);
|
||||
};
|
||||
|
||||
const origHandler = wrapped.handler.observedReactions.get(rawMsg.id);
|
||||
if (origHandler) {
|
||||
const origCb = origHandler.cb;
|
||||
origHandler.cb = (e, m) => { resetTimer(); origCb(e, m); };
|
||||
unobserve = wrapped.onReaction(allReactions, async (e) => {
|
||||
resetTimer();
|
||||
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(() => {});
|
||||
});
|
||||
|
||||
return rawMsg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,15 +41,27 @@ const RejoinManager = {
|
||||
return player;
|
||||
} catch (err) {
|
||||
const errMsg = err?.message ?? String(err);
|
||||
const isTrackTimeout = errMsg.includes("track publication timed out")
|
||||
const isPermissionError = errMsg.includes("permission")
|
||||
|| errMsg.includes("Permission")
|
||||
|| errMsg.includes("Bot lacks")
|
||||
|| errMsg.includes("403")
|
||||
|| errMsg.includes("Unauthorized");
|
||||
|
||||
const isTransientError = !isPermissionError && (
|
||||
errMsg.includes("track publication timed out")
|
||||
|| errMsg.includes("Voice connection timeout")
|
||||
|| errMsg.includes("LiveKit connection timeout")
|
||||
|| errMsg.includes("lavalink player create failed")
|
||||
|| errMsg.includes("Failed to create audio player")
|
||||
|| errMsg.includes("internal error");
|
||||
|| errMsg.includes("internal error")
|
||||
|| errMsg.includes("ETIMEDOUT")
|
||||
|| errMsg.includes("ECONNRESET")
|
||||
);
|
||||
|
||||
if (isTrackTimeout && attempt < maxRetries) {
|
||||
if (isTransientError && attempt < maxRetries) {
|
||||
const backoffMs = baseDelay * Math.pow(2, attempt - 1);
|
||||
logger.warn(
|
||||
`[${context}] Track publication failed for channel ${channelId} (attempt ${attempt}/${maxRetries}) — ` +
|
||||
`[${context}] Voice connection/track failed for channel ${channelId} (attempt ${attempt}/${maxRetries}) — ` +
|
||||
`retrying in ${backoffMs / 1000}s: ${errMsg}`
|
||||
);
|
||||
await new Promise(resolve => setTimeout(resolve, backoffMs));
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"locale": "en",
|
||||
"stay_247": "none",
|
||||
"volume": 100,
|
||||
"normalize": true,
|
||||
"voteSkip": true,
|
||||
"voteSkipThreshold": 3
|
||||
},
|
||||
@@ -16,6 +17,7 @@
|
||||
"locale": "The preferred language of your server.",
|
||||
"stay_247": "Join a voice channel and use `$prefix247` to toggle 24/7. The bot stays permanently and auto-rejoins if disconnected. Use `$prefix247 off` to disable.",
|
||||
"volume": "The default playback volume for this server (1-200). Saved automatically when you use $prefixvolume.",
|
||||
"normalize": "Whether dynamic volume normalization (ReplayGain / EBU R128) is enabled to level playback loudness across YouTube, Spotify, and SoundCloud. Use $prefixnormalize to toggle.",
|
||||
"voteSkip": "Whether a majority vote is required to skip when several people are listening. Set to `true` or `1` to enable (default), `false` or `0` to let anyone skip instantly.",
|
||||
"voteSkipThreshold": "The number of people in the voice channel (2-50) at which a skip vote is required instead of an instant skip. Default is `3`."
|
||||
}
|
||||
|
||||
@@ -82,7 +82,11 @@
|
||||
"seek": "انتقل إلى موضع محدد في المقطع الذي يعمل حالياً.",
|
||||
"move": "انقل مقطعاً من موضع إلى آخر في قائمة الانتظار.",
|
||||
"autoplay": "بدّل التشغيل التلقائي — شغّل مقاطع مشابهة تلقائياً عند انتهاء القائمة.",
|
||||
"trackopt": "عيّن أوقات بداية/نهاية مخصصة للمقاطع. يدعم الأسماء المستعارة — احفظ عمليات قص متعددة لكل مقطع."
|
||||
"trackopt": "عيّن أوقات بداية/نهاية مخصصة للمقاطع. يدعم الأسماء المستعارة — احفظ عمليات قص متعددة لكل مقطع.",
|
||||
"normalize": "تبديل تسوية الصوت الديناميكية (مستوى ReplayGain) عبر منصات الموسيقى المختلفة.",
|
||||
"bassboost": "تطبيق تأثير معادل تضخيم الباس بمستويات منخفضة، متوسطة أو قوية.",
|
||||
"speed": "تعديل سرعة تشغيل المقطع الصوتي الحالي (0.5× إلى 2.0×).",
|
||||
"pitch": "تعديل طبقة الصوت (النغمة) للمقطع الصوتي الحالي (0.5× إلى 2.0×)."
|
||||
},
|
||||
"options": {
|
||||
"debug": {
|
||||
@@ -162,6 +166,18 @@
|
||||
},
|
||||
"trackopt": {
|
||||
"times": "وقت البداية والنهاية الاختياري، مثلاً '0:30' أو '0:30 3:45'"
|
||||
},
|
||||
"normalize": {
|
||||
"state": "تشغيل/إيقاف أو عرض الحالة ('on' أو 'off' أو 'status'). اتركه فارغاً للتبديل."
|
||||
},
|
||||
"bassboost": {
|
||||
"level": "مستوى تضخيم الباس: 'low' أو 'medium' أو 'hard' أو 'off'."
|
||||
},
|
||||
"speed": {
|
||||
"rate": "مضاعف سرعة التشغيل بين 0.5 و 2.0 (مثل 1.25). اتركه فارغاً للعودة إلى 1.0×."
|
||||
},
|
||||
"pitch": {
|
||||
"pitch": "مضاعف طبقة الصوت بين 0.5 و 2.0 (مثل 1.25). اتركه فارغاً للعودة إلى 1.0×."
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
@@ -513,6 +529,7 @@
|
||||
"labelPfp": "نمط صورة البوت",
|
||||
"labelLocale": "اللغة",
|
||||
"labelVolume": "مستوى الصوت الافتراضي",
|
||||
"labelNormalize": "تسوية مستوى الصوت",
|
||||
"labelVoteSkip": "التصويت للتخطي",
|
||||
"labelVoteSkipThreshold": "حد التصويت للتخطي",
|
||||
"labelAnnouncementChannel": "قناة الإعلانات",
|
||||
@@ -594,13 +611,21 @@
|
||||
},
|
||||
"stats": {
|
||||
"title": "بوت Remix الموسيقي",
|
||||
"categoryOverview": "📊 نظرة عامة",
|
||||
"categoryMusic": "🎧 النشاط الموسيقي",
|
||||
"categoryLastfm": "🎵 Last.fm",
|
||||
"categoryPerformance": "⚡ النظام والشبكة",
|
||||
"servers": "📂 **الخوادم**",
|
||||
"users": "👥 **المستخدمون**",
|
||||
"players": "🎧 **المشغّلات**",
|
||||
"playersWithPlaying": "{{total}} ({{playing}} قيد التشغيل)",
|
||||
"queuedTracks": "🎶 **المسارات في الانتظار**",
|
||||
"radios": "📻 **محطات 24/7**",
|
||||
"scrobbles": "🎵 **اسكروبلات**",
|
||||
"linkedUsers": "🔗 **حسابات Last.fm**",
|
||||
"ping": "🏓 **البينغ**",
|
||||
"gateway": "🌐 **البوابة**",
|
||||
"shard": "🧩 **الشارد (Shard)**",
|
||||
"uptime": "⏱️ **وقت التشغيل**",
|
||||
"build": "🔧 **الإصدار**",
|
||||
"lastRestart": "🪛 **آخر إعادة تشغيل**",
|
||||
@@ -825,6 +850,29 @@
|
||||
"listTitle": "📋 **خيارات المسار الخاصة بك** ({{count}})",
|
||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||
"listHint": "استخدم `{{prefix}}trackopt play <alias>` لتطبيق تقصير مسمى، أو `{{prefix}}trackopt remove [alias]` لحذف واحد."
|
||||
},
|
||||
"normalize": {
|
||||
"statusEnabled": "🔊 تسوية الصوت الديناميكية (ReplayGain) **مفعلة** حالياً لهذا الخادم.",
|
||||
"statusDisabled": "🔇 تسوية الصوت الديناميكية (ReplayGain) **معطلة** حالياً لهذا الخادم.",
|
||||
"info": "عند التفعيل، تتم تسوية مستوى الصوت ديناميكياً وفق المعيار الدولي -14 LUFS لتشغيل الأغاني الهادئة ومقاطع الساوند كلاود الصاخبة بمستوى استماع متوازن.",
|
||||
"trackInfo": "معلومات المقطع الحالي:\n• المصدر: `{{source}}`\n• تعديل الكسب: `{{gainDb}} dB` ({{gainPct}}%)\n• مستوى الصوت الفعلي: `{{effective}}%`"
|
||||
},
|
||||
"bassboost": {
|
||||
"disabled": "🔇 تم تعطيل تضخيم الباس — استعادة توازن الصوت الأصلي.",
|
||||
"applied": "🔊 تم تطبيق **تضخيم الباس ({{level}})**! معادل الصوت نشط الآن.",
|
||||
"failed": "❌ فشل تطبيق تضخيم الباس: {{reason}}"
|
||||
},
|
||||
"speed": {
|
||||
"reset": "⏩ تمت إعادة ضبط سرعة التشغيل إلى الوضع الطبيعي **1.0×**.",
|
||||
"current": "⏩ سرعة التشغيل الحالية: **{{speed}}×**.\nاستخدم `{{prefix}}speed <0.5-2.0>` لتغيير السرعة.",
|
||||
"set": "{{emoji}} تم ضبط سرعة التشغيل على **{{speed}}×**.",
|
||||
"failed": "❌ فشل تعديل السرعة: {{reason}}"
|
||||
},
|
||||
"pitch": {
|
||||
"reset": "🎵 تمت إعادة ضبط طبقة الصوت إلى الوضع الطبيعي **1.0×**.",
|
||||
"current": "🎵 طبقة الصوت الحالية: **{{pitch}}×**.\nاستخدم `{{prefix}}pitch <0.5-2.0>` لتغيير الطبقة.",
|
||||
"set": "🎵 تم ضبط طبقة الصوت على **{{pitch}}×**.",
|
||||
"failed": "❌ فشل تعديل طبقة الصوت: {{reason}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,11 @@
|
||||
"seek": "بچۆرەوە شوێنێکی دیاریکراو لە تراکی ئێستادا.",
|
||||
"move": "تراکێک لە شوێنێکەوە بگوازەرەوە بۆ شوێنێکی تر لە ڕیزبەندییەکەدا.",
|
||||
"autoplay": "لێدانی خۆکار بکەوە/ناچالاک بکە — بە خۆکارایەتی تراکی هاوشێوە لێبدە کاتێک ڕیزبەندییەکە تەواو بوو.",
|
||||
"trackopt": "کاتی دەستپێکردن/کۆتایی تایبەت بۆ تراکەکان دابنێ. ناوی بدیل پشتگیری دەکات — چەندین بڕین بۆ هەر تراکێک بۆ بەشە جیاوازەکان پاشەکەوت بکە."
|
||||
"trackopt": "کاتی دەستپێکردن/کۆتایی تایبەت بۆ تراکەکان دابنێ. ناوی بدیل پشتگیری دەکات — چەندین بڕین بۆ هەر تراکێک بۆ بەشە جیاوازەکان پاشەکەوت بکە.",
|
||||
"normalize": "گۆڕینی یەکسانسازیی دەنگی داینامیکی (ئاستی ReplayGain) لەنێوان سەرچاوەکانی مۆسیقادا.",
|
||||
"bassboost": "بەکاربردنی کاریگەریی ئیكوالایزەری بەرزکردنەوەی باس بە ئاستی نزم، مامناوەند یان بەهێز.",
|
||||
"speed": "دەستکاریکردنی خێرایی لێدانی تراکی ئێستا (0.5× بۆ 2.0×).",
|
||||
"pitch": "دەستکاریکردنی تۆن و ئاستی دەنگی تراکی ئێستا (0.5× بۆ 2.0×)."
|
||||
},
|
||||
"options": {
|
||||
"debug": {
|
||||
@@ -162,6 +166,18 @@
|
||||
},
|
||||
"trackopt": {
|
||||
"times": "کاتی دەستپێکردن و کۆتایی ئیختیاری، بۆ نموونە '0:30' یان '0:30 3:45'"
|
||||
},
|
||||
"normalize": {
|
||||
"state": "چالاککردن/ناچالاککردن یان بینینی دۆخ ('on'، 'off'، 'status'). بە بەتاڵی جێی بهێڵە بۆ گۆڕین."
|
||||
},
|
||||
"bassboost": {
|
||||
"level": "ئاستی بەرزکردنەوەی باس: 'low'، 'medium'، 'hard'، یان 'off'."
|
||||
},
|
||||
"speed": {
|
||||
"rate": "ڕێژەی خێرایی لێدان لەنێوان 0.5 و 2.0 (بۆ نموونە 1.25). بە بەتاڵی جێی بهێڵە بۆ گەڕانەوە بۆ 1.0×."
|
||||
},
|
||||
"pitch": {
|
||||
"pitch": "ڕێژەی تۆنی دەنگ لەنێوان 0.5 و 2.0 (بۆ نموونە 1.25). بە بەتاڵی جێی بهێڵە بۆ گەڕانەوە بۆ 1.0×."
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
@@ -513,6 +529,7 @@
|
||||
"labelPfp": "شێوازی وێنەی بۆت",
|
||||
"labelLocale": "زمان",
|
||||
"labelVolume": "ئاستی دەنگی بنەڕەتی",
|
||||
"labelNormalize": "یەکسانسازیی ئاستی دەنگ",
|
||||
"labelVoteSkip": "دەنگدان بۆ تێپەڕین",
|
||||
"labelVoteSkipThreshold": "سنووری دەنگدان بۆ تێپەڕین",
|
||||
"labelAnnouncementChannel": "کەنالی ڕاگەیاندن",
|
||||
@@ -594,13 +611,21 @@
|
||||
},
|
||||
"stats": {
|
||||
"title": "بۆتی موزیکی Remix",
|
||||
"categoryOverview": "📊 کورتە",
|
||||
"categoryMusic": "🎧 چالاکی موزیک",
|
||||
"categoryLastfm": "🎵 Last.fm",
|
||||
"categoryPerformance": "⚡ سیستەم و هێڵ",
|
||||
"servers": "📂 **سێرڤەرەکان**",
|
||||
"users": "👥 **بەکارهێنەران**",
|
||||
"players": "🎧 **پەخشکەرەکان**",
|
||||
"playersWithPlaying": "{{total}} ({{playing}} لێدەدرێت)",
|
||||
"queuedTracks": "🎶 **گۆرانییەکانی ڕیزبەند**",
|
||||
"radios": "📻 **ڕادیۆکانی 24/7**",
|
||||
"scrobbles": "🎵 **سکرۆبلەکان**",
|
||||
"linkedUsers": "🔗 **هەژمارەکانی Last.fm**",
|
||||
"ping": "🏓 **پینگ**",
|
||||
"gateway": "🌐 **گەیتوەی**",
|
||||
"shard": "🧩 **شارد (Shard)**",
|
||||
"uptime": "⏱️ **کاتی چالاک**",
|
||||
"build": "🔧 **بەرنامە**",
|
||||
"lastRestart": "🪛 **دوایین دەستپێکردنەوە**",
|
||||
@@ -825,6 +850,29 @@
|
||||
"listTitle": "📋 **هەڵبژاردەکانی تراکت** ({{count}})",
|
||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||
"listHint": "`{{prefix}}trackopt play <alias>` بەکاربێنە بە جێبەجێکردنی دەرکردەیەکی ناوەند، یان `{{prefix}}trackopt remove [alias]` بۆ سڕینەوەی یەک."
|
||||
},
|
||||
"normalize": {
|
||||
"statusEnabled": "🔊 یەکسانسازیی دەنگی داینامیکی (ReplayGain) لەم سێرڤەرەدا **چالاکە**.",
|
||||
"statusDisabled": "🔇 یەکسانسازیی دەنگی داینامیکی (ReplayGain) لەم سێرڤەرەدا **ناچالاکە**.",
|
||||
"info": "کاتێک چالاک دەبێت، بەرزیی دەنگ بە شێوەیەکی داینامیکی بەپێی ستانداردی نێودەوڵەتی -14 LUFS ڕێکدەخرێت بۆ ئەوەی تراکە هێمن و بەرزەکان بە ئاستێکی هاوسەنگ لێبدرێن.",
|
||||
"trackInfo": "زانیاری تراکی ئێستا:\n• سەرچاوە: `{{source}}`\n• دەستکاریکردنی ئاست: `{{gainDb}} dB` ({{gainPct}}%)\n• ئاستی دەنگی کارا: `{{effective}}%`"
|
||||
},
|
||||
"bassboost": {
|
||||
"disabled": "🔇 بەرزکردنەوەی باس ناچالاک کرا — هاوسەنگی دەنگی سەرەتایی گەڕایەوە.",
|
||||
"applied": "🔊 **بەرزکردنەوەی باس ({{level}})** جێبەجێکرا! ئیكوالایزەر چالاکە.",
|
||||
"failed": "❌ جێبەجێکردنی بەرزکردنەوەی باس سەرکەوتوو نەبوو: {{reason}}"
|
||||
},
|
||||
"speed": {
|
||||
"reset": "⏩ خێرایی لێدان گەڕایەوە بۆ باری ئاسایی **1.0×**.",
|
||||
"current": "⏩ خێرایی لێدانی ئێستا: **{{speed}}×**.\nبۆ گۆڕینی خێرایی `{{prefix}}speed <0.5-2.0>` بەکاربهێنە.",
|
||||
"set": "{{emoji}} خێرایی لێدان دانرا لەسەر **{{speed}}×**.",
|
||||
"failed": "❌ گۆڕینی خێرایی سەرکەوتوو نەبوو: {{reason}}"
|
||||
},
|
||||
"pitch": {
|
||||
"reset": "🎵 تۆنی دەنگ گەڕایەوە بۆ باری ئاسایی **1.0×**.",
|
||||
"current": "🎵 تۆنی دەنگی ئێستا: **{{pitch}}×**.\nبۆ گۆڕینی تۆن `{{prefix}}pitch <0.5-2.0>` بەکاربهێنە.",
|
||||
"set": "🎵 تۆنی دەنگ دانرا لەسەر **{{pitch}}×**.",
|
||||
"failed": "❌ گۆڕینی تۆنی دەنگ سەرکەوتوو نەبوو: {{reason}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,11 @@
|
||||
"seek": "Springe zu einer bestimmten Position im aktuell spielenden Track.",
|
||||
"move": "Verschiebe einen Track von einer Position an eine andere in der Warteschlange.",
|
||||
"autoplay": "Schalte Autoplay um — spiele automatisch ähnliche Tracks, wenn die Warteschlange endet.",
|
||||
"trackopt": "Setze benutzerdefinierte Start-/Endzeiten für Tracks. Unterstützt benannte Aliase — speichere mehrere Schnitte pro Track für verschiedene Abschnitte."
|
||||
"trackopt": "Setze benutzerdefinierte Start-/Endzeiten für Tracks. Unterstützt benannte Aliase — speichere mehrere Schnitte pro Track für verschiedene Abschnitte.",
|
||||
"normalize": "Dynamische Lautstärkenormalisierung (ReplayGain-Pegel) über verschiedene Musikquellen umschalten.",
|
||||
"bassboost": "Equalizer-Bass-Boost mit Voreinstellungen (niedrig, mittel, stark) anwenden.",
|
||||
"speed": "Wiedergabegeschwindigkeit des aktuellen Tracks anpassen (0.5× bis 2.0×).",
|
||||
"pitch": "Tonhöhe (Pitch) des aktuellen Tracks anpassen (0.5× bis 2.0×)."
|
||||
},
|
||||
"options": {
|
||||
"debug": {
|
||||
@@ -162,6 +166,18 @@
|
||||
},
|
||||
"trackopt": {
|
||||
"times": "Start- und optionale Endzeit, z.B. '0:30' oder '0:30 3:45'"
|
||||
},
|
||||
"normalize": {
|
||||
"state": "Ein-/ausschalten oder Status prüfen ('on', 'off', 'status'). Leer lassen zum Umschalten."
|
||||
},
|
||||
"bassboost": {
|
||||
"level": "Bass-Boost-Stufe: 'low', 'medium', 'hard' oder 'off'."
|
||||
},
|
||||
"speed": {
|
||||
"rate": "Geschwindigkeitsmultiplikator zwischen 0.5 und 2.0 (z. B. 1.25). Leer lassen für 1.0×."
|
||||
},
|
||||
"pitch": {
|
||||
"pitch": "Tonhöhenmultiplikator zwischen 0.5 und 2.0 (z. B. 1.25). Leer lassen für 1.0×."
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
@@ -513,6 +529,7 @@
|
||||
"labelPfp": "Bot-Avatar-Stil",
|
||||
"labelLocale": "Sprache",
|
||||
"labelVolume": "Standardlautstärke",
|
||||
"labelNormalize": "Lautstärkenormalisierung",
|
||||
"labelVoteSkip": "Abstimmung zum Überspringen",
|
||||
"labelVoteSkipThreshold": "Schwellenwert für Skip-Abstimmung",
|
||||
"labelAnnouncementChannel": "Ankündigungskanal",
|
||||
@@ -594,13 +611,21 @@
|
||||
},
|
||||
"stats": {
|
||||
"title": "Remix Musik-Bot",
|
||||
"categoryOverview": "📊 Übersicht",
|
||||
"categoryMusic": "🎧 Musik-Aktivität",
|
||||
"categoryLastfm": "🎵 Last.fm",
|
||||
"categoryPerformance": "⚡ System & Netzwerk",
|
||||
"servers": "📂 **Server**",
|
||||
"users": "👥 **Benutzer**",
|
||||
"players": "🎧 **Player**",
|
||||
"playersWithPlaying": "{{total}} ({{playing}} aktiv)",
|
||||
"queuedTracks": "🎶 **Warteschlangen-Titel**",
|
||||
"radios": "📻 **24/7-Radios**",
|
||||
"scrobbles": "🎵 **Scrobbles**",
|
||||
"linkedUsers": "🔗 **Verknüpfte Last.fm**",
|
||||
"ping": "🏓 **Ping**",
|
||||
"gateway": "🌐 **Gateway**",
|
||||
"shard": "🧩 **Shard**",
|
||||
"uptime": "⏱️ **Uptime**",
|
||||
"build": "🔧 **Build**",
|
||||
"lastRestart": "🪛 **Letzter Neustart**",
|
||||
@@ -825,6 +850,29 @@
|
||||
"listTitle": "📋 **Deine Track-Optionen** ({{count}})",
|
||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||
"listHint": "Verwende `{{prefix}}trackopt play <alias>`, um einen benannten Trim anzuwenden, oder `{{prefix}}trackopt remove [alias]`, um einen zu löschen."
|
||||
},
|
||||
"normalize": {
|
||||
"statusEnabled": "🔊 Dynamische Lautstärkenormalisierung (ReplayGain) ist für diesen Server derzeit **Aktiviert**.",
|
||||
"statusDisabled": "🔇 Dynamische Lautstärkenormalisierung (ReplayGain) ist für diesen Server derzeit **Deaktiviert**.",
|
||||
"info": "Wenn aktiviert, wird die Lautstärke dynamisch an den internationalen Standard von -14 LUFS angepasst, sodass leise akustische Lieder und laute Tracks mit ausgeglichener Lautstärke spielen.",
|
||||
"trackInfo": "Aktuelle Track-Info:\n• Quelle: `{{source}}`\n• Verstärkungsanpassung: `{{gainDb}} dB` ({{gainPct}}%)\n• Effektive Lautstärke: `{{effective}}%`"
|
||||
},
|
||||
"bassboost": {
|
||||
"disabled": "🔇 Bass-Boost deaktiviert — ursprüngliche Audiobalance wiederhergestellt.",
|
||||
"applied": "🔊 **Bass-Boost ({{level}})** angewendet! Echtzeit-Equalizer aktiv.",
|
||||
"failed": "❌ Bass-Boost konnte nicht angewendet werden: {{reason}}"
|
||||
},
|
||||
"speed": {
|
||||
"reset": "⏩ Wiedergabegeschwindigkeit auf normale **1.0×** zurückgesetzt.",
|
||||
"current": "⏩ Aktuelle Wiedergabegeschwindigkeit: **{{speed}}×**.\nVerwende `{{prefix}}speed <0.5-2.0>`, um die Geschwindigkeit zu ändern.",
|
||||
"set": "{{emoji}} Wiedergabegeschwindigkeit auf **{{speed}}×** gesetzt.",
|
||||
"failed": "❌ Geschwindigkeit konnte nicht geändert werden: {{reason}}"
|
||||
},
|
||||
"pitch": {
|
||||
"reset": "🎵 Tonhöhe auf normale **1.0×** zurückgesetzt.",
|
||||
"current": "🎵 Aktuelle Tonhöhe: **{{pitch}}×**.\nVerwende `{{prefix}}pitch <0.5-2.0>`, um die Tonhöhe zu ändern.",
|
||||
"set": "🎵 Tonhöhe auf **{{pitch}}×** gesetzt.",
|
||||
"failed": "❌ Tonhöhe konnte nicht geändert werden: {{reason}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,11 @@
|
||||
"seek": "Seek to a specific position in the currently playing track.",
|
||||
"move": "Move a track from one position to another in the queue.",
|
||||
"autoplay": "Toggle autoplay — automatically play similar tracks when the queue ends.",
|
||||
"trackopt": "Set custom start/end times for tracks. Supports named aliases — save multiple trims per track for different sections."
|
||||
"trackopt": "Set custom start/end times for tracks. Supports named aliases — save multiple trims per track for different sections.",
|
||||
"normalize": "Toggle dynamic volume normalization (ReplayGain leveling) across music sources.",
|
||||
"bassboost": "Apply a low, medium, or hard bass boost equalizer effect.",
|
||||
"speed": "Adjust the playback speed of the current track (0.5× to 2.0×).",
|
||||
"pitch": "Adjust the audio pitch of the current track (0.5× to 2.0×)."
|
||||
},
|
||||
"options": {
|
||||
"debug": {
|
||||
@@ -162,6 +166,18 @@
|
||||
},
|
||||
"trackopt": {
|
||||
"times": "Start and optional end time, e.g. '0:30' or '0:30 3:45'"
|
||||
},
|
||||
"normalize": {
|
||||
"state": "Turn on/off or check status ('on', 'off', 'status'). Omit to toggle."
|
||||
},
|
||||
"bassboost": {
|
||||
"level": "Bass boost level: 'low', 'medium', 'hard', or 'off'."
|
||||
},
|
||||
"speed": {
|
||||
"rate": "Playback speed multiplier between 0.5 and 2.0 (e.g. 1.25). Omit to reset to 1.0×."
|
||||
},
|
||||
"pitch": {
|
||||
"pitch": "Audio pitch multiplier between 0.5 and 2.0 (e.g. 1.25). Omit to reset to 1.0×."
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
@@ -630,6 +646,7 @@
|
||||
"labelPfp": "Bot avatar style",
|
||||
"labelLocale": "Locale",
|
||||
"labelVolume": "Default volume",
|
||||
"labelNormalize": "Volume normalization",
|
||||
"labelVoteSkip": "Vote to skip",
|
||||
"labelVoteSkipThreshold": "Vote to skip threshold",
|
||||
"labelAnnouncementChannel": "Announcement channel",
|
||||
@@ -711,13 +728,21 @@
|
||||
},
|
||||
"stats": {
|
||||
"title": "Remix Music Bot",
|
||||
"categoryOverview": "📊 Overview",
|
||||
"categoryMusic": "🎧 Music Activity",
|
||||
"categoryLastfm": "🎵 Last.fm",
|
||||
"categoryPerformance": "⚡ System & Network",
|
||||
"servers": "📂 **Servers**",
|
||||
"users": "👥 **Users**",
|
||||
"players": "🎧 **Players**",
|
||||
"playersWithPlaying": "{{total}} ({{playing}} playing)",
|
||||
"queuedTracks": "🎶 **Queued Tracks**",
|
||||
"radios": "📻 **24/7 Radios**",
|
||||
"scrobbles": "🎵 **Scrobbles**",
|
||||
"linkedUsers": "🔗 **Linked Last.fm**",
|
||||
"ping": "🏓 **Ping**",
|
||||
"gateway": "🌐 **Gateway**",
|
||||
"shard": "🧩 **Shard**",
|
||||
"uptime": "⏱️ **Uptime**",
|
||||
"build": "🔧 **Build**",
|
||||
"lastRestart": "🪛 **Last restart**",
|
||||
@@ -825,6 +850,29 @@
|
||||
"listTitle": "📋 **Your Track Options** ({{count}})",
|
||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||
"listHint": "Use `{{prefix}}trackopt play <alias>` to apply a named trim, or `{{prefix}}trackopt remove [alias]` to delete one."
|
||||
},
|
||||
"normalize": {
|
||||
"statusEnabled": "🔊 Volume normalization (ReplayGain) is currently **Enabled** for this server.",
|
||||
"statusDisabled": "🔇 Volume normalization (ReplayGain) is currently **Disabled** for this server.",
|
||||
"info": "When enabled, playback loudness is dynamically leveled to the international -14 LUFS standard so quiet acoustic songs and loud EDM/SoundCloud tracks play at a balanced listening volume.",
|
||||
"trackInfo": "Current Track Info:\n• Source: `{{source}}`\n• Gain adjustment: `{{gainDb}} dB` ({{gainPct}}%)\n• Effective volume: `{{effective}}%`"
|
||||
},
|
||||
"bassboost": {
|
||||
"disabled": "🔇 Bass boost disabled — restored original audio balance.",
|
||||
"applied": "🔊 Applied **Bass Boost ({{level}})**! Real-time equalizer active.",
|
||||
"failed": "❌ Failed to apply bass boost: {{reason}}"
|
||||
},
|
||||
"speed": {
|
||||
"reset": "⏩ Playback speed reset to normal **1.0×**.",
|
||||
"current": "⏩ Current playback speed: **{{speed}}×**.\nUse `{{prefix}}speed <0.5-2.0>` to change playback speed.",
|
||||
"set": "{{emoji}} Playback speed set to **{{speed}}×**.",
|
||||
"failed": "❌ Failed to adjust speed: {{reason}}"
|
||||
},
|
||||
"pitch": {
|
||||
"reset": "🎵 Audio pitch reset to normal **1.0×**.",
|
||||
"current": "🎵 Current audio pitch: **{{pitch}}×**.\nUse `{{prefix}}pitch <0.5-2.0>` to change pitch.",
|
||||
"set": "🎵 Audio pitch set to **{{pitch}}×**.",
|
||||
"failed": "❌ Failed to adjust pitch: {{reason}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,11 @@
|
||||
"seek": "Vá para uma posição específica na faixa que está tocando.",
|
||||
"move": "Mova uma faixa de uma posição para outra na fila.",
|
||||
"autoplay": "Alterne o autoplay — toque faixas similares automaticamente quando a fila terminar.",
|
||||
"trackopt": "Defina horários de início/fim personalizados para faixas. Suporta aliases nomeados — salve múltiplos recortes por faixa para diferentes seções."
|
||||
"trackopt": "Defina horários de início/fim personalizados para faixas. Suporta aliases nomeados — salve múltiplos recortes por faixa para diferentes seções.",
|
||||
"normalize": "Alternar normalização dinâmica de volume (nivelamento ReplayGain) entre diferentes fontes de música.",
|
||||
"bassboost": "Aplicar equalizador de reforço de graves (baixo, médio ou pesado).",
|
||||
"speed": "Ajustar a velocidade de reprodução da faixa atual (0.5× a 2.0×).",
|
||||
"pitch": "Ajustar o tom (pitch) do áudio da faixa atual (0.5× a 2.0×)."
|
||||
},
|
||||
"options": {
|
||||
"debug": {
|
||||
@@ -162,6 +166,18 @@
|
||||
},
|
||||
"trackopt": {
|
||||
"times": "Horário de início e fim opcional, ex: '0:30' ou '0:30 3:45'"
|
||||
},
|
||||
"normalize": {
|
||||
"state": "Ativar/desativar ou verificar status ('on', 'off', 'status'). Omita para alternar."
|
||||
},
|
||||
"bassboost": {
|
||||
"level": "Nível de reforço de graves: 'low', 'medium', 'hard' ou 'off'."
|
||||
},
|
||||
"speed": {
|
||||
"rate": "Multiplicador de velocidade entre 0.5 e 2.0 (ex: 1.25). Omita para redefinir para 1.0×."
|
||||
},
|
||||
"pitch": {
|
||||
"pitch": "Multiplicador de tom entre 0.5 e 2.0 (ex: 1.25). Omita para redefinir para 1.0×."
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
@@ -513,6 +529,7 @@
|
||||
"labelPfp": "Estilo do avatar do bot",
|
||||
"labelLocale": "Idioma",
|
||||
"labelVolume": "Volume padrão",
|
||||
"labelNormalize": "Normalização de volume",
|
||||
"labelVoteSkip": "Votação para pular",
|
||||
"labelVoteSkipThreshold": "Limite de votação para pular",
|
||||
"labelAnnouncementChannel": "Canal de anúncios",
|
||||
@@ -594,13 +611,21 @@
|
||||
},
|
||||
"stats": {
|
||||
"title": "Bot de Música Remix",
|
||||
"categoryOverview": "📊 Visão Geral",
|
||||
"categoryMusic": "🎧 Atividade Musical",
|
||||
"categoryLastfm": "🎵 Last.fm",
|
||||
"categoryPerformance": "⚡ Sistema e Rede",
|
||||
"servers": "📂 **Servidores**",
|
||||
"users": "👥 **Usuários**",
|
||||
"players": "🎧 **Players**",
|
||||
"playersWithPlaying": "{{total}} ({{playing}} tocando)",
|
||||
"queuedTracks": "🎶 **Músicas na Fila**",
|
||||
"radios": "📻 **Rádios 24/7**",
|
||||
"scrobbles": "🎵 **Scrobbles**",
|
||||
"linkedUsers": "🔗 **Last.fm Vinculadas**",
|
||||
"ping": "🏓 **Ping**",
|
||||
"gateway": "🌐 **Gateway**",
|
||||
"shard": "🧩 **Shard**",
|
||||
"uptime": "⏱️ **Tempo de Atividade**",
|
||||
"build": "🔧 **Build**",
|
||||
"lastRestart": "🪛 **Último Reinício**",
|
||||
@@ -825,6 +850,29 @@
|
||||
"listTitle": "📋 **Suas Opções de Faixa** ({{count}})",
|
||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||
"listHint": "Use `{{prefix}}trackopt play <alias>` para aplicar um recorte nomeado, ou `{{prefix}}trackopt remove [alias]` para excluir um."
|
||||
},
|
||||
"normalize": {
|
||||
"statusEnabled": "🔊 A normalização dinâmica de volume (ReplayGain) está atualmente **Ativada** para este servidor.",
|
||||
"statusDisabled": "🔇 A normalização dinâmica de volume (ReplayGain) está atualmente **Desativada** para este servidor.",
|
||||
"info": "Quando ativado, o volume de reprodução é nivelado dinamicamente para o padrão internacional de -14 LUFS, equilibrando faixas acústicas suaves e faixas com masterização pesada.",
|
||||
"trackInfo": "Informações da faixa atual:\n• Fonte: `{{source}}`\n• Ajuste de ganho: `{{gainDb}} dB` ({{gainPct}}%)\n• Volume efetivo: `{{effective}}%`"
|
||||
},
|
||||
"bassboost": {
|
||||
"disabled": "🔇 Reforço de graves desativado — equilíbrio de áudio original restaurado.",
|
||||
"applied": "🔊 **Reforço de Graves ({{level}})** aplicado! Equalizador em tempo real ativo.",
|
||||
"failed": "❌ Falha ao aplicar reforço de graves: {{reason}}"
|
||||
},
|
||||
"speed": {
|
||||
"reset": "⏩ Velocidade de reprodução redefinida para **1.0×** normal.",
|
||||
"current": "⏩ Velocidade de reprodução atual: **{{speed}}×**.\nUse `{{prefix}}speed <0.5-2.0>` para alterar a velocidade.",
|
||||
"set": "{{emoji}} Velocidade de reprodução definida para **{{speed}}×**.",
|
||||
"failed": "❌ Falha ao ajustar velocidade: {{reason}}"
|
||||
},
|
||||
"pitch": {
|
||||
"reset": "🎵 Tom de áudio redefinido para **1.0×** normal.",
|
||||
"current": "🎵 Tom de áudio atual: **{{pitch}}×**.\nUse `{{prefix}}pitch <0.5-2.0>` para alterar o tom.",
|
||||
"set": "🎵 Tom de áudio definido para **{{pitch}}×**.",
|
||||
"failed": "❌ Falha ao ajustar tom: {{reason}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,10 @@
|
||||
"move": "Kuyrukta bir parçayı bir konumdan diğerine taşıyın.",
|
||||
"autoplay": "Otomatik çalmayı açın/kapatın — kuyruk bittiğinde benzer parçaları otomatik olarak çalar.",
|
||||
"trackopt": "Parçalar için özel başlangıç/bitiş süreleri ayarlayın. Adlandırılmış kısayolları destekler — her parça için farklı bölümlerde birden fazla kırpma kaydedin.",
|
||||
"normalize": "Müzik kaynakları arasında dinamik ses normalleştirmesini (ReplayGain seviyeleme) açın/kapatın.",
|
||||
"bassboost": "Düşük, orta veya sert bas güçlendirme ekolayzer efekti uygulayın.",
|
||||
"speed": "Mevcut parçanın oynatma hızını ayarlayın (0.5× ile 2.0× arası).",
|
||||
"pitch": "Mevcut parçanın ses perdesini (pitch) ayarlayın (0.5× ile 2.0× arası).",
|
||||
"vote": "FluxerList üzerinde sunucunuz/botunuz için oylama bilgilerini görüntüleyin veya oy verenleri kontrol edin"
|
||||
},
|
||||
"options": {
|
||||
@@ -159,6 +163,18 @@
|
||||
"trackopt": {
|
||||
"times": "Başlangıç ve isteğe bağlı bitiş süresi, örn. '0:30' veya '0:30 3:45'"
|
||||
},
|
||||
"normalize": {
|
||||
"state": "Açın/kapatın veya durumu kontrol edin ('on', 'off', 'status'). Değiştirmek için boş bırakın."
|
||||
},
|
||||
"bassboost": {
|
||||
"level": "Bas güçlendirme seviyesi: 'low', 'medium', 'hard' veya 'off'."
|
||||
},
|
||||
"speed": {
|
||||
"rate": "0.5 ile 2.0 arasında oynatma hızı çarpanı (ör. 1.25). 1.0× yapmak için boş bırakın."
|
||||
},
|
||||
"pitch": {
|
||||
"pitch": "0.5 ile 2.0 arasında ses perdesi çarpanı (ör. 1.25). 1.0× yapmak için boş bırakın."
|
||||
},
|
||||
"vote": {
|
||||
"action": "Yapılacak işlem: info, check, voters",
|
||||
"type": "Kaynak türü: sunucu veya bot"
|
||||
@@ -663,6 +679,7 @@
|
||||
"labelPfp": "Bot avatar stili",
|
||||
"labelLocale": "Yerel ayar",
|
||||
"labelVolume": "Varsayılan ses",
|
||||
"labelNormalize": "Ses normalleştirme",
|
||||
"labelVoteSkip": "Atlama oylaması",
|
||||
"labelVoteSkipThreshold": "Atlama oylaması eşiği",
|
||||
"labelAnnouncementChannel": "Duyuru kanalı",
|
||||
@@ -700,13 +717,21 @@
|
||||
},
|
||||
"stats": {
|
||||
"title": "Remix Müzik Botu",
|
||||
"categoryOverview": "📊 Genel Bakış",
|
||||
"categoryMusic": "🎧 Müzik Aktivitesi",
|
||||
"categoryLastfm": "🎵 Last.fm",
|
||||
"categoryPerformance": "⚡ Sistem ve Ağ",
|
||||
"servers": "📂 **Sunucular**",
|
||||
"users": "👥 **Kullanıcılar**",
|
||||
"players": "🎧 **Oynatıcılar**",
|
||||
"playersWithPlaying": "{{total}} ({{playing}} çalıyor)",
|
||||
"queuedTracks": "🎶 **Kuyruktaki Parçalar**",
|
||||
"radios": "📻 **24/7 Radyolar**",
|
||||
"scrobbles": "🎵 **Scrobble'lar**",
|
||||
"linkedUsers": "🔗 **Bağlı Last.fm**",
|
||||
"ping": "🏓 **Ping**",
|
||||
"gateway": "🌐 **Gateway**",
|
||||
"shard": "🧩 **Shard**",
|
||||
"uptime": "⏱️ **Çalışma Süresi**",
|
||||
"build": "🔧 **Yapı**",
|
||||
"lastRestart": "🪛 **Son yeniden başlatma**",
|
||||
@@ -786,6 +811,29 @@
|
||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||
"listHint": "Adlandırılmış bir kırpma uygulamak için `{{prefix}}trackopt play <kısayol>` veya birini silmek için `{{prefix}}trackopt remove [kısayol]` kullanın."
|
||||
},
|
||||
"normalize": {
|
||||
"statusEnabled": "🔊 Dinamik ses normalleştirmesi (ReplayGain) bu sunucu için şu anda **Etkin**.",
|
||||
"statusDisabled": "🔇 Dinamik ses normalleştirmesi (ReplayGain) bu sunucu için şu anda **Devre Dışı**.",
|
||||
"info": "Etkinleştirildiğinde, çalma ses yüksekliği uluslararası -14 LUFS standardına göre dinamik olarak dengelenir, böylece sessiz akustik parçalar ve yüksek sesli parçalar dengeli bir dinleme seviyesinde çalar.",
|
||||
"trackInfo": "Mevcut Parça Bilgisi:\n• Kaynak: `{{source}}`\n• Kazanç ayarı: `{{gainDb}} dB` ({{gainPct}}%)\n• Etkili ses seviyesi: `{{effective}}%`"
|
||||
},
|
||||
"bassboost": {
|
||||
"disabled": "🔇 Bas güçlendirme devre dışı bırakıldı — orijinal ses dengesi geri yüklendi.",
|
||||
"applied": "🔊 **Bas Güçlendirme ({{level}})** uygulandı! Gerçek zamanlı ekolayzer aktif.",
|
||||
"failed": "❌ Bas güçlendirme uygulanamadı: {{reason}}"
|
||||
},
|
||||
"speed": {
|
||||
"reset": "⏩ Oynatma hızı normal **1.0×** seviyesine sıfırlandı.",
|
||||
"current": "⏩ Mevcut oynatma hızı: **{{speed}}×**.\nHızı değiştirmek için `{{prefix}}speed <0.5-2.0>` kullanın.",
|
||||
"set": "{{emoji}} Oynatma hızı **{{speed}}×** olarak ayarlandı.",
|
||||
"failed": "❌ Hız ayarlanamadı: {{reason}}"
|
||||
},
|
||||
"pitch": {
|
||||
"reset": "🎵 Ses perdesi normal **1.0×** seviyesine sıfırlandı.",
|
||||
"current": "🎵 Mevcut ses perdesi: **{{pitch}}×**.\nPerdeyi değiştirmek için `{{prefix}}pitch <0.5-2.0>` kullanın.",
|
||||
"set": "🎵 Ses perdesi **{{pitch}}×** olarak ayarlandı.",
|
||||
"failed": "❌ Ses perdesi ayarlanamadı: {{reason}}"
|
||||
},
|
||||
"gateway": {
|
||||
"missingPermsFallback": "⚠️ Düzgün çalışmak için ihtiyacım olan izinler eksik! Eksik: **{{perms}}**. Lütfen bir sunucu yöneticisinden bu izinleri Sunucu Ayarları → Roller'den vermesini isteyin."
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user