remove income function
This commit is contained in:
2 files changed
+67
-1
No files matched your search
@@ -0,0 +1,61 @@
|
|||||||
|
const { MessageEmbed, Guild } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "remove-income",
|
||||||
|
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] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -76,7 +76,12 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return interaction.send(`Set <@&${args[0].value}>'s income to $${args[1].value}`);
|
let successEmbed = new MessageEmbed()
|
||||||
|
.setTitle('Success')
|
||||||
|
.setDescription(`Set <@&${args[0].value}>'s income to $${args[1].value}`)
|
||||||
|
.setColor('GREEN');
|
||||||
|
|
||||||
|
return interaction.send({ embeds: [successEmbed] });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user