update/capitalize descriptions + tidy money command

This commit is contained in:
SowinskiBraeden committed 2024-01-27 14:35:37 -08:00
1 parent 3b56c013cf
commit d805918454
2 files changed
+25 -26

No files matched your search

+24 -25
View File
@@ -17,7 +17,7 @@ module.exports = {
}, },
options: [{ options: [{
name: "gamertag-link", name: "gamertag-link",
description: "link a gamertag for a user", description: "Link a gamertag for a user",
value: "gamertag-link", value: "gamertag-link",
type: CommandOptions.SubCommand, type: CommandOptions.SubCommand,
options: [{ options: [{
@@ -36,7 +36,7 @@ module.exports = {
}] }]
}, { }, {
name: "gamertag-unlink", name: "gamertag-unlink",
description: "unlink a gamertag for a user", description: "Unlink a gamertag for a user",
value: "gamertag-unlink", value: "gamertag-unlink",
type: CommandOptions.SubCommand, type: CommandOptions.SubCommand,
options: [{ options: [{
@@ -60,7 +60,7 @@ module.exports = {
}] }]
}, { }, {
name: "bounty-clear", name: "bounty-clear",
description: "clear a bounty off a player", description: "Clear a bounty off a player",
value: "bounty-clear", value: "bounty-clear",
type: CommandOptions.SubCommand, type: CommandOptions.SubCommand,
options: [{ options: [{
@@ -72,50 +72,49 @@ module.exports = {
}] }]
}, },
{ {
name: "add-money", name: "money",
description: "Add/Remove money to a user",
value: "money",
type: CommandOptions.SubCommandGroup,
options: [{
name: "add",
description: "Add money to user", description: "Add money to user",
value: "add", value: "add",
type: CommandOptions.SubCommand, type: CommandOptions.SubCommand,
options: [ options: [{
{
name: "amount", name: "amount",
description: "The amount to add to balance", description: "The amount to add to balance",
value: "amount", value: "amount",
type: CommandOptions.Float, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, }, {
{
name: "to", name: "to",
description: "User to alter balance", description: "User to alter balance",
value: "to", value: "to",
type: CommandOptions.User, type: CommandOptions.User,
required: true, required: true,
}, }],
] }, {
}, name: "remove",
{ description: "Remove money from a user",
name: "remove-money",
description: "Remove or remove money from a user",
value: "remove", value: "remove",
type: CommandOptions.SubCommand, type: CommandOptions.SubCommand,
options: [ options: [{
{
name: "amount", name: "amount",
description: "The amount to add to balance", description: "The amount to remove from balance",
value: "amount", value: "amount",
type: CommandOptions.Float, type: CommandOptions.Float,
min_value: 0.01, min_value: 0.01,
required: true, required: true,
}, }, {
{
name: "from", name: "from",
description: "User to alter balance", description: "User to alter balance",
value: "from", value: "from",
type: CommandOptions.User, type: CommandOptions.User,
required: true, required: true,
}, }]
] }]
}], }],
SlashCommand: { SlashCommand: {
/** /**
@@ -279,9 +278,9 @@ module.exports = {
return interaction.send({ embeds: [clearedBounty] }); return interaction.send({ embeds: [clearedBounty] });
} else if (args[0].name == 'add-money' || args[0].name == 'remove-money') { } else if (args[0].name == 'money') {
const targetUserID = args[0].options[1].value; const targetUserID = args[0].options[0].options[1].value;
let banking = await client.dbo.collection("users").findOne({"user.userID": targetUserID}).then(banking => banking); let banking = await client.dbo.collection("users").findOne({"user.userID": targetUserID}).then(banking => banking);
if (!banking) { if (!banking) {
@@ -295,7 +294,7 @@ module.exports = {
if (!success) return client.sendInternalError(interaction, 'Failed to add bank'); if (!success) return client.sendInternalError(interaction, 'Failed to add bank');
} }
let newBalance = args[0].name == 'add-money' let newBalance = args[0].options[0].name == 'add'
? banking.guilds[GuildDB.serverID].balance + args[0].options[0].value ? banking.guilds[GuildDB.serverID].balance + args[0].options[0].value
: banking.guilds[GuildDB.serverID].balance - args[0].options[0].value; : banking.guilds[GuildDB.serverID].balance - args[0].options[0].value;
@@ -304,7 +303,7 @@ module.exports = {
}); });
const successEmbed = new EmbedBuilder() const successEmbed = new EmbedBuilder()
.setDescription(`Successfully ${args[0].name == 'add-money' ? 'added' : 'removed'} **$${args[0].options[0].value.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2})}** ${args[0].name == 'add-money' ? 'to' : 'from'} <@${targetUserID}>'s balance`) .setDescription(`Successfully ${args[0].options[0].name == 'add' ? 'added' : 'removed'} **$${args[0].options[0].value.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2})}** ${args[0].name == 'add-money' ? 'to' : 'from'} <@${targetUserID}>'s balance`)
.setColor(client.config.Colors.Green); .setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successEmbed] }); return interaction.send({ embeds: [successEmbed] });
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayzr-bot", "name": "dayzr-bot",
"version": "12.5.11", "version": "12.5.12",
"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": {