feature/disbale emp+uav commands

This commit is contained in:
SowinskiBraeden committed 2023-10-21 21:23:36 -07:00
1 parent 3a29aaf316
commit 1d1698c8c4
6 files changed
+64 -8

No files matched your search

+54 -2
View File
@@ -330,7 +330,33 @@ module.exports = {
type: CommandOptions.Integer,
min_value: 0,
}]
}
},
{
name: "toggle-uav-purchase",
description: "Allow/Disallow UAV purchases",
value: "toggle-uav-purchase",
type: CommandOptions.SubCommand,
options: [{
name: "configuration",
description: "True or False",
value: false,
type: CommandOptions.Boolean,
required: true,
}]
},
{
name: "toggle-emp-purchase",
description: "Allow/Disallow EMP purchases",
value: "toggle-uav-purchase",
type: CommandOptions.SubCommand,
options: [{
name: "configuration",
description: "True or False",
value: false,
type: CommandOptions.Boolean,
required: true,
}]
},
],
SlashCommand: {
/**
@@ -737,7 +763,33 @@ module.exports = {
.setColor(client.config.Colors.Green)
.setDescription(`Successfully set combat log timer to **${args[0].options[0].value.toFixed(0)} minutes.**`);
return interaction.send({ embeds: [successCobatLogTimerEmbed] });
return interaction.send({ embeds: [successCobatLogTimerEmbed] });
case 'toggle-uav-purchase':
const togggleUAVpurchase = args[0].options[0].value ? 1 : 0;
client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.purchaseUAV": togggleUAVpurchase}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err);
});
let successToggleUAVpurchaseEmbed = new EmbedBuilder()
.setColor(client.config.Colors.Green)
.setDescription(`Users can ${togggleUAVpurchase ? 'now' : 'no longer'} purchase UAVs.`);
return interaction.send({ embeds: [successToggleUAVpurchaseEmbed] });
case 'toggle-emp-purchase':
const togggleEMPpurchase = args[0].options[0].value ? 1 : 0;
client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.purchaseEMP": togggleEMPpurchase}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err);
});
let successToggleEMPpurchaseEmbed = new EmbedBuilder()
.setColor(client.config.Colors.Green)
.setDescription(`Users can ${togggleUAVpurchase ? 'now' : 'no longer'} purchase EMPs.`);
return interaction.send({ embeds: [successToggleEMPpurchaseEmbed] });
default:
return client.sendInternalError(interaction, 'There was an error parsing the config command');
+2 -2
View File
@@ -1,4 +1,4 @@
const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require('discord.js');
const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, Embed } = require('discord.js');
const { createUser, addUser } = require('../database/user');
module.exports = {
@@ -21,9 +21,9 @@ module.exports = {
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
if (client.exists(GuildDB.purchaseEMP) && !GuildDB.purchaseEMP) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Yellow).setDescription('**Notice:** The admins have disabled this feature')] });
let banking = await client.dbo.collection("users").findOne({"user.userID": interaction.member.user.id}).then(banking => banking);
if (!banking) {
banking = await createUser(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance, client)
+1 -1
View File
@@ -39,10 +39,10 @@ module.exports = {
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
if (client.exists(GuildDB.purchaseUAV) && !GuildDB.purchaseUAV) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Yellow).setDescription('**Notice:** The admins have disabled this feature')] });
let banking = await client.dbo.collection("users").findOne({"user.userID": interaction.member.user.id}).then(banking => banking);
if (!banking) {
banking = await createUser(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance, client)
if (!client.exists(banking)) return client.sendInternalError(interaction, err);