const { MessageEmbed, Guild } = require('discord.js'); module.exports = { name: "remove-income", debug: false, description: "remove an income role", usage: "[role] [amount daily]", permissions: { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: ["MANAGE_GUILD"], }, SlashCommand: { options: [ { name: "role", description: "role for this income", value: "role", type: 8, 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.`); } const searchIndex = roles.findIndex((role) => role.role==args[0].value); if (searchIndex == -1) { let embed = new MessageEmbed() .setTitle('Role not found') .setColor("RED"); return interaction.send({ embeds: [embed] }); } else { client.dbo.collection("guilds").updateOne({"server.serverID":Guild.serverID}, {$pull: {"server.incomeRoles": 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 remoed <@&${args[0].value}> from income roles.`) .setColor('GREEN'); return interaction.send({ embeds: [successEmbed] }); }, }, }