This commit is contained in:
NoLogicAlan committed 2026-05-07 22:52:16 +03:00
1 parent 87f099cc6e
commit 3ea4ac660e
6 files changed
+338 -83

No files matched your search

+17 -11
View File
@@ -507,9 +507,9 @@ export class GatewayHandler {
try { await client.users.fetch(userId).catch(() => {}); } catch (_) {}
}
if (userObj) {
// Send user update on the global :users channel
const details = {
event: "voiceStateUpdate",
userId,
type: channelId ? "join" : "leave",
guildId: resolvedGuildId,
channelId: channelId ?? null,
oldChannelId: oldChannelId ?? null,
@@ -517,19 +517,25 @@ export class GatewayHandler {
remix.dashboard.updateUser(details, userObj);
}
// Send per-player channel events for join/leave
const refChannel = channelId ?? oldChannelId;
const cleanId = refChannel ? String(refChannel).replace(/\D/g, "") : null;
const cleanId_ref = refChannel ? String(refChannel).replace(/\D/g, "") : null;
if (cleanId) {
const player = remix.players.playerMap.get(cleanId);
if (cleanId_ref) {
const player = remix.players.playerMap.get(cleanId_ref);
if (player) {
// Send "join" or "leave" on the per-player channel
// (matching Stoat format: { type, data } where data = userId)
const eventType = channelId ? "join" : "leave";
remix.dashboard.updatePlayer({
guildId: player._guildId,
channelId: player._channelId,
playing: player.playing ?? false,
paused: player.paused ?? false,
queueLength: player.queue?.length ?? 0,
});
type: eventType,
data: userId,
}, player);
// Also update the global players channel with current player state
remix.dashboard.playerUpdate({
type: eventType,
}, player);
}
}
} catch (_) {}