feature/disbale emp+uav commands
This commit is contained in:
6 files changed
+62
-6
No files matched your search
+53
-1
@@ -330,7 +330,33 @@ module.exports = {
|
|||||||
type: CommandOptions.Integer,
|
type: CommandOptions.Integer,
|
||||||
min_value: 0,
|
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: {
|
SlashCommand: {
|
||||||
/**
|
/**
|
||||||
@@ -739,6 +765,32 @@ module.exports = {
|
|||||||
|
|
||||||
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:
|
default:
|
||||||
return client.sendInternalError(interaction, 'There was an error parsing the config command');
|
return client.sendInternalError(interaction, 'There was an error parsing the config command');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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');
|
const { createUser, addUser } = require('../database/user');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -21,10 +21,10 @@ module.exports = {
|
|||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
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);
|
let banking = await client.dbo.collection("users").findOne({"user.userID": interaction.member.user.id}).then(banking => banking);
|
||||||
|
|
||||||
|
|
||||||
if (!banking) {
|
if (!banking) {
|
||||||
banking = await createUser(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance, client)
|
banking = await createUser(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance, client)
|
||||||
if (!client.exists(banking)) return client.sendInternalError(interaction, err);
|
if (!client.exists(banking)) return client.sendInternalError(interaction, err);
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ module.exports = {
|
|||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
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);
|
let banking = await client.dbo.collection("users").findOne({"user.userID": interaction.member.user.id}).then(banking => banking);
|
||||||
|
|
||||||
|
|
||||||
if (!banking) {
|
if (!banking) {
|
||||||
banking = await createUser(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance, client)
|
banking = await createUser(interaction.member.user.id, GuildDB.serverID, GuildDB.startingBalance, client)
|
||||||
if (!client.exists(banking)) return client.sendInternalError(interaction, err);
|
if (!client.exists(banking)) return client.sendInternalError(interaction, err);
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ module.exports = {
|
|||||||
getDefaultSettings(GuildId) {
|
getDefaultSettings(GuildId) {
|
||||||
return {
|
return {
|
||||||
serverID: GuildId,
|
serverID: GuildId,
|
||||||
autoRestart: 0,
|
autoRestart: 0, //
|
||||||
showKillfeedCoords: 0,
|
showKillfeedCoords: 0,
|
||||||
|
purchaseUAV: 1, // Allow/Disallow purchase of UAVs
|
||||||
|
purchaseEMP: 1, // Allow/Disallow purchase of EMPs
|
||||||
allowedChannels: [],
|
allowedChannels: [],
|
||||||
|
|
||||||
killfeedChannel: "",
|
killfeedChannel: "",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dayzr-bot",
|
"name": "dayzr-bot",
|
||||||
"version": "11.0.1",
|
"version": "11.1.0",
|
||||||
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
|
|||||||
@@ -444,6 +444,8 @@ class DayzRBot extends Client {
|
|||||||
memberRole: guild.server.memberRole,
|
memberRole: guild.server.memberRole,
|
||||||
adminRole: guild.server.adminRole,
|
adminRole: guild.server.adminRole,
|
||||||
combatLogTimer: guild.server.combatLogTimer,
|
combatLogTimer: guild.server.combatLogTimer,
|
||||||
|
purchaseUAV: guild.server.purchaseUAV,
|
||||||
|
purchaseEMP: guild.server.purchaseEMP,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user