From 9d449c7a149650bd9f552fe4bf740a8f919cd656 Mon Sep 17 00:00:00 2001 From: NoLogicAlan Date: Wed, 2 Sep 2026 01:02:24 +0300 Subject: [PATCH] ... --- commands/leave.mjs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/commands/leave.mjs b/commands/leave.mjs index 37488b1..150b1e6 100644 --- a/commands/leave.mjs +++ b/commands/leave.mjs @@ -121,7 +121,7 @@ export async function run(msg, data) { ? raw.map(id => cleanId(id)).some(id => id === activeChannelId || id === homeChannelId) : [cleanId(raw)].some(id => id === activeChannelId || id === homeChannelId)); - this.markIntentionalLeave(activeChannelId); + if (!was247) this.markIntentionalLeave(activeChannelId); this.players.playerMap.delete(activeChannelId); this.players._unindexPlayer(player._guildId, activeChannelId); if (activeChannelId !== targetChannelId) this.players.playerMap.delete(targetChannelId); @@ -136,6 +136,19 @@ export async function run(msg, data) { await player.leave().catch(() => {}); player.destroy(); - const label247 = was247 ? " (24/7 still saved — use `" + this.handler.getPrefix(cleanGuildId) + "247` to disable it.)" : ""; + if (was247) { + const rejoinDelay = this.config?.timers?.leave247RejoinDelay + ?? this.config?.timers?.rejoin247Delay + ?? 3_000; + setTimeout(() => { + this.gatewayHandler?._rejoinChannel?.(cleanGuildId, targetChannelId).catch(err => { + logger.warn(`[Leave] 24/7 rejoin failed for channel ${targetChannelId}:`, err?.message); + }); + }, rejoinDelay); + } + + const label247 = was247 + ? " (rejoining in " + Math.round(rejoinDelay / 1000) + "s — 24/7 is still saved. Use `" + this.handler.getPrefix(cleanGuildId) + "247` to disable it.)" + : ""; msg.reply(this.t(msg, "responses.leave.left") + label247); }