Added res/req to app.js and fixed naming bug in botcontroller

This commit is contained in:
Logan Cusano
2023-03-26 15:45:54 -04:00
parent 988683ab72
commit ccb42e7fba
2 changed files with 6 additions and 6 deletions

View File

@@ -54,7 +54,7 @@ app.use('/', indexRouter);
// Discord bot control route // Discord bot control route
app.use('/bot', (res, req, next) => { app.use('/bot', (res, req, next) => {
req.discordClient = discordClient; // Add the discord client to bot requests to be used downstream req.discordClient = discordClient; // Add the discord client to bot requests to be used downstream
next() next(res, req);
}, botRouter); }, botRouter);
// Local client control route // Local client control route

View File

@@ -23,7 +23,7 @@ function getGuilds(req) {
/** /**
* Get Status of the discord process * Get Status of the discord process
*/ */
exports.getStatus = (req, res) => { exports.getStatus = (res, req) => {
guildIds = getGuilds(req); guildIds = getGuilds(req);
var guildStatuses = [] var guildStatuses = []
for (const guildID of guildIds){ for (const guildID of guildIds){
@@ -33,13 +33,13 @@ exports.getStatus = (req, res) => {
else guildStatuses.push({ guildID: 202 }) else guildStatuses.push({ guildID: 202 })
}}); }});
} }
return req.send(200).json(guildStatuses); return res.send(200).json(guildStatuses);
} }
/** /**
* Start the bot and join the server and preset specified * Start the bot and join the server and preset specified
*/ */
exports.joinServer = (req, res) => { exports.joinServer = (res, req) => {
const channelID = req.body.channelID; const channelID = req.body.channelID;
const presetName = req.body.presetName; const presetName = req.body.presetName;
@@ -53,8 +53,8 @@ exports.joinServer = (req, res) => {
/** /**
* Leaves the server if it's in one * Leaves the server if it's in one
*/ */
exports.leaveServer = (req, res) => { exports.leaveServer = (res, req) => {
leave({guildID: guildID, callback: (response) => { leave({guildID: guildID, callback: (response) => {
return req.sendStatus(202); return res.sendStatus(202);
}}); }});
} }