Files
GMW/services/backend/src/modules/voice/voice.routes.ts
T
MythEclipseandClaude Opus 4.8 52f2968d8f fix(voice): add HTTP API fallback for transmit commands
- Add POST /api/voice/command endpoint in backend
- Frontend transmit now sends commands via dedicated WebSocket connection
  with HTTP API fallback if WebSocket fails
- Fixes issue where transmit start command was never received by discord-gateway

Previously commands were sent via the existing dashboard WebSocket,
which may not be connected when the Transmit button is pressed.
Now each command opens a fresh WebSocket connection with HTTP fallback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 22:55:11 +07:00

31 lines
797 B
TypeScript

import type { Router } from "express";
import express from "express";
import {
handleConnectVoice,
handleDisconnectVoice,
handleGetVoiceChannels,
handleGetVoiceStatus,
handleVoiceCommand,
} from "./voice.controller.js";
export function createVoiceRouter(): Router {
const router = express.Router();
// GET /api/status
router.get("/status", handleGetVoiceStatus);
// POST /api/connect
router.post("/connect", handleConnectVoice);
// POST /api/disconnect
router.post("/disconnect", handleDisconnectVoice);
// GET /api/guilds/:guildId/voice-channels
router.get("/guilds/:guildId/voice-channels", handleGetVoiceChannels);
// POST /api/command — send arbitrary voice command (transmit start/stop)
router.post("/command", handleVoiceCommand);
return router;
}