From 2e8b6993395d939133279ae542c1a57723b6c429 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Sun, 26 Mar 2023 16:49:45 -0400 Subject: [PATCH] Fixing small bugs - Extra imports - incorrect param placement --- Client/app.js | 2 +- Client/controllers/botController.js | 6 +++--- Client/controllers/commandController.js | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Client/app.js b/Client/app.js index 4b6dc73..b813471 100644 --- a/Client/app.js +++ b/Client/app.js @@ -52,7 +52,7 @@ app.use(express.static(path.join(__dirname, 'public'))); app.use('/', indexRouter); // Discord bot control route -app.use('/bot', (res, req, next) => { +app.use('/bot', (req, res, next) => { req.discordClient = discordClient; // Add the discord client to bot requests to be used downstream next(); }, botRouter); diff --git a/Client/controllers/botController.js b/Client/controllers/botController.js index 4448bfb..3c218d2 100644 --- a/Client/controllers/botController.js +++ b/Client/controllers/botController.js @@ -16,7 +16,7 @@ function getGuilds(req) { /** * Get Status of the discord process */ -exports.getStatus = (res, req) => { +exports.getStatus = (req, res) => { log.INFO("Getting the status of the bot"); guildIds = getGuilds(req); log.DEBUG("Guild IDs: ", guildIds); @@ -34,7 +34,7 @@ exports.getStatus = (res, req) => { /** * Start the bot and join the server and preset specified */ -exports.joinServer = (res, req) => { +exports.joinServer = (req, res) => { const channelID = req.body.channelID; const presetName = req.body.presetName; @@ -48,7 +48,7 @@ exports.joinServer = (res, req) => { /** * Leaves the server if it's in one */ -exports.leaveServer = (res, req) => { +exports.leaveServer = (req, res) => { leave({guildID: guildID, callback: (response) => { return res.sendStatus(202); }}); diff --git a/Client/controllers/commandController.js b/Client/controllers/commandController.js index 73df9de..8e617b0 100644 --- a/Client/controllers/commandController.js +++ b/Client/controllers/commandController.js @@ -2,12 +2,11 @@ const { DebugBuilder } = require("../utilities/debugBuilder.js"); const log = new DebugBuilder("client-bot", "commandController"); // Modules -const {getVoiceConnection} = require("@discordjs/voice"); -const {replyToInteraction} = require("../utilities/messageHandler.js"); const { joinVoiceChannel, VoiceConnectionStatus, getVoiceConnection } = require("@discordjs/voice"); +const { OpusEncoder } = require("@discordjs/opus"); +// Utilities const {replyToInteraction} = require("../utilities/messageHandler.js"); const {createAudioInstance} = require("../controllers/audioController.js"); -const { OpusEncoder } = require("@discordjs/opus"); // Declare the encoder const encoder = new OpusEncoder(48000, 2);