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
+41 -2

No files matched your search

+40 -1
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,6 +30,9 @@ 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) });
// Return list of factions and their armband.
if (!args) {
let factions = new EmbedBuilder() let factions = new EmbedBuilder()
.setColor(client.config.Colors.Default) .setColor(client.config.Colors.Default)
.setTitle('Factions & Armbands') .setTitle('Factions & Armbands')
@@ -41,6 +51,35 @@ module.exports = {
factions.setDescription(description); factions.setDescription(description);
return interaction.send({ embeds: [factions] }); 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;
}
}
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: [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": {