diff --git a/Client/app.js b/Client/app.js index 68d5d3a..092e9ff 100644 --- a/Client/app.js +++ b/Client/app.js @@ -54,7 +54,7 @@ app.use('/', indexRouter); // Discord bot control route app.use('/bot', (res, req, next) => { req.discordClient = discordClient; // Add the discord client to bot requests to be used downstream - next() + next(res, req); }, botRouter); // Local client control route diff --git a/Client/controllers/botController.js b/Client/controllers/botController.js index cb39b59..a61c606 100644 --- a/Client/controllers/botController.js +++ b/Client/controllers/botController.js @@ -23,7 +23,7 @@ function getGuilds(req) { /** * Get Status of the discord process */ -exports.getStatus = (req, res) => { +exports.getStatus = (res, req) => { guildIds = getGuilds(req); var guildStatuses = [] for (const guildID of guildIds){ @@ -33,13 +33,13 @@ exports.getStatus = (req, res) => { 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 */ -exports.joinServer = (req, res) => { +exports.joinServer = (res, req) => { const channelID = req.body.channelID; const presetName = req.body.presetName; @@ -53,8 +53,8 @@ exports.joinServer = (req, res) => { /** * Leaves the server if it's in one */ -exports.leaveServer = (req, res) => { +exports.leaveServer = (res, req) => { leave({guildID: guildID, callback: (response) => { - return req.sendStatus(202); + return res.sendStatus(202); }}); } \ No newline at end of file