con/discon

This commit is contained in:
2025-12-12 23:07:27 -08:00
parent 9ae5cb2e35
commit 7c322424cf
3 changed files with 51 additions and 3 deletions

View File

@@ -36,4 +36,23 @@ router.post('/join', async (req, res) => {
}
});
// Disconnect from voice channel
router.post('/disconnect', async (req, res) => {
try {
const response = await fetch(`${req.app.locals.botUrl}/disconnect`, {
method: 'POST'
});
const result = await response.json();
if (response.ok) {
req.app.locals.broadcast('channelChange', { disconnected: true });
}
res.status(response.status).json(result);
} catch (error) {
req.app.locals.logger.error(`Error disconnecting: ${error.message}`);
res.status(500).json({ error: 'Failed to disconnect' });
}
});
export default router;