mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
test
This commit is contained in:
1 parent
adbd0ccfd5
commit
7b201a74b3
1 file changed
+9
-16
@@ -1006,20 +1006,9 @@ class Remix {
|
|||||||
// Use the player's actual current _channelId — NOT the playerMap key.
|
// Use the player's actual current _channelId — NOT the playerMap key.
|
||||||
// When the bot moves channels the playerMap key stays as the old channel
|
// When the bot moves channels the playerMap key stays as the old channel
|
||||||
// but _channelId is updated inside join(). Using the stale key means
|
// but _channelId is updated inside join(). Using the stale key means
|
||||||
// _is247Enabled() checks the wrong channel against stay_247, always
|
// _is247Enabled() checks the wrong channel against stay_247.
|
||||||
// returns false, and the bot leaves even with 247 active.
|
|
||||||
const channelId = player._channelId ?? mapKey;
|
const channelId = player._channelId ?? mapKey;
|
||||||
|
|
||||||
// Re-key the playerMap if the player has moved to a different channel.
|
|
||||||
// This keeps the map consistent so future lookups work correctly.
|
|
||||||
const cleanMapKey = String(mapKey).replace(/\D/g, "");
|
|
||||||
const cleanChanId = String(channelId).replace(/\D/g, "");
|
const cleanChanId = String(channelId).replace(/\D/g, "");
|
||||||
if (cleanChanId && cleanChanId !== cleanMapKey) {
|
|
||||||
this.players.playerMap.delete(mapKey);
|
|
||||||
if (!this.players.playerMap.has(cleanChanId)) {
|
|
||||||
this.players.playerMap.set(cleanChanId, player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip if 247 is on or auto
|
// Skip if 247 is on or auto
|
||||||
if (player._is247Enabled()) continue;
|
if (player._is247Enabled()) continue;
|
||||||
@@ -1308,7 +1297,10 @@ process.on("uncaughtException", (err, origin) => {
|
|||||||
for (const t of queueData) tracksToSave.push(cloneTrack(t));
|
for (const t of queueData) tracksToSave.push(cloneTrack(t));
|
||||||
state.push({
|
state.push({
|
||||||
guildId: player._guildId,
|
guildId: player._guildId,
|
||||||
channelId,
|
// Use _channelId (the player's actual current channel) not the map
|
||||||
|
// key — they can differ after a channel move where the map wasn't
|
||||||
|
// re-keyed. Saving the wrong channel causes a ghost player on recovery.
|
||||||
|
channelId: player._channelId ?? channelId,
|
||||||
textChannelId: player.textChannel?.id ?? player.textChannel?._id,
|
textChannelId: player.textChannel?.id ?? player.textChannel?._id,
|
||||||
queue: tracksToSave,
|
queue: tracksToSave,
|
||||||
loopQueue: player.queue.loop,
|
loopQueue: player.queue.loop,
|
||||||
@@ -1348,11 +1340,12 @@ const saveAndExit = () => {
|
|||||||
if (current) tracksToSave.push(cloneTrack(current));
|
if (current) tracksToSave.push(cloneTrack(current));
|
||||||
for (const t of queueData) tracksToSave.push(cloneTrack(t));
|
for (const t of queueData) tracksToSave.push(cloneTrack(t));
|
||||||
|
|
||||||
// Save ALL active sessions unconditionally so the bot always rejoins
|
|
||||||
// the channel it was in before rebooting (queue or not, 24/7 or not)
|
|
||||||
state.push({
|
state.push({
|
||||||
guildId: player._guildId,
|
guildId: player._guildId,
|
||||||
channelId: channelId,
|
// Use _channelId (the player's actual current channel) not the map
|
||||||
|
// key — they can differ after a channel move. Saving the stale map key
|
||||||
|
// causes a ghost player on recovery that _is247Enabled() can't match.
|
||||||
|
channelId: player._channelId ?? channelId,
|
||||||
textChannelId: player.textChannel?.id ?? player.textChannel?._id,
|
textChannelId: player.textChannel?.id ?? player.textChannel?._id,
|
||||||
queue: tracksToSave,
|
queue: tracksToSave,
|
||||||
loopQueue: player.queue.loop,
|
loopQueue: player.queue.loop,
|
||||||
|
|||||||
Reference in new issue
Block a user