This commit is contained in:
NoLogicAlan committed 2026-05-31 16:58:42 +03:00
1 parent ba479e4c04
commit 441eb4406e
7 files changed
+20 -15

No files matched your search

+4
View File
@@ -59,12 +59,15 @@ export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) {
const guildId = getGuildId(message); const guildId = getGuildId(message);
const is247 = (() => { const is247 = (() => {
try {
const raw = this.settingsMgr?.getServer?.(guildId)?.get?.("stay_247"); const raw = this.settingsMgr?.getServer?.(guildId)?.get?.("stay_247");
return raw && raw !== "none"; return raw && raw !== "none";
} catch (_) { return false; }
})(); })();
const mode247 = (() => { const mode247 = (() => {
if (!is247) return "off"; if (!is247) return "off";
try {
const set = this.settingsMgr?.getServer?.(guildId); const set = this.settingsMgr?.getServer?.(guildId);
const modes = set?.get?.("stay_247_modes"); const modes = set?.get?.("stay_247_modes");
const matchCh = homeChannelId || activeChannelId; const matchCh = homeChannelId || activeChannelId;
@@ -72,6 +75,7 @@ export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) {
return modes[matchCh]; return modes[matchCh];
} }
return set?.get?.("stay_247_mode") ?? "off"; return set?.get?.("stay_247_mode") ?? "off";
} catch (_) { return "off"; }
})(); })();
this.players.playerMap.delete(activeChannelId); this.players.playerMap.delete(activeChannelId);
+1 -1
View File
@@ -139,7 +139,7 @@ function extractPeriod(data, msg) {
/** /**
* Resolve a Last.fm category (loved/top/recent/playlist) into playable tracks. * Resolve a Last.fm category (loved/top/recent/playlist) into playable tracks.
* Shared between `$prefixlastfm play <cat>` and `$prefixplay lastfm:<cat>`. * Shared between `%lastfm play <cat>` and `%play lastfm:<cat>`.
* *
* @param {object} ctx - The command `this` context (has .lastfm, .getPlayer, .handler, .t) * @param {object} ctx - The command `this` context (has .lastfm, .getPlayer, .handler, .t)
* @param {object} msg - The message object * @param {object} msg - The message object
+3 -3
View File
@@ -253,7 +253,7 @@ function build247StatusPanel(set, ctx, message, t, guildId) {
} }
/** /**
* Build a simple embed for the $prefix247 on/auto confirmation. * Build a simple embed for the %247 on/auto confirmation.
* @param {object} set - ServerSettings * @param {object} set - ServerSettings
* @param {string} channelId - Clean channel ID * @param {string} channelId - Clean channel ID
* @param {string} mode - "on" | "auto" * @param {string} mode - "on" | "auto"
@@ -298,7 +298,7 @@ function build247EnabledPanel(set, channelId, mode, joined, ctx, guildId, t) {
} }
/** /**
* Build a simple embed for the $prefix247 off confirmation. * Build a simple embed for the %247 off confirmation.
* @param {object} set - ServerSettings * @param {object} set - ServerSettings
* @param {string} channelId - Clean channel ID * @param {string} channelId - Clean channel ID
* @param {string} guildId - Guild ID * @param {string} guildId - Guild ID
@@ -630,7 +630,7 @@ export const command = function() {
.addExamples( .addExamples(
"$prefixsettings get", "$prefixsettings get",
"$prefixsettings get prefix", "$prefixsettings get prefix",
"$prefixsettings set prefix !", "$prefixsettings set prefix %",
"$prefixsettings set locale de-DE", "$prefixsettings set locale de-DE",
"$prefixsettings set songAnnouncements off", "$prefixsettings set songAnnouncements off",
"$prefixsettings set stay_247 auto", "$prefixsettings set stay_247 auto",
+1
View File
@@ -1,6 +1,7 @@
import { CommandBuilder } from "../src/CommandHandler.mjs"; import { CommandBuilder } from "../src/CommandHandler.mjs";
import { EmbedBuilder } from "@fluxerjs/core"; import { EmbedBuilder } from "@fluxerjs/core";
import { getGlobalColor } from "../src/MessageHandler.mjs"; import { getGlobalColor } from "../src/MessageHandler.mjs";
import { logger } from "../src/constants/Logger.mjs";
const DEFAULT_ALIAS = "default"; const DEFAULT_ALIAS = "default";
+4 -4
View File
@@ -1111,7 +1111,7 @@ export class GatewayHandler {
/** /**
* Rejoin a voice channel after an unexpected disconnect. * Rejoin a voice channel after an unexpected disconnect.
* Used by the $prefix247 auto mode to automatically reconnect. * Used by the %247 auto mode to automatically reconnect.
* *
* Includes deduplication (prevents concurrent rejoin for the same channel) * Includes deduplication (prevents concurrent rejoin for the same channel)
* and retry with exponential backoff for transient failures like track * and retry with exponential backoff for transient failures like track
@@ -1332,9 +1332,9 @@ export class GatewayHandler {
/** /**
* Rejoin all 24/7 channels after boot with staggered delays. * Rejoin all 24/7 channels after boot with staggered delays.
* *
* Both $prefix247 auto and $prefix247 on channels are rejoined because: * Both %247 auto and %247 on channels are rejoined because:
* $prefix247 auto: always stays in voice (disconnect + reboot) * %247 auto: always stays in voice (disconnect + reboot)
* $prefix247 on: only on reboot, not on disconnect * %247 on: only on reboot, not on disconnect
* *
* Channels are rejoined one at a time with a delay between each to * Channels are rejoined one at a time with a delay between each to
* avoid overwhelming the LiveKit server with concurrent track publications. * avoid overwhelming the LiveKit server with concurrent track publications.
+4 -4
View File
@@ -5,7 +5,7 @@
* - Auth flow (desktop API: get token → user authorizes → get session) * - Auth flow (desktop API: get token → user authorizes → get session)
* - Now-playing notification (track.scrobble with timestamp=0) * - Now-playing notification (track.scrobble with timestamp=0)
* - Full scrobble after threshold (50% of track or 4 min, whichever is less) * - Full scrobble after threshold (50% of track or 4 min, whichever is less)
* - Fetch loved / top / recent tracks for $prefixplay lastfm loved/top/recent * - Fetch loved / top / recent tracks for %play lastfm loved/top/recent
* - Per-user session key storage in MySQL table `lastfm_users` * - Per-user session key storage in MySQL table `lastfm_users`
* *
* Last.fm API docs: https: * Last.fm API docs: https:
@@ -496,7 +496,7 @@ export class LastFmManager {
} }
/** /**
* Get track info (play count, tags, etc.) for the $prefixnp embed. * Get track info (play count, tags, etc.) for the %np embed.
*/ */
async getTrackInfo(artist, track, userId = null) { async getTrackInfo(artist, track, userId = null) {
if (!this.enabled) return null; if (!this.enabled) return null;
@@ -571,7 +571,7 @@ export class LastFmManager {
/** /**
* Search Last.fm for a freeform track query and return the best match. * Search Last.fm for a freeform track query and return the best match.
* Useful for `$prefixplay lastfm: kendrick lamar luther` where artist/title * Useful for `%play lastfm: kendrick lamar luther` where artist/title
* boundaries are ambiguous. * boundaries are ambiguous.
* *
* @param {string} query * @param {string} query
@@ -1476,7 +1476,7 @@ export class LastFmManager {
} }
/** /**
* Get the user's top albums (for $prefixlastfm play albums). * Get the user's top albums (for %lastfm play albums).
* @param {string} userId * @param {string} userId
* @param {string} [period="overall"] - overall | 7day | 1month | 3month | 6month | 12month * @param {string} [period="overall"] - overall | 7day | 1month | 3month | 6month | 12month
* @param {number} [limit=20] * @param {number} [limit=20]
+3 -3
View File
@@ -415,9 +415,9 @@ export default class Player extends EventEmitter {
* Get the 24/7 mode for this player's channel. * Get the 24/7 mode for this player's channel.
* Returns "auto", "on", or "off". * Returns "auto", "on", or "off".
* *
* $prefix247 auto: bot stays in voice always (never leaves, auto-rejoins on disconnect + reboot) * %247 auto: bot stays in voice always (never leaves, auto-rejoins on disconnect + reboot)
* $prefix247 on: bot stays in voice always (never leaves due to inactivity, rejoins on reboot) * %247 on: bot stays in voice always (never leaves due to inactivity, rejoins on reboot)
* $prefix247 off: bot leaves when inactive * %247 off: bot leaves when inactive
*/ */
_get247Mode() { _get247Mode() {
if (!this._guildId) return "off"; if (!this._guildId) return "off";