view a list of armbands
This commit is contained in:
3 files changed
+84
-6
No files matched your search
+55
-4
@@ -1,4 +1,5 @@
|
|||||||
const { ModalBuilder, ActionRowBuilder } = require('discord.js');
|
const { SelectMenuBuilder, EmbedBuilder, ActionRowBuilder } = require('discord.js');
|
||||||
|
const { Armbands } = require('../config/armbandsdb.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "armbands",
|
name: "armbands",
|
||||||
@@ -19,14 +20,64 @@ module.exports = {
|
|||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction, args) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
|
||||||
|
let available = new SelectMenuBuilder()
|
||||||
|
.setCustomId(`View-1-${interaction.member.user.id}`)
|
||||||
|
.setPlaceholder('Select an armband from list 1 to claim')
|
||||||
|
|
||||||
|
let availableNext = new SelectMenuBuilder()
|
||||||
|
.setCustomId(`View-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++) {
|
||||||
|
tracker++;
|
||||||
|
data = {
|
||||||
|
label: Armbands[i].name,
|
||||||
|
description: 'View this armband',
|
||||||
|
value: Armbands[i].name,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuildDB.usedArmbands.includes(Armbands[i].name)) data.label += ' - [ Claimed ]'
|
||||||
|
|
||||||
|
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, flags: (1 << 6) });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Interactions: {
|
Interactions: {
|
||||||
ViewArmbads: {
|
View: {
|
||||||
run: async (client, interaction) => {
|
run: async (client, interaction, GuildDB) => {
|
||||||
|
let armbandURL;
|
||||||
|
|
||||||
|
for (let i = 0; i < Armbands.length; i++) {
|
||||||
|
if (Armbands[i].name == interaction.values[0]) {
|
||||||
|
armbandURL = Armbands[i].url;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let armbandTitle = `${interaction.values[0]}${GuildDB.usedArmbands.includes(interaction.values[0]) ? ' - [ Claimed ]' : ''}`;
|
||||||
|
|
||||||
|
const success = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Default)
|
||||||
|
.setTitle(armbandTitle)
|
||||||
|
.setImage(armbandURL);
|
||||||
|
|
||||||
|
return interaction.update({ embeds: [success], components: [] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -118,10 +118,10 @@ module.exports = {
|
|||||||
|
|
||||||
const success = new EmbedBuilder()
|
const success = new EmbedBuilder()
|
||||||
.setColor(client.config.Colors.Default)
|
.setColor(client.config.Colors.Default)
|
||||||
.setDescription(`**Success!**\n> The faction <@&${factionID}> has now claimed *${interaction.values[0]}*`)
|
.setDescription(`**Success!**\n> The faction <@&${factionID}> has now claimed ***${interaction.values[0]}***`)
|
||||||
.setImage(armbandURL);
|
.setImage(armbandURL);
|
||||||
|
|
||||||
return interaction.update({ embeds: [success], components: [], flags: 0 });
|
return interaction.update({ embeds: [success], components: [] });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
const { ModalBuilder, ActionRowBuilder } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "factions",
|
||||||
|
debug: false,
|
||||||
|
global: false,
|
||||||
|
description: "view the armband of a faction",
|
||||||
|
usage: "[cmd] [opts]",
|
||||||
|
permissions: {
|
||||||
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||||
|
member: [],
|
||||||
|
},
|
||||||
|
options: [],
|
||||||
|
SlashCommand: {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/QuarksBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args) => {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Interactions: {}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user