fix interaction acknowledged bug
This commit is contained in:
1 parent
ec0096cdd3
commit
f7b8d06bd1
3 files changed
+10
-10
No files matched your search
+8
-2
@@ -48,7 +48,10 @@ module.exports = {
|
|||||||
|
|
||||||
// If panic is disabled, enable panic
|
// If panic is disabled, enable panic
|
||||||
} else {
|
} 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 = {
|
let req = {
|
||||||
userID: user._id,
|
userID: user._id,
|
||||||
@@ -106,7 +109,10 @@ module.exports = {
|
|||||||
return;
|
return;
|
||||||
// If panic is disabled, enable panic
|
// If panic is disabled, enable panic
|
||||||
} else {
|
} 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 = {
|
let req = {
|
||||||
userID: user._id,
|
userID: user._id,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
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} \``);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -70,12 +70,7 @@ class LinesPoliceCadBot extends Client {
|
|||||||
|
|
||||||
// This is for the 'panic' command when enabling panic
|
// This is for the 'panic' command when enabling panic
|
||||||
// May be used by other interaction
|
// May be used by other interaction
|
||||||
async forceUpdateStatus(sendObject, userID, status) {
|
async forceUpdateStatus(status, user) {
|
||||||
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.`);
|
|
||||||
let onDuty=null;
|
let onDuty=null;
|
||||||
let updateDuty=false;
|
let updateDuty=false;
|
||||||
if (status=='10-41') {
|
if (status=='10-41') {
|
||||||
@@ -98,7 +93,6 @@ class LinesPoliceCadBot extends Client {
|
|||||||
const socket = io.connect(this.config.socket);
|
const socket = io.connect(this.config.socket);
|
||||||
socket.emit('bot_update_status', req);
|
socket.emit('bot_update_status', req);
|
||||||
socket.on('bot_updated_status', (res) => {
|
socket.on('bot_updated_status', (res) => {
|
||||||
sendObject.send(`Succesfully updated status to \`${status}\` <@${userID}>`);
|
|
||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user