Files
quarksBot/commands/set-starting-balance.js
T
2022-07-11 20:39:47 -07:00

52 lines
1.6 KiB
JavaScript

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] });
},
},
}