Merge pull request #44 from night0721/dev

Dev
This commit is contained in:
Night Kaly 2022-01-29 02:39:15 +00:00 committed by GitHub
commit 3baeece8ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 118 deletions

View file

@ -1,119 +1,79 @@
const { Client, CommandInteraction, MessageEmbed } = require('discord.js'); const { MessageEmbed } = require("discord.js");
module.exports = { module.exports = {
name: 'poll', name: "poll",
category: "SUB_COMMAND", category: "Utilities",
description: 'Creates a poll with many options', description: "Creates a poll with many options",
options: [ options: [
{ {
name: 'create', type: 3,
description: 'Creates An Interactive Poll', name: "question",
type: 'SUB_COMMAND', description: "The question of the poll",
options: [
{
name: 'question',
description: 'The question of the poll',
type: 'STRING',
required: true, required: true,
}, },
{ {
name: 'choice1', type: 3,
description: 'Choice 1', name: "choice1",
type: 'STRING', description: "Choice 1",
required: true, required: true,
}, },
{ {
name: 'choice2', type: 3,
description: 'Choice 2', name: "choice2",
type: 'STRING', description: "Choice 2",
required: true, required: true,
}, },
{ {
name: 'choice3', type: 3,
description: 'Choice 3', name: "choice3",
type: 'STRING', description: "Choice 3",
required: false, required: false,
}, },
{ {
name: 'choice4', type: 3,
description: 'Choice 4', name: "choice4",
type: 'STRING', description: "Choice 4",
required: false, required: false,
}, },
{ {
name: 'choice5', type: 3,
description: 'Choice 5', name: "choice5",
type: 'STRING', description: "Choice 5",
required: false, required: false,
}, },
{ {
name: 'choice6', type: 3,
description: 'Choice 6', name: "choice6",
type: 'STRING', description: "Choice 6",
required: false, required: false,
}, },
], ],
},
],
/**
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run: async (client, interaction, args) => { run: async (client, interaction, args) => {
if (interaction.options.getSubcommand() == 'create') {
const title = interaction.options.getString('question')
const c1 = interaction.options.getString('choice1');
const c2 = interaction.options.getString('choice2');
const c3 = interaction.options.getString('choice3');
const c4 = interaction.options.getString('choice4');
const c5 = interaction.options.getString('choice5');
const c6 = interaction.options.getString('choice6');
const pollCreateEmbed = new MessageEmbed() const pollCreateEmbed = new MessageEmbed()
.setTitle(`${title}`) .setTitle(`📣 **${args[0]}**`)
.setColor("RED") .setColor("RED")
.addFields( .setFooter({
{ name: "", value: `🇦 ${c1}`}, text: `Made by ${client.author}`,
{ name: "", value: `🇧 ${c2}`} iconURL: client.user.displayAvatarURL(),
) })
.setFooter(`Poll By ${interaction.user.tag}`)
.setTimestamp(); .setTimestamp();
for (let i = 0; i < args.length - 1; i++) {
pollCreateEmbed.addField(
if (interaction.options.getString('choice3')) { "",
pollCreateEmbed.addFields({ name: "", value: `🇨 ${c3}`}); `:regional_indicator_${String.fromCharCode(97 + i)}: ${args[i + 1]}
`
);
} }
if (interaction.options.getString('choice4')) { let embedMessage = await interaction.followUp({
pollCreateEmbed.addFields({ name: "", value: `🇩 ${c4}`});
}
if (interaction.options.getString('choice5')) {
pollCreateEmbed.addFields({ name: "", value: `🇪 ${c5}`});
}
if (interaction.options.getString('choice6')) {
pollCreateEmbed.addFields({ name: "", value: `🇫 ${c6}`});
}
embedMessage = await interaction.followUp({
embeds: [pollCreateEmbed], embeds: [pollCreateEmbed],
//fetchReply: true,
}); });
embedMessage.react('🇦'); 55356;
embedMessage.react('🇧'); for (let i = 0; i < args.length - 1; i++) {
if (i === 0) embedMessage.react("\ud83c\udde6");
if (interaction.options.getString('choice3')) { if (i === 1) embedMessage.react("\ud83c\udde7");
embedMessage.react('🇨'); if (i === 2) embedMessage.react("\ud83c\udde8");
} if (i === 3) embedMessage.react("\ud83c\udde9");
if (interaction.options.getString('choice4')) { if (i === 4) embedMessage.react("\ud83c\uddea");
embedMessage.react('🇩'); if (i === 5) embedMessage.react("\ud83c\uddeb");
}
if (interaction.options.getString('choice5')) {
embedMessage.react('🇪');
}
if (interaction.options.getString('choice6')) {
embedMessage.react('🇫');
}
} else {
return;
} }
}, },
}; };

View file

@ -1054,7 +1054,7 @@
"RTC Light Muzzle Brake" "RTC Light Muzzle Brake"
], ],
"barrel": [ "barrel": [
"RTC Silencer Barrel", "YKM Integral Suppressor Light",
"MIP Light Extended Barrel", "MIP Light Extended Barrel",
"OWC Marksman" "OWC Marksman"
], ],
@ -1087,7 +1087,8 @@
"Merc Foregrip", "Merc Foregrip",
"Operator Foregrip", "Operator Foregrip",
"Ranger Foregrip", "Ranger Foregrip",
"Tactical Foregrip A" "Tactical Foregrip A",
"Bipod"
], ],
"ammo": [ "ammo": [
"Extended Mag A", "Extended Mag A",