nyx/command/CODM/build.js

829 lines
19 KiB
JavaScript
Raw Permalink Normal View History

const { MessageEmbed } = require("discord.js");
const axios = require("axios");
2023-04-18 11:47:47 +02:00
const moment = require("moment");
module.exports = {
name: "build",
description: "Get gunsmith builds",
type: "CHAT_INPUT",
category: "CODM",
2022-02-05 02:06:33 +01:00
options: [
{
type: "SUB_COMMAND",
name: "assault_rifle",
description: "Get a gunsmith build for a Assault Rifle",
options: [
{
type: 3,
name: "name",
description: "Name of the Gun",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "AK117",
value: "ak117",
2022-02-05 02:06:33 +01:00
},
{
name: "M16",
2023-04-18 11:47:47 +02:00
value: "m16",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "Type 25",
value: "type25",
2022-02-05 02:06:33 +01:00
},
{
name: "AK-47",
2023-04-18 11:47:47 +02:00
value: "ak47",
2022-02-05 02:06:33 +01:00
},
{
name: "ASM10",
2023-04-18 11:47:47 +02:00
value: "asm10",
2022-02-05 02:06:33 +01:00
},
{
name: "M4",
2023-04-18 11:47:47 +02:00
value: "m4",
2022-02-05 02:06:33 +01:00
},
{
name: "BK57",
2023-04-18 11:47:47 +02:00
value: "bk57",
2022-02-05 02:06:33 +01:00
},
{
name: "LK24",
2023-04-18 11:47:47 +02:00
value: "lk24",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "Man-o-War",
value: "manowar",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "ICR-1",
value: "icr1",
2022-02-05 02:06:33 +01:00
},
{
name: "KN-44",
2023-04-18 11:47:47 +02:00
value: "kn44",
2022-02-05 02:06:33 +01:00
},
{
name: "HBRa3",
2023-04-18 11:47:47 +02:00
value: "hbra3",
2022-02-05 02:06:33 +01:00
},
{
name: "HVK-30",
2023-04-18 11:47:47 +02:00
value: "hvk30",
2022-02-05 02:06:33 +01:00
},
{
name: "DR-H",
2023-04-18 11:47:47 +02:00
value: "drh",
2022-02-05 02:06:33 +01:00
},
{
name: "Peacekeeper MK2",
2023-04-18 11:47:47 +02:00
value: "peacekeepermk2",
2022-02-05 02:06:33 +01:00
},
{
name: "FR .556",
2023-04-18 11:47:47 +02:00
value: "fr556",
2022-02-05 02:06:33 +01:00
},
{
name: "AS VAL",
2023-04-18 11:47:47 +02:00
value: "asval",
2022-02-05 02:06:33 +01:00
},
{
name: "CR-56 AMAX",
2023-04-18 11:47:47 +02:00
value: "cr56amax",
2022-02-05 02:06:33 +01:00
},
{
name: "M13",
2023-04-18 11:47:47 +02:00
value: "m13",
2022-02-05 02:06:33 +01:00
},
{
name: "Swordfish",
2023-04-18 11:47:47 +02:00
value: "swordfish",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
2023-04-18 11:47:47 +02:00
name: "youtuber",
2022-02-05 02:06:33 +01:00
description: "Select a Content Creator",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "Path.exe",
value: "path",
2022-02-05 02:06:33 +01:00
},
{
name: "Jokesta",
2023-04-18 11:47:47 +02:00
value: "jokesta",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
name: "tag",
description: "Playstyle/game mode of the build",
required: true,
choices: [
{
name: "Aggressive",
2023-04-18 11:47:47 +02:00
value: "aggressive",
2022-02-05 02:06:33 +01:00
},
{
name: "Passive",
2023-04-18 11:47:47 +02:00
value: "passive",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "Search & Destroy",
value: "snd",
2022-02-05 02:06:33 +01:00
},
{
name: "Respawn",
2023-04-18 11:47:47 +02:00
value: "respawn",
2022-02-05 02:06:33 +01:00
},
],
},
],
},
{
type: "SUB_COMMAND",
name: "sub_machine_gun",
description: "Get a gunsmith build for a Sub Machine Gun",
options: [
{
type: 3,
name: "name",
description: "Name of the Gun",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "RUS-79u",
value: "rus79u",
2022-02-05 02:06:33 +01:00
},
{
name: "PDW-57",
2023-04-18 11:47:47 +02:00
value: "pdw57",
2022-02-05 02:06:33 +01:00
},
{
name: "Razorback",
2023-04-18 11:47:47 +02:00
value: "razorback",
2022-02-05 02:06:33 +01:00
},
{
name: "MSMC",
2023-04-18 11:47:47 +02:00
value: "msmc",
2022-02-05 02:06:33 +01:00
},
{
name: "HG40",
2023-04-18 11:47:47 +02:00
value: "hg40",
2022-02-05 02:06:33 +01:00
},
{
name: "Pharo",
2023-04-18 11:47:47 +02:00
value: "pharo",
2022-02-05 02:06:33 +01:00
},
{
name: "GKS",
2023-04-18 11:47:47 +02:00
value: "gks",
2022-02-05 02:06:33 +01:00
},
{
name: "Cordite",
2023-04-18 11:47:47 +02:00
value: "cordite",
2022-02-05 02:06:33 +01:00
},
{
name: "QQ9",
2023-04-18 11:47:47 +02:00
value: "qq9",
2022-02-05 02:06:33 +01:00
},
{
name: "Fennec",
2023-04-18 11:47:47 +02:00
value: "fennec",
},
{
name: "Chicom",
value: "chicom",
2022-02-05 02:06:33 +01:00
},
{
name: "AGR 556",
2023-04-18 11:47:47 +02:00
value: "agr556",
2022-02-05 02:06:33 +01:00
},
{
name: "QXR",
2023-04-18 11:47:47 +02:00
value: "qxr",
2022-02-05 02:06:33 +01:00
},
{
name: "PP19 Bizon",
2023-04-18 11:47:47 +02:00
value: "pp19bizon",
2022-02-05 02:06:33 +01:00
},
{
name: "MX9",
2023-04-18 11:47:47 +02:00
value: "mx9",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
2023-04-18 11:47:47 +02:00
name: "youtuber",
2022-02-05 02:06:33 +01:00
description: "Select a Content Creator",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "Path.exe",
value: "path",
2022-02-05 02:06:33 +01:00
},
{
name: "Jokesta",
2023-04-18 11:47:47 +02:00
value: "jokesta",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
name: "tag",
description: "Playstyle/game mode of the build",
required: true,
choices: [
{
name: "Aggressive",
2023-04-18 11:47:47 +02:00
value: "aggressive",
2022-02-05 02:06:33 +01:00
},
{
name: "Passive",
2023-04-18 11:47:47 +02:00
value: "passive",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "Search & Destroy",
value: "snd",
2022-02-05 02:06:33 +01:00
},
{
name: "Respawn",
2023-04-18 11:47:47 +02:00
value: "respawn",
2022-02-05 02:06:33 +01:00
},
],
},
],
},
{
type: "SUB_COMMAND",
name: "sniper_rifle",
description: "Get a gunsmith build for a Sniper Rifle",
options: [
{
type: 3,
name: "name",
description: "Name of the Gun",
required: true,
choices: [
{
name: "Arctic .50",
2023-04-18 11:47:47 +02:00
value: "arctic50",
2022-02-05 02:06:33 +01:00
},
{
name: "M21 EBR",
2023-04-18 11:47:47 +02:00
value: "m21ebr",
2022-02-05 02:06:33 +01:00
},
{
name: "DL Q33",
2023-04-18 11:47:47 +02:00
value: "dlq33",
2022-02-05 02:06:33 +01:00
},
{
name: "Locus",
2023-04-18 11:47:47 +02:00
value: "locus",
2022-02-05 02:06:33 +01:00
},
// {
2023-04-18 11:47:47 +02:00
// name: "XPR-50",
// value: "xpr50",
// },
// {
2022-02-05 02:06:33 +01:00
// name: "NA-45",
2023-04-18 11:47:47 +02:00
// value: "na45",
2022-02-05 02:06:33 +01:00
// },
{
name: "Outlaw",
2023-04-18 11:47:47 +02:00
value: "outlaw",
2022-02-05 02:06:33 +01:00
},
{
name: "Rytec AMR",
2023-04-18 11:47:47 +02:00
value: "rytecamr",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
2023-04-18 11:47:47 +02:00
name: "youtuber",
2022-02-05 02:06:33 +01:00
description: "Select a Content Creator",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "Path.exe",
value: "path",
2022-02-05 02:06:33 +01:00
},
2023-04-18 11:47:47 +02:00
// {
// name: "little_b",
// value: "littleb",
// },
2022-02-05 02:06:33 +01:00
],
},
{
type: 3,
name: "tag",
description: "Playstyle/game mode of the build",
required: true,
choices: [
{
name: "Aggressive",
2023-04-18 11:47:47 +02:00
value: "aggressive",
2022-02-05 02:06:33 +01:00
},
{
name: "Passive",
2023-04-18 11:47:47 +02:00
value: "passive",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "Search & Destroy",
value: "snd",
2022-02-05 02:06:33 +01:00
},
{
name: "Respawn",
2023-04-18 11:47:47 +02:00
value: "respawn",
2022-02-05 02:06:33 +01:00
},
],
},
],
},
{
type: "SUB_COMMAND",
name: "light_machine_gun",
description: "Get a gunsmith build for a Light Machine Gun",
options: [
{
type: 3,
name: "name",
description: "Name of the Gun",
required: true,
choices: [
{
name: "S36",
2023-04-18 11:47:47 +02:00
value: "s36",
2022-02-05 02:06:33 +01:00
},
{
name: "UL736",
2023-04-18 11:47:47 +02:00
value: "ul736",
2022-02-05 02:06:33 +01:00
},
{
name: "RPD",
2023-04-18 11:47:47 +02:00
value: "rpd",
2022-02-05 02:06:33 +01:00
},
{
name: "M4 LMG",
2023-04-18 11:47:47 +02:00
value: "m4lmg",
2022-02-05 02:06:33 +01:00
},
{
name: "Chopper",
2023-04-18 11:47:47 +02:00
value: "chopper",
2022-02-05 02:06:33 +01:00
},
{
name: "Holger 26",
2023-04-18 11:47:47 +02:00
value: "holger26",
2022-02-05 02:06:33 +01:00
},
{
name: "Hades",
2023-04-18 11:47:47 +02:00
value: "hades",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
2023-04-18 11:47:47 +02:00
name: "youtuber",
2022-02-05 02:06:33 +01:00
description: "Select a Content Creator",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "Path.exe",
value: "path",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
name: "tag",
description: "Playstyle/game mode of the build",
required: true,
choices: [
{
name: "Aggressive",
2023-04-18 11:47:47 +02:00
value: "aggressive",
2022-02-05 02:06:33 +01:00
},
{
name: "Passive",
2023-04-18 11:47:47 +02:00
value: "passive",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "Search & Destroy",
value: "snd",
2022-02-05 02:06:33 +01:00
},
{
name: "Respawn",
2023-04-18 11:47:47 +02:00
value: "respawn",
2022-02-05 02:06:33 +01:00
},
],
},
],
},
{
type: "SUB_COMMAND",
name: "shotgun",
description: "Get a gunsmith build for a Shotgun",
options: [
{
type: 3,
name: "name",
description: "Name of the Gun",
required: true,
choices: [
{
name: "HS2126",
2023-04-18 11:47:47 +02:00
value: "hs2126",
2022-02-05 02:06:33 +01:00
},
{
name: "BY15",
2023-04-18 11:47:47 +02:00
value: "by15",
2022-02-05 02:06:33 +01:00
},
{
name: "Striker",
2023-04-18 11:47:47 +02:00
value: "striker",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "KRM_262",
value: "krm262",
2022-02-05 02:06:33 +01:00
},
{
name: "Echo",
2023-04-18 11:47:47 +02:00
value: "echo",
2022-02-05 02:06:33 +01:00
},
{
2023-04-18 11:47:47 +02:00
name: "HS0405",
value: "hs0405",
2022-02-05 02:06:33 +01:00
},
2022-03-02 09:54:39 +01:00
{
2023-04-18 11:47:47 +02:00
name: "R9-0",
value: "r90",
2022-03-02 09:54:39 +01:00
},
2022-02-05 02:06:33 +01:00
],
},
{
type: 3,
2023-04-18 11:47:47 +02:00
name: "youtuber",
2022-02-05 02:06:33 +01:00
description: "Select a Content Creator",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "Path.exe",
value: "path",
2022-02-05 02:06:33 +01:00
},
{
name: "dHitman",
value: "dhitman",
},
],
},
{
type: 3,
name: "tag",
description: "Playstyle/game mode of the build",
required: true,
choices: [
{
name: "ADS",
2023-04-18 11:47:47 +02:00
value: "ads",
2022-02-05 02:06:33 +01:00
},
{
name: "Hipfire",
2023-04-18 11:47:47 +02:00
value: "hipfire",
2022-02-05 02:06:33 +01:00
},
],
},
],
},
{
type: "SUB_COMMAND",
name: "marksman_rifle",
description: "Get a gunsmith build for a Marksman Rifle",
options: [
{
type: 3,
name: "name",
description: "Name of the Gun",
required: true,
choices: [
{
name: "Kilo Bolt-Action",
2023-04-18 11:47:47 +02:00
value: "kiloboltaction",
2022-02-05 02:06:33 +01:00
},
{
name: "SKS",
2023-04-18 11:47:47 +02:00
value: "sks",
2022-02-05 02:06:33 +01:00
},
{
name: "SP-R 208",
2023-04-18 11:47:47 +02:00
value: "spr208",
2022-02-05 02:06:33 +01:00
},
{
name: "MK2",
2023-04-18 11:47:47 +02:00
value: "mk2",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
2023-04-18 11:47:47 +02:00
name: "youtuber",
2022-02-05 02:06:33 +01:00
description: "Select a Content Creator",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "Path.exe",
value: "path",
2022-02-05 02:06:33 +01:00
},
2023-04-18 11:47:47 +02:00
// {
// name: "Little_b",
// value: "littleb",
// },
2022-02-05 02:06:33 +01:00
],
},
{
type: 3,
name: "tag",
description: "Playstyle/game mode of the build",
required: true,
choices: [
{
name: "Aggressive",
2023-04-18 11:47:47 +02:00
value: "aggressive",
2022-02-05 02:06:33 +01:00
},
{
name: "Passive",
2023-04-18 11:47:47 +02:00
value: "passive",
2022-02-05 02:06:33 +01:00
},
{
name: "Respawn",
2023-04-18 11:47:47 +02:00
value: "respawn",
2022-02-05 02:06:33 +01:00
},
],
},
],
},
{
type: "SUB_COMMAND",
name: "pistol",
description: "Get a gunsmith build for a Pistol",
options: [
{
type: 3,
name: "name",
description: "Name of the Gun",
required: true,
choices: [
{
name: "J358",
2023-04-18 11:47:47 +02:00
value: "j358",
2022-02-05 02:06:33 +01:00
},
{
name: "MW11",
2023-04-18 11:47:47 +02:00
value: "mw11",
2022-02-05 02:06:33 +01:00
},
{
name: ".50 GS",
2023-04-18 11:47:47 +02:00
value: "gs50",
2022-02-05 02:06:33 +01:00
},
{
name: "Renetti",
2023-04-18 11:47:47 +02:00
value: "renetti",
2022-02-05 02:06:33 +01:00
},
{
name: "Shorty",
2023-04-18 11:47:47 +02:00
value: "shorty",
2022-02-05 02:06:33 +01:00
},
{
name: "Crossbow",
2023-04-18 11:47:47 +02:00
value: "crossbow",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
2023-04-18 11:47:47 +02:00
name: "youtuber",
2022-02-05 02:06:33 +01:00
description: "Select a Content Creator",
required: true,
choices: [
{
2023-04-18 11:47:47 +02:00
name: "Path.exe",
value: "path",
2022-02-05 02:06:33 +01:00
},
],
},
{
type: 3,
name: "tag",
description: "Playstyle/game mode of the build",
required: true,
choices: [
{
name: "Respawn",
2023-04-18 11:47:47 +02:00
value: "respawn",
2022-02-05 02:06:33 +01:00
},
],
},
],
},
],
run: async (client, interaction, args) => {
2023-04-18 11:47:47 +02:00
const allguns = {
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",
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",
arctic50: "Arctic .50",
m21ebr: "M21 EBR",
dlq33: "DL Q33",
locus: "Locus",
// na45: "NA 45",
// xpr50: "XPR-50",
locus: "Locus",
outlaw: "Outlaw",
rytecamr: "Rytec AMR",
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",
};
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",
// 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 tag = args[3];
const data = await axios
.get(
2023-04-18 11:47:47 +02:00
`${process.env.api}/api/v1/codm/builds?name=${gun}&cc=${cc}&tag=${tag}`,
2022-01-28 21:19:50 +01:00
{
headers: {
2023-04-18 11:47:47 +02:00
Authorization: "Gae",
},
}
)
.then(res => res.data)
2023-04-18 11:47:47 +02:00
.catch();
const unavaliable = new MessageEmbed()
.setDescription(
`<:nyx_not_available:897378400031879188> We don't have a ${all[tag]} **${allguns[gun]}** gunsmith build by **${all[cc]}**, Please try another tag or a differnt content creator`
)
.setColor(client.color);
if (!data) {
interaction.followUp({ embeds: [unavaliable] });
} else {
const arr = [];
data.attachments.map((e, i) => {
2023-04-18 11:47:47 +02:00
return arr.push(`**${i + 1}: ${e}**`);
});
const embed = new MessageEmbed()
2023-04-18 11:47:47 +02:00
.setTitle(
`${data.weaponName}(${data.weaponType})'s ${all[tag]} build from ${data.author}`
)
.setDescription(
2023-04-18 11:47:47 +02:00
`<:nyx_description:897379659665264650> Description \`\`\`\n${data.notes}\n\`\`\``
)
.setColor(16580400)
.setImage(data.imageUrl)
2023-04-18 11:47:47 +02:00
.setFooter(
`Builds Aggregated by ${client.author}`,
client.user.displayAvatarURL()
)
.setTimestamp()
.addFields(
{
name: "<:nyx_author:897379080549314601> Author:",
value: `\`\`\`\n${data.author}\n\`\`\``,
inline: true,
},
{
name: "<a:lastupdate:897381474330873887> Last Updated:",
value: `\`\`\`\n${moment(Date.parse(data.lastUpdate)).format(
"MMMM Do YYYY"
)}\n\`\`\``,
inline: true,
},
{
name: ":id: CWTS:",
value: `\`\`\`\n${data.cwts}\n\`\`\``,
inline: true,
},
{
name: ":paperclip: Attachments:",
value: arr.join("\n"),
},
{
name: "<a:tags:897034924140404776> Tags",
value: data.tags.join(", "),
}
)
.setURL(client.web);
interaction.followUp({
embeds: [embed],
});
}
},
2022-01-28 21:19:50 +01:00
};
2023-04-18 11:47:47 +02:00
// ENABLE AFTER Holloween
// run: async (client, interaction, args) => {
// const embed = new MessageEmbed()
// .setTitle(`Prefix commands are now disabled`)
// .setDescription(`Please enable **Application commands** in the channel settings to get access to slash commands, we have discontinued prefix commands.`)
// .setColor(client.color)
// .setThumbnail(interaction.guild.iconURL({ dynamic: true }))
// .addFields(
// {
// name: "Need help ?",
// value: `Join our **[Support Server](https://discord.gg/SR7TeNJG67)**`,
// inline: true,
// },
// {
// name: "Support us <a:donate:896985486260846614>",
// value: `[KoFi](https://ko-fi.com/cathteam)`,
// inline: true,
// }
// )
// .setThumbnail("../../util/assets/images/nyx_logo_transparent.webp")
// .setTimestamp();
// interaction.followUp({ embeds: [embed] });
// },
// };