const express = require('express'); const router = express.Router(); const botController = require("../controllers/botController"); /** GET bot status * Check to see if the bot is online and if so, if it is currently connected to anything * * The status of the bot: 200 = connected to discord, 201 = not connected to discord, 500 + JSON = encountered error * @returns status */ router.get('/status', botController.getStatus); /** POST bot join channel * Join the channel specified listening to the specified freq/mode * * @param req The request sent from the master * @param req.body.channelId The channel ID to join * @param req.body.clientId The discord Client ID to use when connecting to the server * @param req.body.presetName The name of the preset to start listening to * @param req.body.NGThreshold [OPTIONAL] The noisegate threshold, this will default to 50 */ router.post('/join', botController.joinServer); /** POST bot leave channel * Will leave the channel it is currently listening to if any, otherwise it will just return that it is not connected * * The status of the bot: 200 = no change, 202 = changed successfully, 500 + JSON = encountered error * @returns status */ router.post('/leave', botController.leaveServer); /** POST bot start recording * If the bot is in a channel, it will start to record what it hears * * The status of the bot: 200 = starting to record, 202 = already recording, 204 = not in a server, 500 + JSON = encountered error * @returns status */ router.post('/startRecording', botController.startRecording); /** POST bot stop recording * If the bot is recording, it will stop recording * * The status of the bot: 200 = will stop the recording, 204 = not currently recording, 500 + JSON = encountered error * @returns status */ router.post('/stopRecording', botController.stopRecording); module.exports = router;