This commit is contained in:
NoLogicAlan committed 2026-05-28 18:13:53 +03:00
1 parent 5a29545d41
commit 93ab04691c
4 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -144,7 +144,7 @@ function remove247ChannelMode(set, channelId, currentChannels) {
if (!modes || typeof modes !== "object" || Array.isArray(modes)) return; if (!modes || typeof modes !== "object" || Array.isArray(modes)) return;
delete modes[channelId]; delete modes[channelId];
set.set("stay_247_modes", modes); set.set("stay_247_modes", modes);
if (currentChannels.size === 0) { if (!currentChannels || currentChannels.size === 0) {
set.set("stay_247_mode", "off"); set.set("stay_247_mode", "off");
} else { } else {
const firstChannel = [...currentChannels][0]; const firstChannel = [...currentChannels][0];
+1 -1
View File
@@ -167,7 +167,7 @@ export async function run(message) {
const lastfmEnabled = lastfm?.enabled ?? false; const lastfmEnabled = lastfm?.enabled ?? false;
const shared = { const shared = {
guildCount: cachedGuildCount ?? this.client.guilds.size, guildCount: cachedGuildCount ?? this.client.guilds?.size ?? 0,
playerCount: getLivePlayerCount(this.players.playerMap), playerCount: getLivePlayerCount(this.players.playerMap),
scrobbleCount: 0, scrobbleCount: 0,
linkedUsers: 0, linkedUsers: 0,
+2 -1
View File
@@ -1401,10 +1401,11 @@ export class GatewayHandler {
try { try {
const set = remix.settingsMgr.getServer(guildId); const set = remix.settingsMgr.getServer(guildId);
if (set) { if (set) {
remove247ChannelMode(set, channelId);
const raw = set.get("stay_247"); const raw = set.get("stay_247");
const arr = Array.isArray(raw) ? raw : raw ? [raw] : []; const arr = Array.isArray(raw) ? raw : raw ? [raw] : [];
const filtered = arr.filter(id => id && id !== "none" && String(id).replace(/\D/g, "") !== channelId); const filtered = arr.filter(id => id && id !== "none" && String(id).replace(/\D/g, "") !== channelId);
const remainingSet = new Set(filtered.map(id => String(id).replace(/\D/g, "")));
remove247ChannelMode(set, channelId, remainingSet);
set.set("stay_247", filtered.length > 0 ? filtered : "none"); set.set("stay_247", filtered.length > 0 ? filtered : "none");
} }
} catch (cleanupErr) { } catch (cleanupErr) {
+1 -1
View File
@@ -58,7 +58,7 @@ export function remove247ChannelMode(set, channelId, currentChannels) {
if (!modes || typeof modes !== "object" || Array.isArray(modes)) return; if (!modes || typeof modes !== "object" || Array.isArray(modes)) return;
delete modes[channelId]; delete modes[channelId];
set.set("stay_247_modes", modes); set.set("stay_247_modes", modes);
if (currentChannels.size === 0) { if (!currentChannels || currentChannels.size === 0) {
set.set("stay_247_mode", "off"); set.set("stay_247_mode", "off");
} else { } else {
const firstChannel = [...currentChannels][0]; const firstChannel = [...currentChannels][0];