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
a4991d7047
commit
687908ae0c
3 files changed
+51
-8
No files matched your search
+12
-7
@@ -12,13 +12,18 @@ export const command = new CommandBuilder()
|
|||||||
.setRequired(true));
|
.setRequired(true));
|
||||||
|
|
||||||
export async function run(msg, data) {
|
export async function run(msg, data) {
|
||||||
const log = data.get("id").value;
|
const code = data.get("id").value;
|
||||||
const verified = await this.loadedModules.get("wb-dashboard").instance.login(log, msg.author);
|
|
||||||
const desc = (typeof verified === "string")
|
if (!this.dashboard?.enabled) {
|
||||||
? "❌ Login failed! Reason: `" + verified + "`. If this is an error and the issue persists, please contact a team member through the server in my description."
|
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("❌ The dashboard is not enabled on this bot.").toJSON();
|
||||||
: (verified === true)
|
return msg.replyEmbed({ embeds: [embed] });
|
||||||
? "✅ Login succeeded! You can continue to the webpage now."
|
}
|
||||||
: "⚠️ An unknown error occurred. Please contact a team member if this issue persists!";
|
|
||||||
|
const error = await this.dashboard.confirmLogin(msg.author.id, code);
|
||||||
|
const desc = (error === null)
|
||||||
|
? "✅ Login succeeded! You can continue to the webpage now."
|
||||||
|
: "❌ Login failed! Reason: `" + error + "`. If this is an error and the issue persists, please contact a team member through the server in my description.";
|
||||||
|
|
||||||
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON();
|
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON();
|
||||||
msg.replyEmbed({ embeds: [embed] });
|
msg.replyEmbed({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
@@ -942,7 +942,7 @@ export class Remix {
|
|||||||
logger.guild(`[GuildDelete] Cleanup complete for server ${guildId}.`);
|
logger.guild(`[GuildDelete] Cleanup complete for server ${guildId}.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on(Events.VoiceStateUpdate, (data) => {
|
client.on(Events.VoiceStateUpdate, async (data) => {
|
||||||
// data is the raw GatewayVoiceStateUpdateDispatchData — always snake_case
|
// data is the raw GatewayVoiceStateUpdateDispatchData — always snake_case
|
||||||
const userId = data?.user_id;
|
const userId = data?.user_id;
|
||||||
if (!userId) return;
|
if (!userId) return;
|
||||||
@@ -1037,6 +1037,23 @@ export class Remix {
|
|||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify dashboard of per-user voice-state change (join / leave / move)
|
||||||
|
if (this.dashboard?.enabled) {
|
||||||
|
try {
|
||||||
|
const userObj = data?.member?.user ?? await client.users.fetch(userId).catch(() => null);
|
||||||
|
if (userObj) {
|
||||||
|
const details = {
|
||||||
|
event: "voiceStateUpdate",
|
||||||
|
userId,
|
||||||
|
guildId: resolvedGuildId,
|
||||||
|
channelId: channelId ?? null,
|
||||||
|
oldChannelId: oldChannelId ?? null,
|
||||||
|
};
|
||||||
|
this.dashboard.updateUser(details, userObj);
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,8 +118,27 @@ export class PlayerManager {
|
|||||||
this.dashboard.updatePlayer(payload, player);
|
this.dashboard.updatePlayer(payload, player);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Broadcast user list changes to the global :users channel when
|
||||||
|
// someone joins or leaves the player's voice channel.
|
||||||
|
const sendUserUpdates = (event) => {
|
||||||
|
if (!this.dashboard?.enabled) return;
|
||||||
|
const channelId = getPlayerChannelId(player, context.channelId);
|
||||||
|
const channel = player.client?.channels?.cache?.get(channelId);
|
||||||
|
if (!channel?.members) return;
|
||||||
|
for (const member of channel.members.values()) {
|
||||||
|
if (member.user?.bot) continue;
|
||||||
|
const details = {
|
||||||
|
event,
|
||||||
|
guildId: cleanId(player._guildId ?? context.guildId),
|
||||||
|
channelId,
|
||||||
|
};
|
||||||
|
this.dashboard.userUpdate(details, member.user);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
player.on("roomfetched", () => {
|
player.on("roomfetched", () => {
|
||||||
sendDashboardUpdate("roomfetched", { state: "connected" });
|
sendDashboardUpdate("roomfetched", { state: "connected" });
|
||||||
|
sendUserUpdates("roomfetched");
|
||||||
});
|
});
|
||||||
|
|
||||||
player.on("startplay", () => {
|
player.on("startplay", () => {
|
||||||
@@ -156,6 +175,7 @@ export class PlayerManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
player.on("autoleave", () => {
|
player.on("autoleave", () => {
|
||||||
|
sendUserUpdates("autoleave");
|
||||||
sendDashboardUpdate("autoleave", {
|
sendDashboardUpdate("autoleave", {
|
||||||
state: "disconnected",
|
state: "disconnected",
|
||||||
reason: "inactivity",
|
reason: "inactivity",
|
||||||
@@ -163,6 +183,7 @@ export class PlayerManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
player.on("leave", () => {
|
player.on("leave", () => {
|
||||||
|
sendUserUpdates("leave");
|
||||||
sendDashboardUpdate("leave", {
|
sendDashboardUpdate("leave", {
|
||||||
state: "disconnected",
|
state: "disconnected",
|
||||||
reason: "manual",
|
reason: "manual",
|
||||||
|
|||||||
Reference in new issue
Block a user