diff --git a/commands/panic.js b/commands/panic.js index 21a92b4..949de63 100644 --- a/commands/panic.js +++ b/commands/panic.js @@ -48,7 +48,10 @@ module.exports = { // If panic is disabled, enable panic } else { - client.forceUpdateStatus(message.channel, message.author.id, 'Panic'); + let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user); + if (!user) return message.channel.send(`You are not logged in.`); + if (user.user.activeCommunity==null) return message.channel.send(`You must join a community to use this command.`); + client.forceUpdateStatus('Panic', user); let req = { userID: user._id, @@ -106,7 +109,10 @@ module.exports = { return; // If panic is disabled, enable panic } else { - client.forceUpdateStatus(interaction, interaction.member.user.id, 'Panic'); + let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user); + if (!user) return interaction.send(`You are not logged in.`); + if (user.user.activeCommunity==null) return interaction.send(`You must join a community to use this command.`); + client.forceUpdateStatus('Panic', user); let req = { userID: user._id, diff --git a/commands/pingOnPanic.js b/commands/pingOnPanic.js index 8c6d779..79504f1 100644 --- a/commands/pingOnPanic.js +++ b/commands/pingOnPanic.js @@ -35,7 +35,7 @@ module.exports = { } let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild); - return interaction.send(`Current Ping on Panic Status: \` ${guild.server.pingOnPanic.toString().toUpperCase()} \``); + return interaction.send(`Current Ping on Panic Status: \` ${guild.server.pingOnPanic} \``); }, }, } \ No newline at end of file diff --git a/structures/LinesPoliceCadBot.js b/structures/LinesPoliceCadBot.js index 8a3ea55..8e36d19 100644 --- a/structures/LinesPoliceCadBot.js +++ b/structures/LinesPoliceCadBot.js @@ -70,12 +70,7 @@ class LinesPoliceCadBot extends Client { // This is for the 'panic' command when enabling panic // May be used by other interaction - async forceUpdateStatus(sendObject, userID, status) { - let validStatus=['10-8','10-7','10-6','10-11','10-23','10-97','10-15','10-70','10-80', '10-41', '10-42', 'Panic']; - let user = await this.dbo.collection("users").findOne({"user.discord.id":userID}).then(user => user); - if (!user) return returnMessage(`You are not logged in <@${userID}>`); - if (user.user.activeCommunity==null) return returnMessage(`You must join a community to use this command.`); - if (!validStatus.includes(status)) return returnMessage(`\`${status}\` is a Invalid Status.`); + async forceUpdateStatus(status, user) { let onDuty=null; let updateDuty=false; if (status=='10-41') { @@ -98,7 +93,6 @@ class LinesPoliceCadBot extends Client { const socket = io.connect(this.config.socket); socket.emit('bot_update_status', req); socket.on('bot_updated_status', (res) => { - sendObject.send(`Succesfully updated status to \`${status}\` <@${userID}>`); socket.disconnect(); }); }