feature/admin-claim-armband-for-faction
This commit is contained in:
2 files changed
+75
-1
No files matched your search
@@ -43,6 +43,18 @@ module.exports = {
|
||||
type: 6,
|
||||
required: true,
|
||||
}]
|
||||
}, {
|
||||
name: "claim-armband",
|
||||
description: "Claim an armband for a faction",
|
||||
value: "claim-armband",
|
||||
type: 1,
|
||||
options: [{
|
||||
name: "faction_role",
|
||||
description: "Claim an armband for this faction role.",
|
||||
value: "faction_role",
|
||||
type: 8,
|
||||
required: true,
|
||||
}]
|
||||
}, {
|
||||
name: "bounty-clear",
|
||||
description: "clear a bounty off a player",
|
||||
@@ -195,6 +207,68 @@ module.exports = {
|
||||
|
||||
return interaction.send({ embeds: [warnGTOverwrite], components: [opt] });
|
||||
|
||||
} else if (args[0].name == 'claim-armband') {
|
||||
|
||||
// Handle invalid roles
|
||||
if (des) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Yellow).setDescription('**Notice:**\n> This role has been configured to be excluded to claim an armband.')], flags: (1 << 6) });
|
||||
|
||||
// If this faction has an existing record in the db
|
||||
if (GuildDB.factionArmbands[args[0].value]) {
|
||||
const warnArmbadChange = new EmbedBuilder()
|
||||
.setColor(client.config.Colors.Yellow)
|
||||
.setDescription(`**Notice:**\n> The faction <@&${args[0].options[0].value}> already has an armband selected. Are you sure you would like to change this?`)
|
||||
|
||||
const opt = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`ChangeArmband-yes-${args[0].options[0].value}-${interaction.member.user.id}`)
|
||||
.setLabel("Yes")
|
||||
.setStyle(ButtonStyle.Success),
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`ChangeArmband-no-${args[0].options[0].value}-${interaction.member.user.id}`)
|
||||
.setLabel("No")
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
)
|
||||
|
||||
return interaction.send({ embeds: [warnArmbadChange], components: [opt] });
|
||||
}
|
||||
|
||||
// Any interaction for 'claim-armband' can be handled in
|
||||
// 'commands/claim.js' Interaction handlers and does not require its own code in this file.
|
||||
|
||||
let available = new SelectMenuBuilder()
|
||||
.setCustomId(`Claim-${args[0].options[0].value}-1-${interaction.member.user.id}`)
|
||||
.setPlaceholder('Select an armband from list 1 to claim')
|
||||
|
||||
let availableNext = new SelectMenuBuilder()
|
||||
.setCustomId(`Claim-${args[0].options[0].value}-2-${interaction.member.user.id}`)
|
||||
.setPlaceholder('Select an armband from list 2 to claim')
|
||||
|
||||
let tracker = 0;
|
||||
for (let i = 0; i < Armbands.length; i++) {
|
||||
if (!GuildDB.usedArmbands.includes(Armbands[i].name)) {
|
||||
tracker++;
|
||||
data = {
|
||||
label: Armbands[i].name,
|
||||
description: 'Select this armband',
|
||||
value: Armbands[i].name,
|
||||
}
|
||||
if (tracker > 25) availableNext.addOptions(data);
|
||||
else available.addOptions(data);
|
||||
}
|
||||
}
|
||||
|
||||
let compList = []
|
||||
let opt = new ActionRowBuilder().addComponents(available);
|
||||
compList.push(opt)
|
||||
let opt2 = undefined;
|
||||
if (tracker > 25) {
|
||||
opt2 = new ActionRowBuilder().addComponents(availableNext);
|
||||
compList.push(opt2);
|
||||
}
|
||||
|
||||
return interaction.send({ components: compList });
|
||||
|
||||
} else if (args[0].name == 'bounty-clear') {
|
||||
|
||||
let playerStat = GuildDB.playerstats.find(stat => stat.gamertag == args[0].options[0].value);
|
||||
|
||||
Reference in new issue
Block a user