diff --git a/commands/set-starting-balance.js b/commands/set-starting-balance.js new file mode 100644 index 0000000..410d94d --- /dev/null +++ b/commands/set-starting-balance.js @@ -0,0 +1,52 @@ +const { MessageEmbed } = require('discord.js'); + +module.exports = { + name: "set-starting-balance", + description: "change the starting balance for the server", + usage: "[amount]", + permissions: { + channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], + member: ["MANAGE_GUILD"], + }, + SlashCommand: { + options: [ + { + name: "amount", + description: "the amount to set the starting balance", + value: 1000.00, + type: 10, + required: true, + } + ], + /** + * + * @param {require("../structures/QuarksBot")} client + * @param {import("discord.js").MessageCreate} message + * @param {string[]} args + * @param {*} param3 + */ + run: async (client, interaction, args, { GuildDB }) => { + if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { + return interaction.send(`You are not allowed to use the bot in this channel.`); + } + + client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {"server.startingBalance":args[0].value}, function(err, res) { + if (err) { + client.log(err); + let embed = new MessageEmbed() + .setTitle(err) + .setColor("RED") + + return interaction.send({ embeds: [embed] }); + } + }); + + let successEmbed = new MessageEmbed() + .setTitle('Success') + .setDescription(`Successfully set $${args[0].value.toFixed(2)} as starting balance`) + .setColor('GREEN'); + + return interaction.send({ embeds: [successEmbed] }); + }, + }, +} \ No newline at end of file