Allow the client to interact with the discord bot

- The client can now interact with the bot, this allows the client to offer bot controls via API
- The master server will now be able to instruct a specific client to join a specific channel via channel ID (master server function coming soon)
- Suppress some debug statements to make the output easier to read when mixed in with the client debug output
This commit is contained in:
Logan Cusano
2022-12-18 20:31:54 -05:00
parent 6756a5e632
commit c8c75e8b37
9 changed files with 236 additions and 34 deletions

View File

@@ -1,18 +1,14 @@
var express = require('express');
const botController = require("../controllers/botController");
var router = express.Router();
/* GET users listing.
router.get('/', function(req, res, next) {
res.send('respond with a resource');
});
*/
/** 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 = online, 202 = connected, 500 + JSON = encountered error
* The status of the bot: 200 = client is online but not connected to discord, 201 = online on discord, 202 = connected to a channel, 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
@@ -21,6 +17,7 @@ router.get('/', function(req, res, next) {
* @param req.body.channelId The channel ID to join
* @param req.body.presetName The name of the preset to start listening to
*/
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
@@ -28,6 +25,7 @@ router.get('/', function(req, res, next) {
* The status of the bot: 200 = no change, 202 = changed successfully, 500 + JSON = encountered error
* @returns status
*/
router.post('/leave', botController.leaveServer);
/** POST change bot preset
* This will change the bot to the preset specified (if different from what is currently playing)