view specific factions armband

This commit is contained in:
SowinskiBraeden committed 2022-12-15 15:36:40 -08:00
1 parent 9b276a2201
commit 6ce9e972e0
2 files changed
+54 -15

No files matched your search

+53 -14
View File
@@ -1,4 +1,5 @@
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { Armbands } = require('../config/armbandsdb.js');
module.exports = { module.exports = {
name: "factions", name: "factions",
@@ -10,7 +11,13 @@ module.exports = {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [], member: [],
}, },
options: [], options: [{
name: "faction_role",
description: "View a specific faction's armband by role",
value: "faction_role",
type: 8,
required: false,
}],
SlashCommand: { SlashCommand: {
/** /**
* *
@@ -23,24 +30,56 @@ module.exports = {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id))
return interaction.send({ content: `You are not allowed to use the bot in this channel.`, flags: (1 << 6) }); return interaction.send({ content: `You are not allowed to use the bot in this channel.`, flags: (1 << 6) });
let factions = new EmbedBuilder() // Return list of factions and their armband.
.setColor(client.config.Colors.Default) if (!args) {
.setTitle('Factions & Armbands')
let factions = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setTitle('Factions & Armbands')
let description = '';
let description = ''; if (GuildDB.usedArmbands.length == 0) {
description = '> There are no factions that have claimed armbands.';
if (GuildDB.usedArmbands.length == 0) { } else {
description = '> There are no factions that have claimed armbands.'; for (const [factionID, data] of Object.entries(GuildDB.factionArmbands)) {
} else { if (description == "") description += `> <@&${factionID}> - ${data.armband}`;
for (const [factionID, data] of Object.entries(GuildDB.factionArmbands)) { else description += `\n> <@&${factionID}> - *${data.armband}*`;
if (description == "") description += `> <@&${factionID}> - ${data.armband}`; }
else description += `\n> <@&${factionID}> - *${data.armband}*`; }
factions.setDescription(description);
return interaction.send({ embeds: [factions] });
}
// Else return specific faction and their armband.
if (!GuildDB.factionArmbands[args[0].value]) {
return interaction.send({
embeds: [
new EmbedBuilder()
.setColor(client.config.Colors.Yellow)
.setDescription(`**Notice:**\n> The faction <@&${args[0].value}> has not claimed an armband.`)
],
flags: (1 << 6)
});
}
let armbandURL;
for (let i = 0; i < Armbands.length; i++) {
if (Armbands[i].name == GuildDB.factionArmbands[args[0].value].armband) {
armbandURL = Armbands[i].url;
break;
} }
} }
factions.setDescription(description); const faction = new EmbedBuilder()
.setColor(client.config.Colors.Default)
.setDescription(`> Faction <@&${GuildDB.factionArmbands[args[0].value].faction}> - ***${GuildDB.factionArmbands[args[0].value].armband}***`)
.setImage(armbandURL);
return interaction.send({ embeds: [factions] }); return interaction.send({ embeds: [faction] });
}, },
}, },
Interactions: {} Interactions: {}
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayz-armbands", "name": "dayz-armbands",
"version": "4.6.2", "version": "4.7.0",
"description": "A Discord Bot to handle DayZ server flags and armbands for in game factions.", "description": "A Discord Bot to handle DayZ server flags and armbands for in game factions.",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {