mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
dashboard tests
This commit is contained in:
1 parent
9366bbe95a
commit
37c29ca6cd
3 files changed
+44
-30
No files matched your search
@@ -184,30 +184,23 @@ export class Dashboard {
|
||||
return { message: "Adding to queue" };
|
||||
}
|
||||
|
||||
case "testConnection": {
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
case "leave": {
|
||||
if (!user) return { error: "Invalid user" };
|
||||
const channelId = params.data.channel;
|
||||
if (!channelId) return { error: "Missing channel ID" };
|
||||
const player = this._getPlayerById(channelId);
|
||||
const player = this._getPlayerById(params.data.channel);
|
||||
if (!player) return { error: "Player not found" };
|
||||
const authErr = this._authorizePlayerControl(user, player);
|
||||
const authErr = await this._authorizeUserInGuild(user, player._guildId);
|
||||
if (authErr) return { error: authErr };
|
||||
try {
|
||||
await player.leave();
|
||||
player.destroy();
|
||||
const activeChannelId = player._channelId ?? channelId;
|
||||
this.remix.players.playerMap.delete(activeChannelId);
|
||||
return { message: "Left channel" };
|
||||
} catch (e) {
|
||||
logger.dashboard("[Dashboard] Leave error:", e.message);
|
||||
return { error: "Failed to leave channel: " + e.message };
|
||||
return { error: "Failed to leave: " + e.message };
|
||||
}
|
||||
}
|
||||
|
||||
case "testConnection": {
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
default:
|
||||
return { error: "Unknown function: " + (params.func ?? "(none)") };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user