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 }
|
"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.
|
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
|
- **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
|
- **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
|
- **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
|
- **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
|
- **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
|
- **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`)
|
- **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` |
|
| `lyrics` | Display synced lyrics from NodeLink | `%lyrics` | `lyric`, `ly` |
|
||||||
| `thumbnail` | Get the thumbnail of the current track | `%thumbnail` | `thumb` |
|
| `thumbnail` | Get the thumbnail of the current track | `%thumbnail` | `thumb` |
|
||||||
| `radio` | Play a built-in or custom radio station | `%radio` | `r` |
|
| `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` | |
|
| `player` | Create an interactive emoji control panel with live progress | `%player` | |
|
||||||
| `join` | Make the bot join a specific voice channel | `%join 123456789` | |
|
| `join` | Make the bot join a specific voice channel | `%join 123456789` | |
|
||||||
| `leave` | Make the bot leave the current voice channel | `%leave` | `l`, `stop` |
|
| `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 |
|
| 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` |
|
| `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` |
|
| `invite` | Get the bot invite link | `%invite` | `addbot`, `remix` |
|
||||||
| `support` | Get an invite to the support server | `%support` | `server` |
|
| `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` |
|
| `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` | |
|
| `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` | |
|
| `reload` | Reload commands or modules at runtime (owner) | `%reload` | |
|
||||||
| `servers` | List servers the bot is in (owner) | `%servers` | |
|
| `servers` | List servers the bot is in (owner) | `%servers` | |
|
||||||
| `eval` | Evaluate JavaScript (owner only) | `%eval 1+1` | |
|
| `eval` | Evaluate JavaScript (owner only) | `%eval 1+1` | |
|
||||||
@@ -403,6 +411,7 @@ Key configuration options in `config.json`:
|
|||||||
| Option | Type | Default | Description |
|
| Option | Type | Default | Description |
|
||||||
| :--- | :--- | :--- | :--- |
|
| :--- | :--- | :--- | :--- |
|
||||||
| `token` | string | — | **Required.** Fluxer bot token |
|
| `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 |
|
| `prefix` | string | `%` | Default command prefix |
|
||||||
| `embedColor` | string | `0xe9196c` | Hex color for embed messages |
|
| `embedColor` | string | `0xe9196c` | Hex color for embed messages |
|
||||||
| `owners` | string[] | `[]` | User IDs with owner privileges |
|
| `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 |
|
| `customStatsFooter` | string | — | Custom text shown in the `%stats` embed footer |
|
||||||
| `presenceInterval` | number | `30000` | Interval in ms for rotating bot presence status |
|
| `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`) |
|
| `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`) |
|
| `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`) |
|
| `lastfm` | object | — | Last.fm integration (`apiKey`, `apiSecret`, `scrobbleThreshold`, `scrobbleMinMs`) |
|
||||||
| `fluxerlist` | object | — | FluxerList integration (`apiKey`, `serverId`, `botId`, `serverSlug`, `botSlug`) |
|
| `fluxerlist` | object | — | FluxerList integration (`apiKey`, `serverId`, `botId`, `serverSlug`, `botSlug`) |
|
||||||
| `dashboard` | object | — | Dashboard backend: `enabled`, `redis.url` |
|
| `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 |
|
| `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`) |
|
| `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` |
|
| `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`) |
|
| `fluxer.js` | object | — | Fluxer.js REST options (`timeout`, `retries`) |
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -432,7 +445,7 @@ fluxer/
|
|||||||
│ # one child process per shard slice, each running index.mjs
|
│ # one child process per shard slice, each running index.mjs
|
||||||
├── config_example.json # Configuration template
|
├── config_example.json # Configuration template
|
||||||
├── package.json
|
├── 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
|
│ │ # largest (lastfm, settings, debug) are split into action-family
|
||||||
│ │ # modules inside commands/<name>/ subdirectories
|
│ │ # modules inside commands/<name>/ subdirectories
|
||||||
│ ├── lastfm/ # lastfm action families (account, playback, listening,
|
│ ├── lastfm/ # lastfm action families (account, playback, listening,
|
||||||
@@ -511,6 +524,7 @@ fluxer/
|
|||||||
│ ├── constants.mjs # Signed API-call plumbing
|
│ ├── constants.mjs # Signed API-call plumbing
|
||||||
│ └── urlUtils.mjs # lastfm:// URL parsing
|
│ └── urlUtils.mjs # lastfm:// URL parsing
|
||||||
├── db/ # Persistence
|
├── db/ # Persistence
|
||||||
|
│ ├── PoolManager.mjs # Unified MySQL pool manager (callback & promise APIs)
|
||||||
│ ├── Settings.mjs # SettingsManager / ServerSettings / RemoteSettingsManager
|
│ ├── Settings.mjs # SettingsManager / ServerSettings / RemoteSettingsManager
|
||||||
│ │ # (MySQL-backed, debounced JSON_SET writes)
|
│ │ # (MySQL-backed, debounced JSON_SET writes)
|
||||||
│ └── DatabaseManager.mjs # mysql2 pool + parameterized queries + bcrypt helpers
|
│ └── 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()
|
export const command = new CommandBuilder()
|
||||||
.setName("clear")
|
.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")
|
.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.
|
* 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} msg - The command message wrapper.
|
||||||
|
* @param {object} [data] - Parsed options.
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
export async function run(msg) {
|
export async function run(msg, data) {
|
||||||
const p = await this.getPlayer(msg, false, false, false);
|
const p = await this.getPlayer(msg, false, false, false);
|
||||||
if (!p) return;
|
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();
|
p.clear();
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(getGlobalColor())
|
.setColor(getGlobalColor())
|
||||||
|
|||||||
@@ -20,6 +20,20 @@ const FILTERS = [
|
|||||||
desc: "Remove all filters — restore original audio",
|
desc: "Remove all filters — restore original audio",
|
||||||
payload: {},
|
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: "🔊",
|
emoji: "🔊",
|
||||||
key: "bassboost",
|
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: "🌙",
|
emoji: "🌙",
|
||||||
key: "nightcore",
|
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. */
|
/** @type {CommandBuilder} @description Command definition for the lyrics command. */
|
||||||
export const command = new CommandBuilder()
|
export const command = new CommandBuilder()
|
||||||
.setName("lyrics")
|
.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")
|
.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. */
|
/** @private @type {string[]} Loading animation frames. */
|
||||||
const LOADING_FRAMES = ["◐", "◓", "◑", "◒"];
|
const LOADING_FRAMES = ["◐", "◓", "◑", "◒"];
|
||||||
/** @private @type {number} Session timeout in milliseconds (3 minutes). */
|
/** @private @type {number} Session timeout in milliseconds (3 minutes). */
|
||||||
const SESSION_MS = 180_000;
|
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
|
* @async
|
||||||
* Run handler for the lyrics command.
|
* Run handler for the lyrics command.
|
||||||
* Fetches lyrics for the currently playing track and displays them with
|
* Fetches lyrics for the currently playing track and displays them with
|
||||||
* paginated embeds and reaction-based navigation.
|
* paginated embeds and reaction-based navigation.
|
||||||
* @param {object} message - The command message wrapper.
|
* @param {object} message - The command message wrapper.
|
||||||
|
* @param {object} [data] - Parsed options.
|
||||||
* @returns {Promise<void>}
|
* @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);
|
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) {
|
if (!current) {
|
||||||
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(this.t(message, "responses.lyrics.nothingPlaying"));
|
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(this.t(message, "responses.lyrics.nothingPlaying"));
|
||||||
return message.reply({ embeds: [embed] });
|
return message.reply({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
|
searchTitle = current.title;
|
||||||
|
searchArtist = current.artists?.[0]?.name || current.author?.name || "Unknown Artist";
|
||||||
|
}
|
||||||
|
|
||||||
let frame = 0;
|
let frame = 0;
|
||||||
const loadingMsg = await message.reply({ embeds: [
|
const loadingMsg = await message.reply({ embeds: [
|
||||||
new EmbedBuilder().setColor(getGlobalColor())
|
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(() => {
|
const loadingInterval = setInterval(() => {
|
||||||
frame = (frame + 1) % LOADING_FRAMES.length;
|
frame = (frame + 1) % LOADING_FRAMES.length;
|
||||||
loadingMsg.edit({ embeds: [
|
loadingMsg.edit({ embeds: [
|
||||||
new EmbedBuilder().setColor(getGlobalColor())
|
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(() => {});
|
] }).catch(() => {});
|
||||||
}, 800);
|
}, 800);
|
||||||
|
|
||||||
try {
|
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);
|
clearInterval(loadingInterval);
|
||||||
|
|
||||||
@@ -65,7 +178,7 @@ export async function run(message) {
|
|||||||
return loadingMsg.edit({ embeds: [
|
return loadingMsg.edit({ embeds: [
|
||||||
new EmbedBuilder().setColor(getGlobalColor())
|
new EmbedBuilder().setColor(getGlobalColor())
|
||||||
.setDescription(
|
.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); }
|
try { await loadingMsg.message.delete(); } catch(e) { logger.warn("[Lyrics] Error:", e?.message); }
|
||||||
|
|
||||||
const syncIndicator = result.synced ? this.t(message, "responses.lyrics.syncedBadge") : "";
|
const syncIndicator = result.synced ? this.t(message, "responses.lyrics.syncedBadge") : "";
|
||||||
const displayTitle = Utils.cleanTitle(current.title);
|
const displayTitle = result.title || (current ? Utils.cleanTitle(current.title) : Utils.cleanTitle(searchTitle));
|
||||||
const artist = current.artists?.[0]?.name || current.author?.name || "Unknown Artist";
|
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 lines = result.text.split("\n").filter(l => l.trim());
|
||||||
const totalLines = lines.length;
|
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. */
|
/** @type {CommandBuilder} @description Command definition for the remove command. */
|
||||||
export const command = new CommandBuilder()
|
export const command = new CommandBuilder()
|
||||||
.setName("remove")
|
.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")
|
.setCategory("music")
|
||||||
.addNumberOption(opt =>
|
.addTextOption(opt =>
|
||||||
opt.setName("index")
|
opt.setName("position")
|
||||||
.setDescription("The position of the song in the queue. You can view the indices with the 'list' command", "options.remove.index")
|
.setDescription("The position or range of the song(s) to remove (e.g. `3` or `3-6`).", "options.remove.index")
|
||||||
.setRequired(true));
|
.setRequired(true));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @async
|
* @async
|
||||||
* Run handler for the remove command.
|
* 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} 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>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
export async function run(message, data) {
|
export async function run(message, data) {
|
||||||
const p = await this.getPlayer(message, false, false, false);
|
const p = await this.getPlayer(message, false, false, false);
|
||||||
if (!p) return;
|
if (!p) return;
|
||||||
const index = data.get("index")?.value;
|
const raw = String(data.get("position")?.value ?? "").trim();
|
||||||
if (index === null || index === undefined || index < 1) return message.replyEmbed("Queue position must be 1 or greater.").catch(() => {});
|
if (!raw) return message.replyEmbed("Please provide a queue position or range (e.g. `3` or `3-6`).").catch(() => {});
|
||||||
const res = p.remove(index - 1);
|
|
||||||
|
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(() => {});
|
message.replyEmbed(res).catch(() => {});
|
||||||
}
|
}
|
||||||
@@ -143,6 +143,7 @@ export async function run(msg, data) {
|
|||||||
await clearReactions();
|
await clearReactions();
|
||||||
|
|
||||||
if (e.emoji_id === CANCEL_EMOJI) {
|
if (e.emoji_id === CANCEL_EMOJI) {
|
||||||
|
p.searches.delete(msg.authorId);
|
||||||
rawMsg.edit({
|
rawMsg.edit({
|
||||||
embeds: [makeEmbed(this.t(msg, "responses.search.cancelled"), null, this.t(msg, "responses.search.resultsTitle", { provider: name }))]
|
embeds: [makeEmbed(this.t(msg, "responses.search.cancelled"), null, this.t(msg, "responses.search.resultsTitle", { provider: name }))]
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
@@ -167,6 +168,7 @@ export async function run(msg, data) {
|
|||||||
const SESSION_MS = this.config?.timers?.searchSessionTimeout ?? 30_000;
|
const SESSION_MS = this.config?.timers?.searchSessionTimeout ?? 30_000;
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
unobserve();
|
unobserve();
|
||||||
|
p.searches.delete(msg.authorId);
|
||||||
clearReactions().catch(() => {});
|
clearReactions().catch(() => {});
|
||||||
rawMsg.edit({
|
rawMsg.edit({
|
||||||
embeds: [makeEmbed(this.t(msg, "responses.search.timedOut"), this.t(msg, "responses.search.sessionClosed"), this.t(msg, "responses.search.resultsTitle", { provider: name }))]
|
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"))] });
|
return msg.reply({ embeds: [new EmbedBuilder().setColor(ERROR_COLOR).setDescription(this.t(msg, "responses.seek.live"))] });
|
||||||
}
|
}
|
||||||
|
|
||||||
let seekMs = Utils.parseDuration(positionInput);
|
const trimmed = String(positionInput ?? "").trim();
|
||||||
if (!seekMs || seekMs < 0) {
|
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"))] });
|
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 { EmbedBuilder } from "@fluxerjs/core";
|
||||||
import { getGlobalColor } from "../src/ui/index.mjs";
|
import { getGlobalColor } from "../src/ui/index.mjs";
|
||||||
import { logger } from "../src/core/Logger.mjs";
|
import { logger } from "../src/core/Logger.mjs";
|
||||||
|
import * as ShardingUtils from "../src/utils/ShardingUtils.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {CommandBuilder}
|
* @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
|
* @private
|
||||||
* @param {Map} playerMap - The player map from PlayerManager.
|
* @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) {
|
function getMusicStats(playerMap) {
|
||||||
let live = 0;
|
const uniquePlayers = new Set();
|
||||||
|
if (playerMap) {
|
||||||
for (const [mapKey, player] of playerMap ?? []) {
|
for (const player of playerMap.values()) {
|
||||||
if (!player || player._destroyed || player.leaving) continue;
|
if (!player || player._destroyed || player.leaving || player._isJoining) continue;
|
||||||
if (player._isJoining) continue;
|
|
||||||
|
|
||||||
const conn = player.connection;
|
const conn = player.connection;
|
||||||
if (conn) {
|
if (conn) {
|
||||||
const room = conn.room;
|
const room = conn.room;
|
||||||
@@ -249,38 +250,87 @@ function getLivePlayerCount(playerMap) {
|
|||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
uniquePlayers.add(player);
|
||||||
live++;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
* Resolve the current shard assignment string (e.g. "0/2" when sharded, or "0" in single-process mode).
|
||||||
* outdated locale files make translate() return the raw dot-notation key)
|
* @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.
|
* render the readable fallback instead of an ugly key path in the embed.
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} t - Translation function.
|
* @param {Function} t - Translation function.
|
||||||
* @param {object} msg - The command message wrapper.
|
* @param {object} msg - The command message wrapper.
|
||||||
* @param {string} key - Locale key.
|
* @param {string} key - Locale key.
|
||||||
* @param {string} fallback - Label used when the key is missing.
|
* @param {string} fallback - Label used when the key is missing.
|
||||||
|
* @param {object} [vars={}] - Optional interpolation variables.
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function tOr(t, msg, key, fallback) {
|
function tOr(t, msg, key, fallback, vars = {}) {
|
||||||
const value = t(msg, key);
|
const value = t(msg, key, vars);
|
||||||
return value === key ? fallback : value;
|
return value === key ? fallback : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the stats embed with all bot information.
|
* 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
|
* @private
|
||||||
* @param {Function} t - Translation function.
|
* @param {Function} t - Translation function.
|
||||||
* @param {object} msg - The command message wrapper.
|
* @param {object} msg - The command message wrapper.
|
||||||
* @param {object} s - Statistics data object.
|
* @param {object} s - Statistics data object.
|
||||||
* @param {number} s.guildCount - Number of guilds.
|
* @param {number} s.guildCount - Number of guilds.
|
||||||
* @param {number} s.userCount - Number of users.
|
* @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.scrobbleCount - Total Last.fm scrobbles.
|
||||||
* @param {number} s.linkedUsers - Number of Last.fm linked users.
|
* @param {number} s.linkedUsers - Number of Last.fm linked users.
|
||||||
* @param {number} s.ping - Bot response ping in ms (REST reply round trip).
|
* @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 num = (v) => Utils.formatNumber(v);
|
||||||
const field = (key, value) => `\`${pending.includes(key) ? "..." : value}\``;
|
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.servers")} — ${field("guilds", num(s.guildCount))}`,
|
||||||
`${t(msg, "responses.stats.users")} — ${field("users", num(s.userCount))}`,
|
`${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) {
|
if (s.lastfmEnabled) {
|
||||||
description.push(
|
const lastfmParts = [
|
||||||
`${t(msg, "responses.stats.scrobbles")} — ${field("scrobbles", num(s.scrobbleCount))}`,
|
`${t(msg, "responses.stats.scrobbles")} — ${field("scrobbles", num(s.scrobbleCount))}`,
|
||||||
`${t(msg, "responses.stats.linkedUsers")} — ${field("linkedUsers", num(s.linkedUsers))}`,
|
`${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`)}`,
|
`${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.uptime")} — \`${s.uptime}\``,
|
||||||
`${t(msg, "responses.stats.build")} — [\`${s.comHash}\`](${s.comLink})`,
|
];
|
||||||
s.reason ? `${t(msg, "responses.stats.lastRestart")} — \`${s.reason}\`` : null,
|
fields.push({
|
||||||
``,
|
name: tOr(t, msg, "responses.stats.categoryPerformance", "⚡ System & Network"),
|
||||||
t(msg, "responses.stats.supportKofi"),
|
value: perfLines.join("\n"),
|
||||||
t(msg, "responses.stats.community"),
|
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()
|
const builder = new EmbedBuilder()
|
||||||
.setColor(getGlobalColor())
|
.setColor(getGlobalColor())
|
||||||
.setAuthor({ name: t(msg, "responses.stats.title") })
|
.setAuthor(authorOptions)
|
||||||
.setDescription(desc)
|
|
||||||
.setFooter({ text: s.footer || t(msg, "responses.stats.title") });
|
.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();
|
if (typeof builder.setTimestamp === "function") builder.setTimestamp();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
@@ -349,6 +471,13 @@ export async function run(message) {
|
|||||||
const t = (...a) => this.t(...a);
|
const t = (...a) => this.t(...a);
|
||||||
|
|
||||||
const totals = getTotals(this.client);
|
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);
|
scheduleBackgroundRefresh(this.client, lastfmEnabled ? lastfm : null);
|
||||||
|
|
||||||
@@ -363,7 +492,12 @@ export async function run(message) {
|
|||||||
const embedData = {
|
const embedData = {
|
||||||
guildCount: totals.guildCount,
|
guildCount: totals.guildCount,
|
||||||
userCount: totals.userCount,
|
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,
|
scrobbleCount: lastfmEnabled ? (cache.scrobbles ?? 0) : 0,
|
||||||
linkedUsers: lastfmEnabled ? (cache.linkedUsers ?? 0) : 0,
|
linkedUsers: lastfmEnabled ? (cache.linkedUsers ?? 0) : 0,
|
||||||
lastfmEnabled,
|
lastfmEnabled,
|
||||||
@@ -406,10 +540,15 @@ export async function run(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fresh = getTotals(this.client);
|
const fresh = getTotals(this.client);
|
||||||
|
const freshMusic = getMusicStats(this.players?.playerMap);
|
||||||
const fill = {
|
const fill = {
|
||||||
...embedData,
|
...embedData,
|
||||||
guildCount: fresh.guildCount,
|
guildCount: fresh.guildCount,
|
||||||
userCount: fresh.userCount,
|
userCount: fresh.userCount,
|
||||||
|
playerCount: freshMusic.totalPlayers,
|
||||||
|
playingCount: freshMusic.playingCount,
|
||||||
|
queuedTracks: freshMusic.queuedTracks,
|
||||||
|
radios247: freshMusic.radios247,
|
||||||
scrobbleCount: lastfmEnabled ? (cache.scrobbles ?? 0) : 0,
|
scrobbleCount: lastfmEnabled ? (cache.scrobbles ?? 0) : 0,
|
||||||
linkedUsers: lastfmEnabled ? (cache.linkedUsers ?? 0) : 0,
|
linkedUsers: lastfmEnabled ? (cache.linkedUsers ?? 0) : 0,
|
||||||
ping: lastPing ?? 0,
|
ping: lastPing ?? 0,
|
||||||
|
|||||||
+3
-1
@@ -97,7 +97,9 @@
|
|||||||
"port": 3306,
|
"port": 3306,
|
||||||
"user": "youruser",
|
"user": "youruser",
|
||||||
"password": "password of your user",
|
"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": {
|
"dashboard": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
|
|||||||
+2
-2
@@ -36,8 +36,8 @@ USER 10001:10001
|
|||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
HEALTHCHECK --interval=15s --timeout=5s --start-period=45s --retries=3 \
|
||||||
CMD pgrep -f "node .*index.mjs" >/dev/null 2>&1 || pgrep -f "node .*shard.mjs" >/dev/null 2>&1 || exit 1
|
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"]
|
ENTRYPOINT ["/usr/bin/tini", "--", "/app/docker/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
"port": 3306,
|
"port": 3306,
|
||||||
"user": "remix",
|
"user": "remix",
|
||||||
"password": "remix_pw",
|
"password": "remix_pw",
|
||||||
"database": "remix"
|
"database": "remix",
|
||||||
|
"connectionLimit": 15
|
||||||
},
|
},
|
||||||
"nodelink": {
|
"nodelink": {
|
||||||
"host": "nodelink",
|
"host": "nodelink",
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ services:
|
|||||||
- TZ=${TZ:-UTC}
|
- TZ=${TZ:-UTC}
|
||||||
ports:
|
ports:
|
||||||
- "${WEB_PORT:-8080}:80"
|
- "${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:
|
networks:
|
||||||
- remix-net
|
- remix-net
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,12 @@
|
|||||||
"defaultSource": "ytmusic",
|
"defaultSource": "ytmusic",
|
||||||
"fallback": true
|
"fallback": true
|
||||||
},
|
},
|
||||||
|
"spotify": {
|
||||||
|
"playlistLoadLimit": 10
|
||||||
|
},
|
||||||
|
"soundcloud": {
|
||||||
|
"playlistLoadLimit": 10
|
||||||
|
},
|
||||||
"audio": {
|
"audio": {
|
||||||
"normalization": true
|
"normalization": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -140,60 +140,18 @@ process.on("uncaughtExceptionMonitor", (err, origin) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Graceful shutdown handler: destroys all active players, closes Lavalink,
|
* Graceful shutdown handler: flushes player queue snapshots to MySQL,
|
||||||
* Redis, and Dashboard DB connections, then exits.
|
* cleans up active players, services, and connections, then exits.
|
||||||
* @async
|
* @async
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
const saveAndExit = async () => {
|
const saveAndExit = async () => {
|
||||||
logger.recovery("\n[Shutdown] Cleaning up before exit...");
|
|
||||||
try {
|
try {
|
||||||
await remix.playerState?.saveAllFrom?.(remix.players);
|
if (remix?.gracefulShutdown) {
|
||||||
} catch (e) {
|
await remix.gracefulShutdown();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn("[Shutdown] Player cleanup error:", e?.message);
|
logger.error("[Shutdown] Error during graceful shutdown:", e?.message ?? e);
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { ShardingManager } from "@fluxerjs/sharding";
|
import { ShardingManager } from "@fluxerjs/sharding";
|
||||||
import { logger } from "./src/core/Logger.mjs";
|
import { logger } from "./src/core/Logger.mjs";
|
||||||
@@ -126,18 +128,58 @@ manager.on("error", (err) => {
|
|||||||
logger.error("[Sharding] Manager error:", err?.message ?? 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. */
|
* @param {string} sig - The received signal name. */
|
||||||
let shuttingDown = false;
|
let shuttingDown = false;
|
||||||
const shutdown = async (sig) => {
|
const shutdown = async (sig) => {
|
||||||
if (shuttingDown) return;
|
if (shuttingDown) return;
|
||||||
shuttingDown = true;
|
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 {
|
try {
|
||||||
await manager.destroy();
|
await manager.destroy();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn("[Sharding] destroy error:", e?.message);
|
logger.warn("[Sharding] destroy error:", e?.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
clearInterval(healthInterval);
|
||||||
|
fs.unlink(healthFile, () => {});
|
||||||
|
} catch (_) {}
|
||||||
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
};
|
};
|
||||||
process.once("SIGINT", () => shutdown("SIGINT"));
|
process.once("SIGINT", () => shutdown("SIGINT"));
|
||||||
|
|||||||
+129
-5
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import childProcess from "node:child_process";
|
import childProcess from "node:child_process";
|
||||||
import { Client, Events } from "@fluxerjs/core";
|
import { Client, Events } from "@fluxerjs/core";
|
||||||
@@ -20,6 +21,7 @@ import { resolveIsBotUser } from "../voice/VoiceStateResolver.mjs";
|
|||||||
import * as ShardingUtils from "../utils/ShardingUtils.mjs";
|
import * as ShardingUtils from "../utils/ShardingUtils.mjs";
|
||||||
import { RemoteSettingsManager } from "../db/Settings.mjs";
|
import { RemoteSettingsManager } from "../db/Settings.mjs";
|
||||||
import { PlayerStateStore } from "../db/PlayerStateStore.mjs";
|
import { PlayerStateStore } from "../db/PlayerStateStore.mjs";
|
||||||
|
import { getSharedMysqlPool, getSharedPromisePool, closeSharedMysqlPool } from "../db/PoolManager.mjs";
|
||||||
import { PlayerManager } from "../music/PlayerManager.mjs";
|
import { PlayerManager } from "../music/PlayerManager.mjs";
|
||||||
import { LavalinkManager } from "../music/LavalinkManager.mjs";
|
import { LavalinkManager } from "../music/LavalinkManager.mjs";
|
||||||
import { Dashboard } from "../dashboard/Dashboard.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 = new Locale(typeof config.prefix === "string" && config.prefix ? config.prefix : "%");
|
||||||
this.locale.load();
|
this.locale.load();
|
||||||
|
|
||||||
|
// Centralized MySQL connection pool (Issue #21)
|
||||||
|
const sharedPool = getSharedMysqlPool(config.mysql);
|
||||||
|
const sharedPromisePool = getSharedPromisePool(config.mysql);
|
||||||
|
|
||||||
this.dashboard = new Dashboard(this, {
|
this.dashboard = new Dashboard(this, {
|
||||||
enabled: config.dashboard?.enabled,
|
enabled: config.dashboard?.enabled,
|
||||||
redis: config.dashboard?.redis,
|
redis: config.dashboard?.redis,
|
||||||
mysql: config.mysql,
|
mysql: sharedPromisePool,
|
||||||
});
|
});
|
||||||
|
|
||||||
const presenceContents = config.presenceContents ?? [];
|
const presenceContents = config.presenceContents ?? [];
|
||||||
@@ -192,10 +198,10 @@ class Remix {
|
|||||||
const messages = new MessageHandler(this.client);
|
const messages = new MessageHandler(this.client);
|
||||||
this.messages = messages;
|
this.messages = messages;
|
||||||
|
|
||||||
const settings = new RemoteSettingsManager(config.mysql, "./storage/defaults.json");
|
const settings = new RemoteSettingsManager(sharedPool, "./storage/defaults.json");
|
||||||
this.settingsMgr = settings;
|
this.settingsMgr = settings;
|
||||||
|
|
||||||
this.playerState = new PlayerStateStore(settings.db);
|
this.playerState = new PlayerStateStore(sharedPool);
|
||||||
|
|
||||||
const configPrefix = config.prefix ?? null;
|
const configPrefix = config.prefix ?? null;
|
||||||
if (configPrefix && settings.defaults) {
|
if (configPrefix && settings.defaults) {
|
||||||
@@ -255,9 +261,28 @@ class Remix {
|
|||||||
this.gatewayHandler = new GatewayHandler(this);
|
this.gatewayHandler = new GatewayHandler(this);
|
||||||
this.gatewayHandler.setupEventHandlers();
|
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.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());
|
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 = new LavalinkManager(config.nodelink ?? {}, client, { id: botId, username: client.user?.username ?? "bot" });
|
||||||
this.lavalink.on("ready", () => {
|
this.lavalink.on("ready", () => {
|
||||||
logger.lavalink("[Lavalink] Session 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();
|
await this.lavalink.init();
|
||||||
this.playerContext.lavalink = this.lavalink;
|
this.playerContext.lavalink = this.lavalink;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gatewayHandler.onReady();
|
this.gatewayHandler.onReady();
|
||||||
|
this._hasBooted = true;
|
||||||
|
|
||||||
this.fluxerlist?.startAutoStats?.(client);
|
this.fluxerlist?.startAutoStats?.(client);
|
||||||
|
|
||||||
@@ -610,6 +644,96 @@ class Remix {
|
|||||||
logger.warn("[WS] Failed to attach WS error handlers:", e.message);
|
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);
|
applyMixins(Remix, BotVoiceMixin);
|
||||||
|
|||||||
@@ -556,6 +556,7 @@ const BotVoiceMixin = {
|
|||||||
logger.player(`[Restore] Guild ${guildId}: ${applied.count} track(s) restored, resuming at ${applied.pos}ms.`);
|
logger.player(`[Restore] Guild ${guildId}: ${applied.count} track(s) restored, resuming at ${applied.pos}ms.`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn(`[Restore] Failed to restore guild ${guildId}:`, e?.message ?? 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 { createPool } from "mysql2/promise";
|
||||||
import { logger } from "../core/Logger.mjs";
|
import { logger } from "../core/Logger.mjs";
|
||||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
||||||
|
import { getSharedPromisePool } from "./PoolManager.mjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -17,14 +18,19 @@ import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
|||||||
export class DatabaseManager {
|
export class DatabaseManager {
|
||||||
/**
|
/**
|
||||||
* Create a new 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) {
|
constructor(config) {
|
||||||
this.db = createPool({
|
if (config && typeof config.execute === "function") {
|
||||||
...MYSQL_POOL_DEFAULTS,
|
this.db = config;
|
||||||
connectionLimit: 15,
|
this._ownsPool = false;
|
||||||
...config,
|
} 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");
|
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>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
close() {
|
close() {
|
||||||
|
if (this._ownsPool && this.db?.end) {
|
||||||
return 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 mysql from "mysql2";
|
||||||
import { EventEmitter } from "node:events";
|
import { EventEmitter } from "node:events";
|
||||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "./MysqlGuard.mjs";
|
||||||
|
import { getSharedMysqlPool } from "./PoolManager.mjs";
|
||||||
import { logger } from "../core/Logger.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.
|
* 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} defaultsPath - Path to a JSON file with default values and descriptions.
|
||||||
* @param {string|null} [botId=null] - The bot user ID for multi-bot support.
|
* @param {string|null} [botId=null] - The bot user ID for multi-bot support.
|
||||||
*/
|
*/
|
||||||
constructor(config, defaultsPath, botId = null) {
|
constructor(config, defaultsPath, botId = null) {
|
||||||
super();
|
super();
|
||||||
this.botId = botId;
|
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");
|
attachMysqlPoolGuard(this.db, "DB");
|
||||||
this.db.on('error', (err) => {
|
this.db.on?.('error', (err) => {
|
||||||
logger.error('[DB] MySQL pool error:', err.code ?? err.message);
|
logger.error('[DB] MySQL pool error:', err.code ?? err.message);
|
||||||
});
|
});
|
||||||
if (defaultsPath) this.loadDefaultsSync(defaultsPath);
|
if (defaultsPath) this.loadDefaultsSync(defaultsPath);
|
||||||
@@ -219,7 +226,7 @@ export class RemoteSettingsManager extends SettingsManager {
|
|||||||
}
|
}
|
||||||
await Promise.allSettled(pendingServers.map(server => this._doSave(server)));
|
await Promise.allSettled(pendingServers.map(server => this._doSave(server)));
|
||||||
try {
|
try {
|
||||||
if (this.db?.end) {
|
if (this._ownsPool && this.db?.end) {
|
||||||
await new Promise(r => this.db.end(() => r()));
|
await new Promise(r => this.db.end(() => r()));
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ export class LavalinkManager extends EventEmitter {
|
|||||||
"[Lavalink] Node ready: " + node.id + " | session: " + this._sessionId
|
"[Lavalink] Node ready: " + node.id + " | session: " + this._sessionId
|
||||||
);
|
);
|
||||||
this.emit("ready", this._sessionId);
|
this.emit("ready", this._sessionId);
|
||||||
|
this.emit("nodeConnect", node);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"[Lavalink] nodeConnect handler error:",
|
"[Lavalink] nodeConnect handler error:",
|
||||||
@@ -425,6 +426,10 @@ export class LavalinkManager extends EventEmitter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.lavalink.on("nodeConnect", onNodeConnect);
|
this.lavalink.on("nodeConnect", onNodeConnect);
|
||||||
|
this.lavalink.on("nodeReconnect", (node) => {
|
||||||
|
onNodeConnect(node);
|
||||||
|
this.emit("nodeReconnect", node);
|
||||||
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!this._nodeConnected) {
|
if (!this._nodeConnected) {
|
||||||
|
|||||||
@@ -126,6 +126,21 @@ export class PlayerManager {
|
|||||||
return null;
|
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
|
* 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
|
* 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);
|
const seekMs = Math.floor((options.seekSeconds ?? 0) * 1000);
|
||||||
let durationMs = options.durationMs || 0;
|
let durationMs = options.durationMs || 0;
|
||||||
const filterPayload = options.filterPayload ?? null;
|
const filterPayload = options.filterPayload ?? null;
|
||||||
const loadstreamEnabled = isLoadstreamEnabled();
|
const loadstreamEnabled = isLoadstreamEnabled() || !!filterPayload;
|
||||||
|
|
||||||
if (filterPayload && !loadstreamEnabled) {
|
|
||||||
logger.warn("[AudioBridge] Audio filter ignored — the loadstream route is disabled (config.json -> audio.allowLoadstream). Playing unfiltered.");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// ── Route A: /v4/trackstream — primary path, never touches /v4/loadstream.
|
// ── 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._voiceConn || this.leaving) return;
|
||||||
|
|
||||||
if (this.preferredVolume !== 1 && this._voiceConn) {
|
if (this._voiceConn) {
|
||||||
try { this._voiceConn.setVolume(this.preferredVolume * 100); } catch(_) {}
|
const vol = this.getEffectiveVolume ? this.getEffectiveVolume(songData) : (this.preferredVolume * 100);
|
||||||
|
try { this._voiceConn.setVolume(vol); } catch(_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._voiceConn || this.leaving) return;
|
if (!this._voiceConn || this.leaving) return;
|
||||||
@@ -491,24 +492,24 @@ const PlaybackMixin = {
|
|||||||
return { ok: false, reason: "Player not bound to a guild." };
|
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();
|
const current = this.queue.getCurrent();
|
||||||
|
|
||||||
this.activeFilter = filterMeta ?? null;
|
this.activeFilter = filterMeta ?? null;
|
||||||
this.activeFilterPayload = filterMeta ? filterPayload : null;
|
this.activeFilterPayload = filterMeta && Object.keys(filterPayload || {}).length > 0 ? filterPayload : null;
|
||||||
this.emit("filter", this.activeFilter);
|
this.emit("filter", this.activeFilter);
|
||||||
|
|
||||||
if (!current?.encoded || !this._voiceConn) {
|
if (!current?.encoded || !this._voiceConn) {
|
||||||
return { ok: true, pending: true };
|
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 };
|
return { ok: true };
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -643,12 +644,27 @@ const PlaybackMixin = {
|
|||||||
* @this {import('./Player.mjs').Player}
|
* @this {import('./Player.mjs').Player}
|
||||||
* @returns {Promise<{text: string, source: string, synced: boolean, lines: Array}|null>}
|
* @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();
|
const current = this.queue.getCurrent();
|
||||||
if (!current) return null;
|
if (!current) return null;
|
||||||
|
query = this._buildLyricsQuery(current);
|
||||||
const query = this._buildLyricsQuery(current);
|
|
||||||
if (!query.title) return null;
|
if (!query.title) return null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this._fetchVerifiedLyrics(query);
|
const result = await this._fetchVerifiedLyrics(query);
|
||||||
@@ -725,8 +741,9 @@ const PlaybackMixin = {
|
|||||||
* @returns {Promise<{text: string, source: string, synced: boolean, lines: Array}|null>}
|
* @returns {Promise<{text: string, source: string, synced: boolean, lines: Array}|null>}
|
||||||
*/
|
*/
|
||||||
async _fetchVerifiedLyrics(query) {
|
async _fetchVerifiedLyrics(query) {
|
||||||
const durationMs = this._getTrackDurationMs(this.queue.getCurrent());
|
const current = this.queue.getCurrent();
|
||||||
const durationSec = Math.round(durationMs / 1000);
|
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 headers = { "User-Agent": "FluxerBot/1.0 (music bot lyrics lookup)" };
|
||||||
|
|
||||||
const urls = [];
|
const urls = [];
|
||||||
@@ -753,7 +770,7 @@ const PlaybackMixin = {
|
|||||||
title: query.title,
|
title: query.title,
|
||||||
artist: query.artist,
|
artist: query.artist,
|
||||||
durationSec,
|
durationSec,
|
||||||
});
|
}) || candidates[0];
|
||||||
if (!best) return null;
|
if (!best) return null;
|
||||||
|
|
||||||
if (best.instrumental) {
|
if (best.instrumental) {
|
||||||
|
|||||||
@@ -11,13 +11,14 @@ import { getVoiceManager } from "@fluxerjs/voice";
|
|||||||
import { EventEmitter } from "node:events";
|
import { EventEmitter } from "node:events";
|
||||||
import http from "node:http";
|
import http from "node:http";
|
||||||
import https from "node:https";
|
import https from "node:https";
|
||||||
import { EmbedBuilder } from "@fluxerjs/core";
|
import { EmbedBuilder, PermissionFlags } from "@fluxerjs/core";
|
||||||
import { getGlobalColor } from "../../ui/index.mjs";
|
import { getGlobalColor } from "../../ui/index.mjs";
|
||||||
import { Utils, cleanId } from "../../utils/Utils.mjs";
|
import { Utils, cleanId } from "../../utils/Utils.mjs";
|
||||||
import { logger } from "../../core/Logger.mjs";
|
import { logger } from "../../core/Logger.mjs";
|
||||||
import { get247ChannelMode, detachPlayerFromManager } from "../../utils/Helpers247.mjs";
|
import { get247ChannelMode, detachPlayerFromManager } from "../../utils/Helpers247.mjs";
|
||||||
import { hasHumansInChannel } from "../../voice/VoiceStateResolver.mjs";
|
import { hasHumansInChannel } from "../../voice/VoiceStateResolver.mjs";
|
||||||
import { FluxerAudioBridge } from "../audio/FluxerAudioBridge.mjs";
|
import { FluxerAudioBridge } from "../audio/FluxerAudioBridge.mjs";
|
||||||
|
import { getEffectiveVolume } from "../audio/VolumeNormalizer.mjs";
|
||||||
import { applyMixins } from "../../utils/mixins.mjs";
|
import { applyMixins } from "../../utils/mixins.mjs";
|
||||||
import { Queue } from "./Queue.mjs";
|
import { Queue } from "./Queue.mjs";
|
||||||
import PlaybackMixin from "./PlaybackMixin.mjs";
|
import PlaybackMixin from "./PlaybackMixin.mjs";
|
||||||
@@ -515,6 +516,23 @@ class Player extends EventEmitter {
|
|||||||
this._lastConnectedAt = Date.now();
|
this._lastConnectedAt = Date.now();
|
||||||
this.leaving = false;
|
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)...`);
|
logger.player(`[Player] Joining channel ${channelId} via vm.join() (LiveKit)...`);
|
||||||
const vm = getVoiceManager(this.client);
|
const vm = getVoiceManager(this.client);
|
||||||
if (!vm) {
|
if (!vm) {
|
||||||
@@ -786,6 +804,41 @@ class Player extends EventEmitter {
|
|||||||
return ":arrow_forward: Resumed";
|
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
|
* Skip the current track and advance to the next. Emits "trackSkip" with
|
||||||
* the skipped track so autoplay (when enabled) can replenish the queue.
|
* 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}`;
|
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.
|
* Set the playback volume.
|
||||||
* @param {number} v - Volume as a decimal (0–2, where 1 = 100%).
|
* @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.preferredVolume = Utils.clamp(v, 0, 2);
|
||||||
this.emit("volume", this.preferredVolume);
|
this.emit("volume", this.preferredVolume);
|
||||||
if (this._voiceConn) {
|
if (this._voiceConn) {
|
||||||
this._voiceConn.setVolume(this.preferredVolume * 100);
|
try {
|
||||||
|
this._voiceConn.setVolume(this.getEffectiveVolume());
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
if (!this._voiceConn)
|
if (!this._voiceConn)
|
||||||
return `Volume set to \`${Math.round(this.preferredVolume * 100)}%\` — will apply when connected.`;
|
return `Volume set to \`${Math.round(this.preferredVolume * 100)}%\` — will apply when connected.`;
|
||||||
@@ -971,6 +1038,25 @@ class Player extends EventEmitter {
|
|||||||
return msg;
|
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. */
|
/** @private Stop the audio bridge if currently playing. */
|
||||||
_bridgeStop() {
|
_bridgeStop() {
|
||||||
if (this._audioBridge?.playing) {
|
if (this._audioBridge?.playing) {
|
||||||
|
|||||||
@@ -76,6 +76,23 @@ export class Queue extends EventEmitter {
|
|||||||
return `Successfully removed **${title}** from the queue.`;
|
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).
|
* Move a track from one position to another (0-based indices).
|
||||||
* @param {number} from - Source index.
|
* @param {number} from - Source index.
|
||||||
|
|||||||
@@ -554,9 +554,78 @@ const SearchMixin = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isUrl && !fromTitleFallback && lcTracks.length > 1) {
|
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);
|
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 {
|
} else {
|
||||||
const video = this._lcTrackToVideo(firstTrack, trackMeta);
|
const video = this._lcTrackToVideo(firstTrack, trackMeta);
|
||||||
if (video) {
|
if (video) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import mysql from "mysql2";
|
import mysql from "mysql2";
|
||||||
import { logger } from "../core/Logger.mjs";
|
import { logger } from "../core/Logger.mjs";
|
||||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "../db/MysqlGuard.mjs";
|
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "../db/MysqlGuard.mjs";
|
||||||
|
import { getSharedMysqlPool } from "../db/PoolManager.mjs";
|
||||||
|
|
||||||
const DEFAULT_ALIAS = "default";
|
const DEFAULT_ALIAS = "default";
|
||||||
const MAX_ALIAS_LEN = 32;
|
const MAX_ALIAS_LEN = 32;
|
||||||
@@ -23,11 +24,15 @@ export class TrackOptionsManager {
|
|||||||
/** @private @type {number} */
|
/** @private @type {number} */
|
||||||
_cacheMaxSize = 2000;
|
_cacheMaxSize = 2000;
|
||||||
|
|
||||||
/** @param {object} mysqlConfig - MySQL connection config. */
|
/** @param {object} mysqlConfig - MySQL connection config or shared Pool instance. */
|
||||||
constructor(mysqlConfig) {
|
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");
|
attachMysqlPoolGuard(this.db, "TrackOptions");
|
||||||
this.db.on("error", (err) => {
|
this.db.on?.("error", (err) => {
|
||||||
logger.error("[TrackOptions] MySQL pool error:", err.code ?? err.message);
|
logger.error("[TrackOptions] MySQL pool error:", err.code ?? err.message);
|
||||||
});
|
});
|
||||||
this._readyPromise = this._ensureTable();
|
this._readyPromise = this._ensureTable();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { normalizeTrackText } from "./constants.mjs";
|
|||||||
import { applyMixins } from "../../utils/mixins.mjs";
|
import { applyMixins } from "../../utils/mixins.mjs";
|
||||||
import { parseLastFmUrl, isLastFmUrl } from "./urlUtils.mjs";
|
import { parseLastFmUrl, isLastFmUrl } from "./urlUtils.mjs";
|
||||||
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "../../db/MysqlGuard.mjs";
|
import { MYSQL_POOL_DEFAULTS, attachMysqlPoolGuard } from "../../db/MysqlGuard.mjs";
|
||||||
|
import { getSharedPromisePool } from "../../db/PoolManager.mjs";
|
||||||
import UserStoreMixin from "./UserStoreMixin.mjs";
|
import UserStoreMixin from "./UserStoreMixin.mjs";
|
||||||
import ScrobblingMixin from "./ScrobblingMixin.mjs";
|
import ScrobblingMixin from "./ScrobblingMixin.mjs";
|
||||||
import TrackQueriesMixin from "./TrackQueriesMixin.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>} */
|
/** @private @async Get or create the MySQL connection pool. @returns {Promise<object>} */
|
||||||
async _getPool() {
|
async _getPool() {
|
||||||
if (this._pool) return this._pool;
|
if (this._pool) return this._pool;
|
||||||
const mysql = await import("mysql2/promise");
|
if (this._mysqlConfig && typeof this._mysqlConfig.execute === "function") {
|
||||||
this._pool = mysql.createPool({
|
this._pool = this._mysqlConfig;
|
||||||
...MYSQL_POOL_DEFAULTS,
|
} else if (this._mysqlConfig && typeof this._mysqlConfig.promise === "function") {
|
||||||
host: this._mysqlConfig.host,
|
this._pool = this._mysqlConfig.promise();
|
||||||
port: this._mysqlConfig.port ?? 3306,
|
} else {
|
||||||
user: this._mysqlConfig.user,
|
this._pool = getSharedPromisePool(this._mysqlConfig);
|
||||||
password: this._mysqlConfig.password,
|
}
|
||||||
database: this._mysqlConfig.database,
|
|
||||||
});
|
|
||||||
attachMysqlPoolGuard(this._pool, "LastFm");
|
attachMysqlPoolGuard(this._pool, "LastFm");
|
||||||
await this._initTable();
|
await this._initTable();
|
||||||
return this._pool;
|
return this._pool;
|
||||||
|
|||||||
+20
-23
@@ -222,25 +222,7 @@ export class RichPaginator {
|
|||||||
const next = this._next;
|
const next = this._next;
|
||||||
const buildEmbed = this._buildEmbed.bind(this);
|
const buildEmbed = this._buildEmbed.bind(this);
|
||||||
|
|
||||||
const unobserve = wrapped.onReaction(allReactions, async (e) => {
|
let unobserve = () => {};
|
||||||
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(() => {});
|
|
||||||
});
|
|
||||||
|
|
||||||
/** @private Clear all reactions on the paginator message. */
|
/** @private Clear all reactions on the paginator message. */
|
||||||
const clearReactions = async () => {
|
const clearReactions = async () => {
|
||||||
@@ -279,12 +261,27 @@ export class RichPaginator {
|
|||||||
timer = setTimeout(closeSession, this._timeout);
|
timer = setTimeout(closeSession, this._timeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
const origHandler = wrapped.handler.observedReactions.get(rawMsg.id);
|
unobserve = wrapped.onReaction(allReactions, async (e) => {
|
||||||
if (origHandler) {
|
resetTimer();
|
||||||
const origCb = origHandler.cb;
|
const emoji = e.emoji_id;
|
||||||
origHandler.cb = (e, m) => { resetTimer(); origCb(e, m); };
|
|
||||||
|
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;
|
return rawMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,15 +41,27 @@ const RejoinManager = {
|
|||||||
return player;
|
return player;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const errMsg = err?.message ?? String(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("lavalink player create failed")
|
||||||
|| errMsg.includes("Failed to create audio player")
|
|| 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);
|
const backoffMs = baseDelay * Math.pow(2, attempt - 1);
|
||||||
logger.warn(
|
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}`
|
`retrying in ${backoffMs / 1000}s: ${errMsg}`
|
||||||
);
|
);
|
||||||
await new Promise(resolve => setTimeout(resolve, backoffMs));
|
await new Promise(resolve => setTimeout(resolve, backoffMs));
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"locale": "en",
|
"locale": "en",
|
||||||
"stay_247": "none",
|
"stay_247": "none",
|
||||||
"volume": 100,
|
"volume": 100,
|
||||||
|
"normalize": true,
|
||||||
"voteSkip": true,
|
"voteSkip": true,
|
||||||
"voteSkipThreshold": 3
|
"voteSkipThreshold": 3
|
||||||
},
|
},
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
"locale": "The preferred language of your server.",
|
"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.",
|
"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.",
|
"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.",
|
"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`."
|
"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": "انتقل إلى موضع محدد في المقطع الذي يعمل حالياً.",
|
"seek": "انتقل إلى موضع محدد في المقطع الذي يعمل حالياً.",
|
||||||
"move": "انقل مقطعاً من موضع إلى آخر في قائمة الانتظار.",
|
"move": "انقل مقطعاً من موضع إلى آخر في قائمة الانتظار.",
|
||||||
"autoplay": "بدّل التشغيل التلقائي — شغّل مقاطع مشابهة تلقائياً عند انتهاء القائمة.",
|
"autoplay": "بدّل التشغيل التلقائي — شغّل مقاطع مشابهة تلقائياً عند انتهاء القائمة.",
|
||||||
"trackopt": "عيّن أوقات بداية/نهاية مخصصة للمقاطع. يدعم الأسماء المستعارة — احفظ عمليات قص متعددة لكل مقطع."
|
"trackopt": "عيّن أوقات بداية/نهاية مخصصة للمقاطع. يدعم الأسماء المستعارة — احفظ عمليات قص متعددة لكل مقطع.",
|
||||||
|
"normalize": "تبديل تسوية الصوت الديناميكية (مستوى ReplayGain) عبر منصات الموسيقى المختلفة.",
|
||||||
|
"bassboost": "تطبيق تأثير معادل تضخيم الباس بمستويات منخفضة، متوسطة أو قوية.",
|
||||||
|
"speed": "تعديل سرعة تشغيل المقطع الصوتي الحالي (0.5× إلى 2.0×).",
|
||||||
|
"pitch": "تعديل طبقة الصوت (النغمة) للمقطع الصوتي الحالي (0.5× إلى 2.0×)."
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"debug": {
|
"debug": {
|
||||||
@@ -162,6 +166,18 @@
|
|||||||
},
|
},
|
||||||
"trackopt": {
|
"trackopt": {
|
||||||
"times": "وقت البداية والنهاية الاختياري، مثلاً '0:30' أو '0:30 3:45'"
|
"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": {
|
"pagination": {
|
||||||
@@ -513,6 +529,7 @@
|
|||||||
"labelPfp": "نمط صورة البوت",
|
"labelPfp": "نمط صورة البوت",
|
||||||
"labelLocale": "اللغة",
|
"labelLocale": "اللغة",
|
||||||
"labelVolume": "مستوى الصوت الافتراضي",
|
"labelVolume": "مستوى الصوت الافتراضي",
|
||||||
|
"labelNormalize": "تسوية مستوى الصوت",
|
||||||
"labelVoteSkip": "التصويت للتخطي",
|
"labelVoteSkip": "التصويت للتخطي",
|
||||||
"labelVoteSkipThreshold": "حد التصويت للتخطي",
|
"labelVoteSkipThreshold": "حد التصويت للتخطي",
|
||||||
"labelAnnouncementChannel": "قناة الإعلانات",
|
"labelAnnouncementChannel": "قناة الإعلانات",
|
||||||
@@ -594,13 +611,21 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "بوت Remix الموسيقي",
|
"title": "بوت Remix الموسيقي",
|
||||||
|
"categoryOverview": "📊 نظرة عامة",
|
||||||
|
"categoryMusic": "🎧 النشاط الموسيقي",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ النظام والشبكة",
|
||||||
"servers": "📂 **الخوادم**",
|
"servers": "📂 **الخوادم**",
|
||||||
"users": "👥 **المستخدمون**",
|
"users": "👥 **المستخدمون**",
|
||||||
"players": "🎧 **المشغّلات**",
|
"players": "🎧 **المشغّلات**",
|
||||||
|
"playersWithPlaying": "{{total}} ({{playing}} قيد التشغيل)",
|
||||||
|
"queuedTracks": "🎶 **المسارات في الانتظار**",
|
||||||
|
"radios": "📻 **محطات 24/7**",
|
||||||
"scrobbles": "🎵 **اسكروبلات**",
|
"scrobbles": "🎵 **اسكروبلات**",
|
||||||
"linkedUsers": "🔗 **حسابات Last.fm**",
|
"linkedUsers": "🔗 **حسابات Last.fm**",
|
||||||
"ping": "🏓 **البينغ**",
|
"ping": "🏓 **البينغ**",
|
||||||
"gateway": "🌐 **البوابة**",
|
"gateway": "🌐 **البوابة**",
|
||||||
|
"shard": "🧩 **الشارد (Shard)**",
|
||||||
"uptime": "⏱️ **وقت التشغيل**",
|
"uptime": "⏱️ **وقت التشغيل**",
|
||||||
"build": "🔧 **الإصدار**",
|
"build": "🔧 **الإصدار**",
|
||||||
"lastRestart": "🪛 **آخر إعادة تشغيل**",
|
"lastRestart": "🪛 **آخر إعادة تشغيل**",
|
||||||
@@ -825,6 +850,29 @@
|
|||||||
"listTitle": "📋 **خيارات المسار الخاصة بك** ({{count}})",
|
"listTitle": "📋 **خيارات المسار الخاصة بك** ({{count}})",
|
||||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||||
"listHint": "استخدم `{{prefix}}trackopt play <alias>` لتطبيق تقصير مسمى، أو `{{prefix}}trackopt remove [alias]` لحذف واحد."
|
"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": "بچۆرەوە شوێنێکی دیاریکراو لە تراکی ئێستادا.",
|
"seek": "بچۆرەوە شوێنێکی دیاریکراو لە تراکی ئێستادا.",
|
||||||
"move": "تراکێک لە شوێنێکەوە بگوازەرەوە بۆ شوێنێکی تر لە ڕیزبەندییەکەدا.",
|
"move": "تراکێک لە شوێنێکەوە بگوازەرەوە بۆ شوێنێکی تر لە ڕیزبەندییەکەدا.",
|
||||||
"autoplay": "لێدانی خۆکار بکەوە/ناچالاک بکە — بە خۆکارایەتی تراکی هاوشێوە لێبدە کاتێک ڕیزبەندییەکە تەواو بوو.",
|
"autoplay": "لێدانی خۆکار بکەوە/ناچالاک بکە — بە خۆکارایەتی تراکی هاوشێوە لێبدە کاتێک ڕیزبەندییەکە تەواو بوو.",
|
||||||
"trackopt": "کاتی دەستپێکردن/کۆتایی تایبەت بۆ تراکەکان دابنێ. ناوی بدیل پشتگیری دەکات — چەندین بڕین بۆ هەر تراکێک بۆ بەشە جیاوازەکان پاشەکەوت بکە."
|
"trackopt": "کاتی دەستپێکردن/کۆتایی تایبەت بۆ تراکەکان دابنێ. ناوی بدیل پشتگیری دەکات — چەندین بڕین بۆ هەر تراکێک بۆ بەشە جیاوازەکان پاشەکەوت بکە.",
|
||||||
|
"normalize": "گۆڕینی یەکسانسازیی دەنگی داینامیکی (ئاستی ReplayGain) لەنێوان سەرچاوەکانی مۆسیقادا.",
|
||||||
|
"bassboost": "بەکاربردنی کاریگەریی ئیكوالایزەری بەرزکردنەوەی باس بە ئاستی نزم، مامناوەند یان بەهێز.",
|
||||||
|
"speed": "دەستکاریکردنی خێرایی لێدانی تراکی ئێستا (0.5× بۆ 2.0×).",
|
||||||
|
"pitch": "دەستکاریکردنی تۆن و ئاستی دەنگی تراکی ئێستا (0.5× بۆ 2.0×)."
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"debug": {
|
"debug": {
|
||||||
@@ -162,6 +166,18 @@
|
|||||||
},
|
},
|
||||||
"trackopt": {
|
"trackopt": {
|
||||||
"times": "کاتی دەستپێکردن و کۆتایی ئیختیاری، بۆ نموونە '0:30' یان '0:30 3:45'"
|
"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": {
|
"pagination": {
|
||||||
@@ -513,6 +529,7 @@
|
|||||||
"labelPfp": "شێوازی وێنەی بۆت",
|
"labelPfp": "شێوازی وێنەی بۆت",
|
||||||
"labelLocale": "زمان",
|
"labelLocale": "زمان",
|
||||||
"labelVolume": "ئاستی دەنگی بنەڕەتی",
|
"labelVolume": "ئاستی دەنگی بنەڕەتی",
|
||||||
|
"labelNormalize": "یەکسانسازیی ئاستی دەنگ",
|
||||||
"labelVoteSkip": "دەنگدان بۆ تێپەڕین",
|
"labelVoteSkip": "دەنگدان بۆ تێپەڕین",
|
||||||
"labelVoteSkipThreshold": "سنووری دەنگدان بۆ تێپەڕین",
|
"labelVoteSkipThreshold": "سنووری دەنگدان بۆ تێپەڕین",
|
||||||
"labelAnnouncementChannel": "کەنالی ڕاگەیاندن",
|
"labelAnnouncementChannel": "کەنالی ڕاگەیاندن",
|
||||||
@@ -594,13 +611,21 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "بۆتی موزیکی Remix",
|
"title": "بۆتی موزیکی Remix",
|
||||||
|
"categoryOverview": "📊 کورتە",
|
||||||
|
"categoryMusic": "🎧 چالاکی موزیک",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ سیستەم و هێڵ",
|
||||||
"servers": "📂 **سێرڤەرەکان**",
|
"servers": "📂 **سێرڤەرەکان**",
|
||||||
"users": "👥 **بەکارهێنەران**",
|
"users": "👥 **بەکارهێنەران**",
|
||||||
"players": "🎧 **پەخشکەرەکان**",
|
"players": "🎧 **پەخشکەرەکان**",
|
||||||
|
"playersWithPlaying": "{{total}} ({{playing}} لێدەدرێت)",
|
||||||
|
"queuedTracks": "🎶 **گۆرانییەکانی ڕیزبەند**",
|
||||||
|
"radios": "📻 **ڕادیۆکانی 24/7**",
|
||||||
"scrobbles": "🎵 **سکرۆبلەکان**",
|
"scrobbles": "🎵 **سکرۆبلەکان**",
|
||||||
"linkedUsers": "🔗 **هەژمارەکانی Last.fm**",
|
"linkedUsers": "🔗 **هەژمارەکانی Last.fm**",
|
||||||
"ping": "🏓 **پینگ**",
|
"ping": "🏓 **پینگ**",
|
||||||
"gateway": "🌐 **گەیتوەی**",
|
"gateway": "🌐 **گەیتوەی**",
|
||||||
|
"shard": "🧩 **شارد (Shard)**",
|
||||||
"uptime": "⏱️ **کاتی چالاک**",
|
"uptime": "⏱️ **کاتی چالاک**",
|
||||||
"build": "🔧 **بەرنامە**",
|
"build": "🔧 **بەرنامە**",
|
||||||
"lastRestart": "🪛 **دوایین دەستپێکردنەوە**",
|
"lastRestart": "🪛 **دوایین دەستپێکردنەوە**",
|
||||||
@@ -825,6 +850,29 @@
|
|||||||
"listTitle": "📋 **هەڵبژاردەکانی تراکت** ({{count}})",
|
"listTitle": "📋 **هەڵبژاردەکانی تراکت** ({{count}})",
|
||||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||||
"listHint": "`{{prefix}}trackopt play <alias>` بەکاربێنە بە جێبەجێکردنی دەرکردەیەکی ناوەند، یان `{{prefix}}trackopt remove [alias]` بۆ سڕینەوەی یەک."
|
"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.",
|
"seek": "Springe zu einer bestimmten Position im aktuell spielenden Track.",
|
||||||
"move": "Verschiebe einen Track von einer Position an eine andere in der Warteschlange.",
|
"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.",
|
"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": {
|
"options": {
|
||||||
"debug": {
|
"debug": {
|
||||||
@@ -162,6 +166,18 @@
|
|||||||
},
|
},
|
||||||
"trackopt": {
|
"trackopt": {
|
||||||
"times": "Start- und optionale Endzeit, z.B. '0:30' oder '0:30 3:45'"
|
"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": {
|
"pagination": {
|
||||||
@@ -513,6 +529,7 @@
|
|||||||
"labelPfp": "Bot-Avatar-Stil",
|
"labelPfp": "Bot-Avatar-Stil",
|
||||||
"labelLocale": "Sprache",
|
"labelLocale": "Sprache",
|
||||||
"labelVolume": "Standardlautstärke",
|
"labelVolume": "Standardlautstärke",
|
||||||
|
"labelNormalize": "Lautstärkenormalisierung",
|
||||||
"labelVoteSkip": "Abstimmung zum Überspringen",
|
"labelVoteSkip": "Abstimmung zum Überspringen",
|
||||||
"labelVoteSkipThreshold": "Schwellenwert für Skip-Abstimmung",
|
"labelVoteSkipThreshold": "Schwellenwert für Skip-Abstimmung",
|
||||||
"labelAnnouncementChannel": "Ankündigungskanal",
|
"labelAnnouncementChannel": "Ankündigungskanal",
|
||||||
@@ -594,13 +611,21 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "Remix Musik-Bot",
|
"title": "Remix Musik-Bot",
|
||||||
|
"categoryOverview": "📊 Übersicht",
|
||||||
|
"categoryMusic": "🎧 Musik-Aktivität",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ System & Netzwerk",
|
||||||
"servers": "📂 **Server**",
|
"servers": "📂 **Server**",
|
||||||
"users": "👥 **Benutzer**",
|
"users": "👥 **Benutzer**",
|
||||||
"players": "🎧 **Player**",
|
"players": "🎧 **Player**",
|
||||||
|
"playersWithPlaying": "{{total}} ({{playing}} aktiv)",
|
||||||
|
"queuedTracks": "🎶 **Warteschlangen-Titel**",
|
||||||
|
"radios": "📻 **24/7-Radios**",
|
||||||
"scrobbles": "🎵 **Scrobbles**",
|
"scrobbles": "🎵 **Scrobbles**",
|
||||||
"linkedUsers": "🔗 **Verknüpfte Last.fm**",
|
"linkedUsers": "🔗 **Verknüpfte Last.fm**",
|
||||||
"ping": "🏓 **Ping**",
|
"ping": "🏓 **Ping**",
|
||||||
"gateway": "🌐 **Gateway**",
|
"gateway": "🌐 **Gateway**",
|
||||||
|
"shard": "🧩 **Shard**",
|
||||||
"uptime": "⏱️ **Uptime**",
|
"uptime": "⏱️ **Uptime**",
|
||||||
"build": "🔧 **Build**",
|
"build": "🔧 **Build**",
|
||||||
"lastRestart": "🪛 **Letzter Neustart**",
|
"lastRestart": "🪛 **Letzter Neustart**",
|
||||||
@@ -825,6 +850,29 @@
|
|||||||
"listTitle": "📋 **Deine Track-Optionen** ({{count}})",
|
"listTitle": "📋 **Deine Track-Optionen** ({{count}})",
|
||||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
"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."
|
"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.",
|
"seek": "Seek to a specific position in the currently playing track.",
|
||||||
"move": "Move a track from one position to another in the queue.",
|
"move": "Move a track from one position to another in the queue.",
|
||||||
"autoplay": "Toggle autoplay — automatically play similar tracks when the queue ends.",
|
"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": {
|
"options": {
|
||||||
"debug": {
|
"debug": {
|
||||||
@@ -162,6 +166,18 @@
|
|||||||
},
|
},
|
||||||
"trackopt": {
|
"trackopt": {
|
||||||
"times": "Start and optional end time, e.g. '0:30' or '0:30 3:45'"
|
"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": {
|
"pagination": {
|
||||||
@@ -630,6 +646,7 @@
|
|||||||
"labelPfp": "Bot avatar style",
|
"labelPfp": "Bot avatar style",
|
||||||
"labelLocale": "Locale",
|
"labelLocale": "Locale",
|
||||||
"labelVolume": "Default volume",
|
"labelVolume": "Default volume",
|
||||||
|
"labelNormalize": "Volume normalization",
|
||||||
"labelVoteSkip": "Vote to skip",
|
"labelVoteSkip": "Vote to skip",
|
||||||
"labelVoteSkipThreshold": "Vote to skip threshold",
|
"labelVoteSkipThreshold": "Vote to skip threshold",
|
||||||
"labelAnnouncementChannel": "Announcement channel",
|
"labelAnnouncementChannel": "Announcement channel",
|
||||||
@@ -711,13 +728,21 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "Remix Music Bot",
|
"title": "Remix Music Bot",
|
||||||
|
"categoryOverview": "📊 Overview",
|
||||||
|
"categoryMusic": "🎧 Music Activity",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ System & Network",
|
||||||
"servers": "📂 **Servers**",
|
"servers": "📂 **Servers**",
|
||||||
"users": "👥 **Users**",
|
"users": "👥 **Users**",
|
||||||
"players": "🎧 **Players**",
|
"players": "🎧 **Players**",
|
||||||
|
"playersWithPlaying": "{{total}} ({{playing}} playing)",
|
||||||
|
"queuedTracks": "🎶 **Queued Tracks**",
|
||||||
|
"radios": "📻 **24/7 Radios**",
|
||||||
"scrobbles": "🎵 **Scrobbles**",
|
"scrobbles": "🎵 **Scrobbles**",
|
||||||
"linkedUsers": "🔗 **Linked Last.fm**",
|
"linkedUsers": "🔗 **Linked Last.fm**",
|
||||||
"ping": "🏓 **Ping**",
|
"ping": "🏓 **Ping**",
|
||||||
"gateway": "🌐 **Gateway**",
|
"gateway": "🌐 **Gateway**",
|
||||||
|
"shard": "🧩 **Shard**",
|
||||||
"uptime": "⏱️ **Uptime**",
|
"uptime": "⏱️ **Uptime**",
|
||||||
"build": "🔧 **Build**",
|
"build": "🔧 **Build**",
|
||||||
"lastRestart": "🪛 **Last restart**",
|
"lastRestart": "🪛 **Last restart**",
|
||||||
@@ -825,6 +850,29 @@
|
|||||||
"listTitle": "📋 **Your Track Options** ({{count}})",
|
"listTitle": "📋 **Your Track Options** ({{count}})",
|
||||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||||
"listHint": "Use `{{prefix}}trackopt play <alias>` to apply a named trim, or `{{prefix}}trackopt remove [alias]` to delete one."
|
"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.",
|
"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.",
|
"move": "Mova uma faixa de uma posição para outra na fila.",
|
||||||
"autoplay": "Alterne o autoplay — toque faixas similares automaticamente quando a fila terminar.",
|
"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": {
|
"options": {
|
||||||
"debug": {
|
"debug": {
|
||||||
@@ -162,6 +166,18 @@
|
|||||||
},
|
},
|
||||||
"trackopt": {
|
"trackopt": {
|
||||||
"times": "Horário de início e fim opcional, ex: '0:30' ou '0:30 3:45'"
|
"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": {
|
"pagination": {
|
||||||
@@ -513,6 +529,7 @@
|
|||||||
"labelPfp": "Estilo do avatar do bot",
|
"labelPfp": "Estilo do avatar do bot",
|
||||||
"labelLocale": "Idioma",
|
"labelLocale": "Idioma",
|
||||||
"labelVolume": "Volume padrão",
|
"labelVolume": "Volume padrão",
|
||||||
|
"labelNormalize": "Normalização de volume",
|
||||||
"labelVoteSkip": "Votação para pular",
|
"labelVoteSkip": "Votação para pular",
|
||||||
"labelVoteSkipThreshold": "Limite de votação para pular",
|
"labelVoteSkipThreshold": "Limite de votação para pular",
|
||||||
"labelAnnouncementChannel": "Canal de anúncios",
|
"labelAnnouncementChannel": "Canal de anúncios",
|
||||||
@@ -594,13 +611,21 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "Bot de Música Remix",
|
"title": "Bot de Música Remix",
|
||||||
|
"categoryOverview": "📊 Visão Geral",
|
||||||
|
"categoryMusic": "🎧 Atividade Musical",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ Sistema e Rede",
|
||||||
"servers": "📂 **Servidores**",
|
"servers": "📂 **Servidores**",
|
||||||
"users": "👥 **Usuários**",
|
"users": "👥 **Usuários**",
|
||||||
"players": "🎧 **Players**",
|
"players": "🎧 **Players**",
|
||||||
|
"playersWithPlaying": "{{total}} ({{playing}} tocando)",
|
||||||
|
"queuedTracks": "🎶 **Músicas na Fila**",
|
||||||
|
"radios": "📻 **Rádios 24/7**",
|
||||||
"scrobbles": "🎵 **Scrobbles**",
|
"scrobbles": "🎵 **Scrobbles**",
|
||||||
"linkedUsers": "🔗 **Last.fm Vinculadas**",
|
"linkedUsers": "🔗 **Last.fm Vinculadas**",
|
||||||
"ping": "🏓 **Ping**",
|
"ping": "🏓 **Ping**",
|
||||||
"gateway": "🌐 **Gateway**",
|
"gateway": "🌐 **Gateway**",
|
||||||
|
"shard": "🧩 **Shard**",
|
||||||
"uptime": "⏱️ **Tempo de Atividade**",
|
"uptime": "⏱️ **Tempo de Atividade**",
|
||||||
"build": "🔧 **Build**",
|
"build": "🔧 **Build**",
|
||||||
"lastRestart": "🪛 **Último Reinício**",
|
"lastRestart": "🪛 **Último Reinício**",
|
||||||
@@ -825,6 +850,29 @@
|
|||||||
"listTitle": "📋 **Suas Opções de Faixa** ({{count}})",
|
"listTitle": "📋 **Suas Opções de Faixa** ({{count}})",
|
||||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
||||||
"listHint": "Use `{{prefix}}trackopt play <alias>` para aplicar um recorte nomeado, ou `{{prefix}}trackopt remove [alias]` para excluir um."
|
"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.",
|
"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.",
|
"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.",
|
"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"
|
"vote": "FluxerList üzerinde sunucunuz/botunuz için oylama bilgilerini görüntüleyin veya oy verenleri kontrol edin"
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
@@ -159,6 +163,18 @@
|
|||||||
"trackopt": {
|
"trackopt": {
|
||||||
"times": "Başlangıç ve isteğe bağlı bitiş süresi, örn. '0:30' veya '0:30 3:45'"
|
"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": {
|
"vote": {
|
||||||
"action": "Yapılacak işlem: info, check, voters",
|
"action": "Yapılacak işlem: info, check, voters",
|
||||||
"type": "Kaynak türü: sunucu veya bot"
|
"type": "Kaynak türü: sunucu veya bot"
|
||||||
@@ -663,6 +679,7 @@
|
|||||||
"labelPfp": "Bot avatar stili",
|
"labelPfp": "Bot avatar stili",
|
||||||
"labelLocale": "Yerel ayar",
|
"labelLocale": "Yerel ayar",
|
||||||
"labelVolume": "Varsayılan ses",
|
"labelVolume": "Varsayılan ses",
|
||||||
|
"labelNormalize": "Ses normalleştirme",
|
||||||
"labelVoteSkip": "Atlama oylaması",
|
"labelVoteSkip": "Atlama oylaması",
|
||||||
"labelVoteSkipThreshold": "Atlama oylaması eşiği",
|
"labelVoteSkipThreshold": "Atlama oylaması eşiği",
|
||||||
"labelAnnouncementChannel": "Duyuru kanalı",
|
"labelAnnouncementChannel": "Duyuru kanalı",
|
||||||
@@ -700,13 +717,21 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "Remix Müzik Botu",
|
"title": "Remix Müzik Botu",
|
||||||
|
"categoryOverview": "📊 Genel Bakış",
|
||||||
|
"categoryMusic": "🎧 Müzik Aktivitesi",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ Sistem ve Ağ",
|
||||||
"servers": "📂 **Sunucular**",
|
"servers": "📂 **Sunucular**",
|
||||||
"users": "👥 **Kullanıcılar**",
|
"users": "👥 **Kullanıcılar**",
|
||||||
"players": "🎧 **Oynatıcılar**",
|
"players": "🎧 **Oynatıcılar**",
|
||||||
|
"playersWithPlaying": "{{total}} ({{playing}} çalıyor)",
|
||||||
|
"queuedTracks": "🎶 **Kuyruktaki Parçalar**",
|
||||||
|
"radios": "📻 **24/7 Radyolar**",
|
||||||
"scrobbles": "🎵 **Scrobble'lar**",
|
"scrobbles": "🎵 **Scrobble'lar**",
|
||||||
"linkedUsers": "🔗 **Bağlı Last.fm**",
|
"linkedUsers": "🔗 **Bağlı Last.fm**",
|
||||||
"ping": "🏓 **Ping**",
|
"ping": "🏓 **Ping**",
|
||||||
"gateway": "🌐 **Gateway**",
|
"gateway": "🌐 **Gateway**",
|
||||||
|
"shard": "🧩 **Shard**",
|
||||||
"uptime": "⏱️ **Çalışma Süresi**",
|
"uptime": "⏱️ **Çalışma Süresi**",
|
||||||
"build": "🔧 **Yapı**",
|
"build": "🔧 **Yapı**",
|
||||||
"lastRestart": "🪛 **Son yeniden başlatma**",
|
"lastRestart": "🪛 **Son yeniden başlatma**",
|
||||||
@@ -786,6 +811,29 @@
|
|||||||
"listEntry": "• **{{title}}** — {{start}} → {{end}}",
|
"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."
|
"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": {
|
"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."
|
"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