Added res/req to app.js and fixed naming bug in botcontroller
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user