mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
ahm
This commit is contained in:
1 parent
ba479e4c04
commit
441eb4406e
7 files changed
+29
-24
No files matched your search
+13
-9
@@ -59,19 +59,23 @@ export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) {
|
||||
const guildId = getGuildId(message);
|
||||
|
||||
const is247 = (() => {
|
||||
const raw = this.settingsMgr?.getServer?.(guildId)?.get?.("stay_247");
|
||||
return raw && raw !== "none";
|
||||
try {
|
||||
const raw = this.settingsMgr?.getServer?.(guildId)?.get?.("stay_247");
|
||||
return raw && raw !== "none";
|
||||
} catch (_) { return false; }
|
||||
})();
|
||||
|
||||
const mode247 = (() => {
|
||||
if (!is247) return "off";
|
||||
const set = this.settingsMgr?.getServer?.(guildId);
|
||||
const modes = set?.get?.("stay_247_modes");
|
||||
const matchCh = homeChannelId || activeChannelId;
|
||||
if (modes && typeof modes === "object" && !Array.isArray(modes) && modes[matchCh]) {
|
||||
return modes[matchCh];
|
||||
}
|
||||
return set?.get?.("stay_247_mode") ?? "off";
|
||||
try {
|
||||
const set = this.settingsMgr?.getServer?.(guildId);
|
||||
const modes = set?.get?.("stay_247_modes");
|
||||
const matchCh = homeChannelId || activeChannelId;
|
||||
if (modes && typeof modes === "object" && !Array.isArray(modes) && modes[matchCh]) {
|
||||
return modes[matchCh];
|
||||
}
|
||||
return set?.get?.("stay_247_mode") ?? "off";
|
||||
} catch (_) { return "off"; }
|
||||
})();
|
||||
|
||||
this.players.playerMap.delete(activeChannelId);
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ function extractPeriod(data, msg) {
|
||||
|
||||
/**
|
||||
* 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} msg - The message object
|
||||
|
||||
@@ -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 {string} channelId - Clean channel ID
|
||||
* @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 {string} channelId - Clean channel ID
|
||||
* @param {string} guildId - Guild ID
|
||||
@@ -630,7 +630,7 @@ export const command = function() {
|
||||
.addExamples(
|
||||
"$prefixsettings get",
|
||||
"$prefixsettings get prefix",
|
||||
"$prefixsettings set prefix !",
|
||||
"$prefixsettings set prefix %",
|
||||
"$prefixsettings set locale de-DE",
|
||||
"$prefixsettings set songAnnouncements off",
|
||||
"$prefixsettings set stay_247 auto",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CommandBuilder } from "../src/CommandHandler.mjs";
|
||||
import { EmbedBuilder } from "@fluxerjs/core";
|
||||
import { getGlobalColor } from "../src/MessageHandler.mjs";
|
||||
import { logger } from "../src/constants/Logger.mjs";
|
||||
|
||||
const DEFAULT_ALIAS = "default";
|
||||
|
||||
|
||||
@@ -1111,7 +1111,7 @@ export class GatewayHandler {
|
||||
|
||||
/**
|
||||
* 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)
|
||||
* 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.
|
||||
*
|
||||
* Both $prefix247 auto and $prefix247 on channels are rejoined because:
|
||||
* $prefix247 auto: always stays in voice (disconnect + reboot)
|
||||
* $prefix247 on: only on reboot, not on disconnect
|
||||
* Both %247 auto and %247 on channels are rejoined because:
|
||||
* %247 auto: always stays in voice (disconnect + reboot)
|
||||
* %247 on: only on reboot, not on disconnect
|
||||
*
|
||||
* Channels are rejoined one at a time with a delay between each to
|
||||
* avoid overwhelming the LiveKit server with concurrent track publications.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* - Auth flow (desktop API: get token → user authorizes → get session)
|
||||
* - Now-playing notification (track.scrobble with timestamp=0)
|
||||
* - 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`
|
||||
*
|
||||
* 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) {
|
||||
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.
|
||||
* Useful for `$prefixplay lastfm: kendrick lamar luther` where artist/title
|
||||
* Useful for `%play lastfm: kendrick lamar luther` where artist/title
|
||||
* boundaries are ambiguous.
|
||||
*
|
||||
* @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} [period="overall"] - overall | 7day | 1month | 3month | 6month | 12month
|
||||
* @param {number} [limit=20]
|
||||
|
||||
+3
-3
@@ -415,9 +415,9 @@ export default class Player extends EventEmitter {
|
||||
* Get the 24/7 mode for this player's channel.
|
||||
* Returns "auto", "on", or "off".
|
||||
*
|
||||
* $prefix247 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)
|
||||
* $prefix247 off: bot leaves when inactive
|
||||
* %247 auto: bot stays in voice always (never leaves, auto-rejoins on disconnect + reboot)
|
||||
* %247 on: bot stays in voice always (never leaves due to inactivity, rejoins on reboot)
|
||||
* %247 off: bot leaves when inactive
|
||||
*/
|
||||
_get247Mode() {
|
||||
if (!this._guildId) return "off";
|
||||
|
||||
Reference in new issue
Block a user