This commit is contained in:
NoLogicAlan committed 2026-05-28 18:28:23 +03:00
1 parent 93ab04691c
commit 5359498d12
8 files changed
+19 -15

No files matched your search

+1 -1
View File
@@ -196,7 +196,7 @@ export async function run(message, data) {
return message.reply({ embeds: [embed] }); return message.reply({ embeds: [embed] });
} }
this.players.initPlayer(message, cid); return this.players.initPlayer(message, cid);
} }
export const exportDef = { export const exportDef = {
+1 -1
View File
@@ -44,7 +44,7 @@ export async function run(msg) {
const player = await this.getPlayer(msg, false, false, false); const player = await this.getPlayer(msg, false, false, false);
if (!player) return; if (!player) return;
const timeout = Math.max(60_000, this.config?.timers?.playerSessionTimeout ?? this.config.playerAFKTimeout ?? 300000); const timeout = Math.max(60_000, this.config?.timers?.playerSessionTimeout ?? this.config?.playerAFKTimeout ?? 300000);
const controlsLayout = [ const controlsLayout = [
[CONTROLS.prev, CONTROLS.play, CONTROLS.pause, CONTROLS.stop, CONTROLS.next], [CONTROLS.prev, CONTROLS.play, CONTROLS.pause, CONTROLS.stop, CONTROLS.next],
[CONTROLS.loop, CONTROLS.shuffle, CONTROLS.volDown, CONTROLS.volUp, CONTROLS.lyrics], [CONTROLS.loop, CONTROLS.shuffle, CONTROLS.volDown, CONTROLS.volUp, CONTROLS.lyrics],
+3 -3
View File
@@ -805,8 +805,8 @@ export class Remix {
async leaveChannel(channelId, guildId, message, force = false) { async leaveChannel(channelId, guildId, message, force = false) {
const cleanId = String(channelId).replace(/\D/g, ""); const cleanId = String(channelId).replace(/\D/g, "");
const cleanGuildId = String(guildId).replace(/\D/g, ""); const cleanGuildId = String(guildId).replace(/\D/g, "");
const set = this.settingsMgr.getServer(guildId); const set = this.settingsMgr.getServer(cleanGuildId);
const raw = set.get("stay_247"); const raw = set?.get("stay_247");
const channels = (!raw || raw === "none") const channels = (!raw || raw === "none")
? new Set() ? new Set()
@@ -897,7 +897,7 @@ export class Remix {
const shared = []; const shared = [];
for (const guild of this.client.guilds.values()) { for (const guild of this.client.guilds?.values?.() ?? []) {
let isMember = false; let isMember = false;
if (guild.members?.has?.(user.id)) { if (guild.members?.has?.(user.id)) {
+1 -1
View File
@@ -210,7 +210,7 @@ export class MySqlSettingsManager extends SettingsManager {
this._loadAttempts = (this._loadAttempts || 0) + 1; this._loadAttempts = (this._loadAttempts || 0) + 1;
const delay = Math.min(1000 * Math.pow(2, this._loadAttempts - 1), 30_000); const delay = Math.min(1000 * Math.pow(2, this._loadAttempts - 1), 30_000);
logger.error("[Settings] Init error (attempt", this._loadAttempts, "retrying in", delay + "ms):", res.error); logger.error("[Settings] Init error (attempt", this._loadAttempts, "retrying in", delay + "ms):", res.error);
return setTimeout(() => { this.load().catch(err => logger.error("[Settings] Retry load error:", err?.message ?? err)); }, delay); return new Promise((resolve) => { setTimeout(() => { this.load().then(resolve).catch(resolve); }, delay); });
} }
this._loadAttempts = 0; this._loadAttempts = 0;
res.results.forEach((r) => { res.results.forEach((r) => {
+8 -7
View File
@@ -765,8 +765,10 @@ export class GatewayHandler {
remix.voiceCache.updateUser({ guildId: guildId ?? prev?.guildId, userId, channelId, isBot: isBot === true }); remix.voiceCache.updateUser({ guildId: guildId ?? prev?.guildId, userId, channelId, isBot: isBot === true });
} else { } else {
const resolvedGuildId = guildId ?? prev?.guildId; const resolvedGuildId = guildId ?? prev?.guildId;
remix.voiceCache.deleteHumanUser(userId, resolvedGuildId); if (resolvedGuildId) {
remix.voiceCache.deleteBotUser(VoiceStateCache.userKey(resolvedGuildId, userId)); remix.voiceCache.deleteHumanUser(userId, resolvedGuildId);
remix.voiceCache.deleteBotUser(VoiceStateCache.userKey(resolvedGuildId, userId));
}
} }
const isBotUser = isBot === true && userId === client.user?.id; const isBotUser = isBot === true && userId === client.user?.id;
@@ -814,9 +816,9 @@ export class GatewayHandler {
if (remix.dashboard?.enabled) { if (remix.dashboard?.enabled) {
try { try {
const userObj = data?.member?.user; let userObj = data?.member?.user;
if (!userObj) { if (!userObj) {
try { await client.users.fetch(userId).catch(() => {}); } catch (_) {} try { userObj = await client.users.fetch(userId).catch(() => null); } catch (_) {}
} }
if (userObj) { if (userObj) {
const details = { const details = {
@@ -975,7 +977,7 @@ export class GatewayHandler {
} }
const set = remix.settingsMgr.getServer(guildId); const set = remix.settingsMgr.getServer(guildId);
const raw = set.get("stay_247"); const raw = set?.get("stay_247");
if ((rekeyed || existingPlayer) && raw && raw !== "none") { if ((rekeyed || existingPlayer) && raw && raw !== "none") {
const channels = Array.isArray(raw) const channels = Array.isArray(raw)
? new Set(raw.map(id => String(id).replace(/\D/g, "")).filter(id => id.length >= 15)) ? new Set(raw.map(id => String(id).replace(/\D/g, "")).filter(id => id.length >= 15))
@@ -1181,7 +1183,6 @@ export class GatewayHandler {
`[Rejoin] Track publication failed for channel ${cleanChannelId} (attempt ${attempt}/${maxRetries}) — ` + `[Rejoin] Track publication failed for channel ${cleanChannelId} (attempt ${attempt}/${maxRetries}) — ` +
`retrying in ${backoffMs / 1000}s: ${errMsg}` `retrying in ${backoffMs / 1000}s: ${errMsg}`
); );
this._rejoinInProgress.delete(cleanChannelId);
await new Promise(resolve => setTimeout(resolve, backoffMs)); await new Promise(resolve => setTimeout(resolve, backoffMs));
@@ -1547,7 +1548,7 @@ export class GatewayHandler {
} }
remix.settingsMgr.removeServer(guildId); remix.settingsMgr.removeServer(guildId);
remix._announcementChannelCache.delete(guildId); remix._announcementChannelCache?.delete(guildId);
if (!batchMode) logger.guild(`[GuildDelete] Cleanup complete for server ${guildId}.`); if (!batchMode) logger.guild(`[GuildDelete] Cleanup complete for server ${guildId}.`);
} }
+4
View File
@@ -788,6 +788,7 @@ export class PlayerManager {
const channel = this.commands.client?.channels?.get(cid); const channel = this.commands.client?.channels?.get(cid);
if (!channel) { if (!channel) {
cb(null);
return message.reply(mkEmbed( return message.reply(mkEmbed(
this._t(message, "responses.join.channelNotFound", { channel: cid }) this._t(message, "responses.join.channelNotFound", { channel: cid })
)); ));
@@ -796,10 +797,12 @@ export class PlayerManager {
const isVoice = channel.type === 2; const isVoice = channel.type === 2;
if (!isVoice) { if (!isVoice) {
cb(null);
return message.reply(mkEmbed(this._t(message, "responses._common.voiceChannelRequired"))); return message.reply(mkEmbed(this._t(message, "responses._common.voiceChannelRequired")));
} }
if (!botHasVoicePermissions(this.commands?.client, cid)) { if (!botHasVoicePermissions(this.commands?.client, cid)) {
cb(null);
return message.reply(mkEmbed( return message.reply(mkEmbed(
this._t(message, "responses.join.joinFailedPerms", { channel: `<#${cleanId(cid)}>` }) this._t(message, "responses.join.joinFailedPerms", { channel: `<#${cleanId(cid)}>` })
)); ));
@@ -814,6 +817,7 @@ export class PlayerManager {
return message.reply(mkEmbed(this._t(message, "responses.join.alreadyJoined", { channel: cid }))); return message.reply(mkEmbed(this._t(message, "responses.join.alreadyJoined", { channel: cid })));
} }
if (this._pendingJoins.has(cleanChannelId)) { if (this._pendingJoins.has(cleanChannelId)) {
cb(null);
return message.reply(mkEmbed(this._t(message, "responses.join.joining"))); return message.reply(mkEmbed(this._t(message, "responses.join.joining")));
} }
this._pendingJoins.add(cleanChannelId); this._pendingJoins.add(cleanChannelId);
+1 -1
View File
@@ -218,7 +218,7 @@ export class RemoteSettingsManager extends EventEmitter {
this._loadAttempts++; this._loadAttempts++;
const delay = Math.min(1000 * Math.pow(2, this._loadAttempts - 1), 30_000); const delay = Math.min(1000 * Math.pow(2, this._loadAttempts - 1), 30_000);
logger.error("[Settings] Init error (attempt", this._loadAttempts, "retrying in", delay + "ms):", res.error); logger.error("[Settings] Init error (attempt", this._loadAttempts, "retrying in", delay + "ms):", res.error);
return setTimeout(() => { this.load().catch(err => logger.error("[Settings] Retry load error:", err?.message ?? err)); }, delay); return new Promise((resolve) => { setTimeout(() => { this.load().then(resolve).catch(resolve); }, delay); });
} }
this._loadAttempts = 0; this._loadAttempts = 0;
res.results.forEach((r) => { res.results.forEach((r) => {
-1
View File
@@ -100,7 +100,6 @@ export class Utils {
static chunk(array, size) { static chunk(array, size) {
if (!Array.isArray(array)) return []; if (!Array.isArray(array)) return [];
const chunkSize = Math.max(1, Math.floor(size)); const chunkSize = Math.max(1, Math.floor(size));
if (chunkSize < 1) return [];
const chunks = []; const chunks = [];
for (let i = 0; i < array.length; i += chunkSize) { for (let i = 0; i < array.length; i += chunkSize) {
chunks.push(array.slice(i, i + chunkSize)); chunks.push(array.slice(i, i + chunkSize));