4.7.1 remove @deleted-roles on view
This commit is contained in:
2 files changed
+14
-12
No files matched your search
@@ -43,18 +43,6 @@ module.exports = {
|
|||||||
description = '> There are no factions that have claimed armbands.';
|
description = '> There are no factions that have claimed armbands.';
|
||||||
} else {
|
} else {
|
||||||
for (const [factionID, data] of Object.entries(GuildDB.factionArmbands)) {
|
for (const [factionID, data] of Object.entries(GuildDB.factionArmbands)) {
|
||||||
const guild = client.guilds.cache.get(GuildDB.serverID);
|
|
||||||
const role = guild.roles.cache.find(role => role.id == factionID);
|
|
||||||
if (!role) {
|
|
||||||
let query = {
|
|
||||||
$pull: { 'server.usedArmbands': data.armband },
|
|
||||||
$unset: { [`server.factionArmbands.${factionID}`]: "" },
|
|
||||||
};
|
|
||||||
client.dbo.collection("guilds").updateOne({'server.serverID': GuildDB.serverID}, query, function (err, res) {
|
|
||||||
if (err) return client.sendInternalError(interaction, err);
|
|
||||||
});
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (description == "") description += `> <@&${factionID}> - ${data.armband}`;
|
if (description == "") description += `> <@&${factionID}> - ${data.armband}`;
|
||||||
else description += `\n> <@&${factionID}> - *${data.armband}*`;
|
else description += `\n> <@&${factionID}> - *${data.armband}*`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,20 @@ class DayzArmbands extends Client {
|
|||||||
if (interaction.type!=3) {
|
if (interaction.type!=3) {
|
||||||
let GuildDB = await this.GetGuild(interaction.guild_id);
|
let GuildDB = await this.GetGuild(interaction.guild_id);
|
||||||
|
|
||||||
|
for (const [factionID, data] of Object.entries(GuildDB.factionArmbands)) {
|
||||||
|
const guild = this.guilds.cache.get(GuildDB.serverID);
|
||||||
|
const role = guild.roles.cache.find(role => role.id == factionID);
|
||||||
|
if (!role) {
|
||||||
|
let query = {
|
||||||
|
$pull: { 'server.usedArmbands': data.armband },
|
||||||
|
$unset: { [`server.factionArmbands.${factionID}`]: "" },
|
||||||
|
};
|
||||||
|
this.dbo.collection("guilds").updateOne({'server.serverID': GuildDB.serverID}, query, function (err, res) {
|
||||||
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const command = interaction.data.name.toLowerCase();
|
const command = interaction.data.name.toLowerCase();
|
||||||
const args = interaction.data.options;
|
const args = interaction.data.options;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user