handle remove income role
This commit is contained in:
2 files changed
+27
-1
No files matched your search
@@ -745,6 +745,32 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
RemoveIncomeRole: {
|
||||||
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
return ButtonInteraction.reply({
|
||||||
|
content: "This button is not for you",
|
||||||
|
flags: (1 << 6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let action = '';
|
||||||
|
let roleId = interaction.customId.split('-')[2];
|
||||||
|
if (interaction.customId.split('-')[1]=='yes') {
|
||||||
|
action = 'removed';
|
||||||
|
let income = GuildDB.incemeRoles.find((i) => i.role == roleId);
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull: {"server.incomeRoles": income}}, function(err, res) {
|
||||||
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
|
});
|
||||||
|
} else if (interaction.customId.split('-')[1]=='no') action = 'kept';
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setDescription(`**Successfully ${action} <@&${roleId}> as an income role.**`)
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [successEmbed], components: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ResetSettings: {
|
ResetSettings: {
|
||||||
run: async (client, interaction, GuildDB) => {
|
run: async (client, interaction, GuildDB) => {
|
||||||
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
if (!interaction.customId.endsWith(interaction.member.user.id)) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dayz-armbands",
|
"name": "dayz-armbands",
|
||||||
"version": "7.1.1",
|
"version": "7.2.0",
|
||||||
"description": "A General Purpose Discord Bot for DayZ Servers.",
|
"description": "A General Purpose Discord Bot for DayZ Servers.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
|
|||||||
Reference in new issue
Block a user