Merge. DONT PULL before poll command done

This commit is contained in:
Night Kaly 2022-01-28 20:22:29 +00:00 committed by GitHub
commit bc98d548fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 308 additions and 238 deletions

View file

@ -1,6 +1,6 @@
const { MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
const axios = require("axios");
const moment = require("moment"); const moment = require("moment");
const axios = require("axios");
module.exports = { module.exports = {
name: "build", name: "build",
description: "Get gunsmith builds", description: "Get gunsmith builds",
@ -19,89 +19,89 @@ module.exports = {
required: true, required: true,
choices: [ choices: [
{ {
name: "AK117", name: "Type 25",
value: "ak117", value: "A01",
}, },
{ {
name: "M16", name: "M16",
value: "m16", value: "A02",
}, },
{ {
name: "Type 25", name: "AK117",
value: "type25", value: "A03",
}, },
{ {
name: "AK-47", name: "AK-47",
value: "ak47", value: "A04",
}, },
{ {
name: "ASM10", name: "ASM10",
value: "asm10", value: "A05",
}, },
{ {
name: "M4", name: "M4",
value: "m4", value: "A06",
}, },
{ {
name: "BK57", name: "BK57",
value: "bk57", value: "A07",
}, },
{ {
name: "LK24", name: "LK24",
value: "lk24", value: "A08",
},
{
name: "Man-o-War",
value: "manowar",
}, },
{ {
name: "ICR-1", name: "ICR-1",
value: "icr1", value: "A09",
},
{
name: "Man-o-War",
value: "A10",
}, },
{ {
name: "KN-44", name: "KN-44",
value: "kn44", value: "A11",
}, },
{ {
name: "HBRa3", name: "HBRa3",
value: "hbra3", value: "A12",
}, },
{ {
name: "HVK-30", name: "HVK-30",
value: "hvk30", value: "A13",
}, },
{ {
name: "DR-H", name: "DR-H",
value: "drh", value: "A14",
}, },
{ {
name: "Peacekeeper MK2", name: "Peacekeeper MK2",
value: "peacekeepermk2", value: "A15",
}, },
{ {
name: "FR .556", name: "FR .556",
value: "fr556", value: "A16",
}, },
{ {
name: "AS VAL", name: "AS VAL",
value: "asval", value: "A17",
}, },
{ {
name: "CR-56 AMAX", name: "CR-56 AMAX",
value: "cr56amax", value: "A18",
}, },
{ {
name: "M13", name: "M13",
value: "m13", value: "A19",
}, },
{ {
name: "Swordfish", name: "Swordfish",
value: "swordfish", value: "A20",
},
{
name: "Kilo 141",
value: "A21",
}, },
// {
// name: "Kilo 141",
// value: "kilo",
// },
], ],
}, },
{ {
@ -163,71 +163,71 @@ module.exports = {
choices: [ choices: [
{ {
name: "RUS-79u", name: "RUS-79u",
value: "rus79u", value: "D01",
},
{
name: "PDW-57",
value: "pdw57",
},
{
name: "Razorback",
value: "razorback",
},
{
name: "MSMC",
value: "msmc",
},
{
name: "HG40",
value: "hg40",
},
{
name: "Pharo",
value: "pharo",
},
{
name: "GKS",
value: "gks",
},
{
name: "Cordite",
value: "cordite",
},
{
name: "QQ9",
value: "qq9",
},
{
name: "Fennec",
value: "fennec",
}, },
{ {
name: "Chicom", name: "Chicom",
value: "chicom", value: "D02",
},
{
name: "PDW-57",
value: "D03",
},
{
name: "Razorback",
value: "D04",
},
{
name: "MSMC",
value: "D05",
},
{
name: "HG40",
value: "D06",
},
{
name: "Pharo",
value: "D07",
},
{
name: "GKS",
value: "D08",
},
{
name: "Cordite",
value: "D09",
},
{
name: "QQ9",
value: "D10",
},
{
name: "Fennec",
value: "D11",
}, },
{ {
name: "AGR 556", name: "AGR 556",
value: "agr556", value: "D12",
}, },
{ {
name: "QXR", name: "QXR",
value: "qxr", value: "D13",
}, },
{ {
name: "PP19 Bizon", name: "PP19 Bizon",
value: "pp19bizon", value: "D14",
}, },
{ {
name: "MX9", name: "MX9",
value: "mx9", value: "D15",
}, },
{ {
name: "CBR4", name: "CBR4",
value: "cbr4", value: "D16",
}, },
{ {
name: "PPSh 41", name: "PPSh 41",
value: "ppsh", value: "D17",
}, },
], ],
}, },
@ -284,41 +284,41 @@ module.exports = {
description: "Name of the Gun", description: "Name of the Gun",
required: true, required: true,
choices: [ choices: [
// {
// name: "XPR-50",
// value: "B01",
// },
{ {
name: "Arctic .50", name: "Arctic .50",
value: "arctic50", value: "B02",
}, },
{ {
name: "M21 EBR", name: "M21 EBR",
value: "m21ebr", value: "B03",
}, },
{ {
name: "DL Q33", name: "DL Q33",
value: "dlq33", value: "B04",
}, },
{ {
name: "Locus", name: "Locus",
value: "locus", value: "B05",
}, },
// { // {
// name: "XPR-50",
// value: "xpr50",
// },
// {
// name: "NA-45", // name: "NA-45",
// value: "na45", // value: "B06",
// }, // },
{ {
name: "Outlaw", name: "Outlaw",
value: "outlaw", value: "B07",
}, },
{ {
name: "Rytec AMR", name: "Rytec AMR",
value: "rytecamr", value: "B08",
}, },
{ {
name: "SVD", name: "SVD",
value: "svd", value: "B09",
}, },
], ],
}, },
@ -332,10 +332,6 @@ module.exports = {
name: "Path.exe", name: "Path.exe",
value: "path", value: "path",
}, },
// {
// name: "little_b",
// value: "littleb",
// },
], ],
}, },
{ {
@ -377,35 +373,35 @@ module.exports = {
choices: [ choices: [
{ {
name: "S36", name: "S36",
value: "s36", value: "C01",
}, },
{ {
name: "UL736", name: "UL736",
value: "ul736", value: "C02",
}, },
{ {
name: "RPD", name: "RPD",
value: "rpd", value: "C03",
}, },
{ {
name: "M4 LMG", name: "M4 LMG",
value: "m4lmg", value: "C04",
}, },
{ {
name: "Chopper", name: "Chopper",
value: "chopper", value: "C05",
}, },
{ {
name: "Holger 26", name: "Holger 26",
value: "holger26", value: "C06",
}, },
{ {
name: "Hades", name: "Hades",
value: "hades", value: "C07",
}, },
{ {
name: "PKM", name: "PKM",
value: "pkm", value: "C08",
}, },
], ],
}, },
@ -460,31 +456,31 @@ module.exports = {
choices: [ choices: [
{ {
name: "HS2126", name: "HS2126",
value: "hs2126", value: "E01",
}, },
{ {
name: "BY15", name: "BY15",
value: "by15", value: "E02",
},
{
name: "Striker",
value: "striker",
},
{
name: "KRM_262",
value: "krm262",
},
{
name: "Echo",
value: "echo",
}, },
{ {
name: "HS0405", name: "HS0405",
value: "hs0405", value: "E03",
},
{
name: "Striker",
value: "E04",
},
{
name: "KRM_262",
value: "E05",
},
{
name: "Echo",
value: "E06",
}, },
{ {
name: "R9-0", name: "R9-0",
value: "r90", value: "E07",
}, },
], ],
}, },
@ -535,19 +531,19 @@ module.exports = {
choices: [ choices: [
{ {
name: "Kilo Bolt-Action", name: "Kilo Bolt-Action",
value: "kiloboltaction", value: "F01",
}, },
{ {
name: "SKS", name: "SKS",
value: "sks", value: "F02",
}, },
{ {
name: "SP-R 208", name: "SP-R 208",
value: "spr208", value: "F03",
}, },
{ {
name: "MK2", name: "MK2",
value: "mk2", value: "F04",
}, },
], ],
}, },
@ -561,10 +557,6 @@ module.exports = {
name: "Path.exe", name: "Path.exe",
value: "path", value: "path",
}, },
// {
// name: "Little_b",
// value: "littleb",
// },
], ],
}, },
{ {
@ -602,27 +594,27 @@ module.exports = {
choices: [ choices: [
{ {
name: "J358", name: "J358",
value: "j358", value: "G01",
}, },
{ {
name: "MW11", name: "MW11",
value: "mw11", value: "G02",
}, },
{ {
name: ".50 GS", name: ".50 GS",
value: "gs50", value: "G03",
}, },
{ {
name: "Renetti", name: "Renetti",
value: "renetti", value: "G04",
}, },
{ {
name: "Shorty", name: "Shorty",
value: "shorty", value: "G05",
}, },
{ {
name: "Crossbow", name: "Crossbow",
value: "crossbow", value: "G06",
}, },
], ],
}, },
@ -654,114 +646,12 @@ module.exports = {
}, },
], ],
run: async (client, interaction, args) => { run: async (client, interaction, args) => {
const allguns = { const cwts = args[1];
ak117: "AK117",
m16: "M16",
type25: "Type 25",
ak47: "AK-47",
asm10: "ASM10",
m4: "M4",
bk57: "BK57",
lk24: "LK24",
manowar: "Man-O-War",
icr1: "ICR-1",
kn44: "KN-44",
hbra3: "HBRa3",
hvk30: "HVK-30",
drh: "DR-H",
peacekeepermk2: "Peacekeeper MK2",
fr556: "FR .556",
asval: "AS VAL",
cr56amax: "CR-56 AMAX",
m13: "M13",
swordfish: "Swordfish",
// kilo: "Kilo 141",
j358: "J358",
gs50: ".50 GS",
mw11: "MW11",
renetti: "Renetti",
shorty: "Shorty",
crossbow: "Crossbow",
kiloboltaction: "Kilo Bolt-Action",
sks: "SKS",
spr208: "SP-R 208",
mk2: "MK2",
s36: "S36",
ul736: "UL736",
rpd: "RPD",
m4lmg: "M4LMG",
chopper: "Chopper",
holger26: "Holger 26",
hades: "Hades",
pkm: "PKM",
arctic50: "Arctic .50",
m21ebr: "M21 EBR",
dlq33: "DL Q33",
locus: "Locus",
// na45: "NA 45",
// xpr50: "XPR-50",
locus: "Locus",
outlaw: "Outlaw",
rytecamr: "Rytec AMR",
svd: "SVD",
hs2126: "HS2126",
by15: "BY15",
striker: "Striker",
krm262: "KRM 262",
echo: "Echo",
hs0405: "HS0405",
r90: "R9-0",
rus79u: "RUS-79U",
hg40: "HG-40",
pdw57: "PDW-57",
chicom: "Chicom",
razorback: "Razorback",
msmc: "MSMC",
pharo: "Pharo",
gks: "GKS",
cordite: "Cordite",
qq9: "QQ9",
fennec: "Fennec",
agr556: "AGR 556",
qxr: "QXR",
pp19bizon: "PP19 Bizon",
mx9: "MX9",
cbr4: "CBR4",
ppsh: "PPSh-41",
};
const all = {
assault_rifle: "Assault Rifle",
sniper_rifle: "Sniper Rifle",
marksman_rifle: "Marksman Rifle",
shotgun: "Shotgun",
light_machine_gun: "Light Machine Gun",
sub_machine_gun: "Sub Machine Gun",
path: "Path.exe",
dhitman: "dHitman",
jokesta: "Jokesta",
sod: "Stats On Duty",
// littleb:"Little B",
aggressive: "Aggressive",
passive: "Passive",
snd: "Search And Destroy",
respawn: "Respawn",
ads: "ADS",
hipfire: "Hipfire",
};
const gun = args[1];
const cc = args[2]; const cc = args[2];
const tag = args[3]; const tag = args[3];
const data = await axios const data = await axios
.get( .get(
`${process.env.api}/api/v1/codm/builds?name=${gun}&cc=${cc}&tag=${tag}`, `${process.env.api}/api/v1/codm/builds?cwts=${cwts}&cc=${cc}&tag=${tag}`,
{ {
headers: { headers: {
Authorization: process.env.CODM_API_KEY, Authorization: process.env.CODM_API_KEY,
@ -770,6 +660,7 @@ module.exports = {
) )
.then(res => res.data) .then(res => res.data)
.catch(e => null); .catch(e => null);
if (!data?.ID) { if (!data?.ID) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setDescription( .setDescription(
@ -784,10 +675,10 @@ module.exports = {
}); });
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle( .setTitle(
`${data.weaponName}(${data.weaponType})'s ${all[tag]} build from ${data.author}` `${all[tag]} build for ${data.weaponName} from ${data.author}`
) )
.setDescription( .setDescription(
`<:nyx_description:897379659665264650> **Description** \`\`\`\n ${data.notes}\n\`\`\`` `<:nyx_description:897379659665264650> **Description** \`\`\` \n${data.notes} \n\`\`\``
) )
.setColor(16580400) .setColor(16580400)
.setImage(data.imageUrl) .setImage(data.imageUrl)

View file

@ -299,7 +299,7 @@ function statsHandler(inpmsg) {
footer: { footer: {
text: "[OUTDATED] All data courtesy of Project Lighthouse 2.0 and CoDM Research Crew", text: "[OUTDATED] All data courtesy of Project Lighthouse 2.0 and CoDM Research Crew",
icon_url: icon_url:
"https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png?width=638&height=638", "https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png",
}, },
}; };
} }

119
command/Utilities/poll.js Normal file
View file

@ -0,0 +1,119 @@
const { Client, CommandInteraction, MessageEmbed } = require('discord.js');
module.exports = {
name: 'poll',
category: "SUB_COMMAND",
description: 'Creates a poll with many options',
options: [
{
name: 'create',
description: 'Creates An Interactive Poll',
type: 'SUB_COMMAND',
options: [
{
name: 'question',
description: 'The question of the poll',
type: 'STRING',
required: true,
},
{
name: 'choice1',
description: 'Choice 1',
type: 'STRING',
required: true,
},
{
name: 'choice2',
description: 'Choice 2',
type: 'STRING',
required: true,
},
{
name: 'choice3',
description: 'Choice 3',
type: 'STRING',
required: false,
},
{
name: 'choice4',
description: 'Choice 4',
type: 'STRING',
required: false,
},
{
name: 'choice5',
description: 'Choice 5',
type: 'STRING',
required: false,
},
{
name: 'choice6',
description: 'Choice 6',
type: 'STRING',
required: false,
},
],
},
],
/**
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} 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()
.setTitle(`${title}`)
.setColor("RED")
.addFields(
{ name: "", value: `🇦 ${c1}`},
{ name: "", value: `🇧 ${c2}`}
)
.setFooter(`Poll By ${interaction.user.tag}`)
.setTimestamp();
if (interaction.options.getString('choice3')) {
pollCreateEmbed.addFields({ name: "", value: `🇨 ${c3}`});
}
if (interaction.options.getString('choice4')) {
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],
//fetchReply: true,
});
embedMessage.react('🇦');
embedMessage.react('🇧');
if (interaction.options.getString('choice3')) {
embedMessage.react('🇨');
}
if (interaction.options.getString('choice4')) {
embedMessage.react('🇩');
}
if (interaction.options.getString('choice5')) {
embedMessage.react('🇪');
}
if (interaction.options.getString('choice6')) {
embedMessage.react('🇫');
}
} else {
return;
}
},
};

View file

@ -26,7 +26,8 @@
"CR-56 AMAX", "CR-56 AMAX",
"Shorty", "Shorty",
"Crossbow", "Crossbow",
"R9-0" "R9-0",
"PPSh-41"
], ],
"weaponAlliasName": [ "weaponAlliasName": [
["MoW"], ["MoW"],
@ -48,14 +49,15 @@
["Slow Outlaw", "Slower Outlaw"], ["Slow Outlaw", "Slower Outlaw"],
["bae"], ["bae"],
["Reneti", "Renneti", "Rennetti", "Burst Pistol"], ["Reneti", "Renneti", "Rennetti", "Burst Pistol"],
["pp bizon", "pp"], ["pp bizon", "pp19"],
["AUG"], ["AUG"],
["AKBP", "Vepr"], ["AKBP", "Vepr"],
["AN94"], ["AN94"],
["CR56", "AMAX"], ["CR56", "AMAX"],
["725"], ["725"],
["cb", "bow"], ["cb", "bow"],
["r9", "R9-O"] ["r9", "R9-O"],
["ppsh", "pp41"]
], ],
"attachmentActualName": [ "attachmentActualName": [
["akimbo", "Stopping Power"], ["akimbo", "Stopping Power"],

View file

@ -1043,6 +1043,64 @@
] ]
} }
], ],
"Kilo_141": [
{
"muzzle": [
"Tactical Suppressor",
"OWC Light Suppressor",
"OWC Light Compensator",
"Monolithic Suppressor",
"MIP Light FLash Guard",
"RTC Light Muzzle Brake"
],
"barrel": [
"RTC Silencer Barrel",
"MIP Light Extended Barrel",
"OWC Marksman"
],
"optic": [
"Red Dot Sight",
"Holographic Sight",
"3x Tactical Scope",
"4x Tactical Scope",
"4.4x Tactical Scope"
],
"stock": [
"No Stock",
"YKM Combat Stock",
"OWC Skeleton Stock",
"RTC Steady Stock"
],
"perk": [
"FMJ",
"Sleight of Hand",
"Wounding",
"Full Ammo",
"Disable",
"Tough",
"Long Shot",
"Melee Master"
],
"laser": ["RTC Laser 1mW", "MIP Laser 5mW", "OWC Laser - Tactical"],
"underbarrel": [
"Strike Foregrip",
"Merc Foregrip",
"Operator Foregrip",
"Ranger Foregrip",
"Tactical Foregrip A"
],
"ammo": [
"Extended Mag A",
"Large Extended Mag B",
"100 round LMG Drum Mag"
],
"rear_grip": [
"Granulated Grip Tape",
"Ruberized Grip Tape",
"Stippled Grip Tape"
]
}
],
"XPR_50": [ "XPR_50": [
{ {
"muzzle": [ "muzzle": [