[DONT PULL] updated buillds.js for api changes

This commit is contained in:
ThunderE75 2022-01-28 13:30:28 +05:30
parent cc01522b33
commit f672b78b08

View file

@ -1,6 +1,7 @@
const { MessageEmbed } = require("discord.js");
const axios = require("axios");
const c = new CODMClient("Gae");
const moment = require("moment");
const axios = require("axios");
module.exports = {
name: "build",
description: "Get gunsmith builds",
@ -19,89 +20,89 @@ module.exports = {
required: true,
choices: [
{
name: "AK117",
value: "ak117",
name: "Type 25",
value: "A03",
},
{
name: "M16",
value: "m16",
value: "A02",
},
{
name: "Type 25",
value: "type25",
name: "AK117",
value: "A03",
},
{
name: "AK-47",
value: "ak47",
value: "A04",
},
{
name: "ASM10",
value: "asm10",
value: "A05",
},
{
name: "M4",
value: "m4",
value: "A06",
},
{
name: "BK57",
value: "bk57",
value: "A07",
},
{
name: "LK24",
value: "lk24",
},
{
name: "Man-o-War",
value: "manowar",
value: "A08",
},
{
name: "ICR-1",
value: "icr1",
value: "A09",
},
{
name: "Man-o-War",
value: "A10",
},
{
name: "KN-44",
value: "kn44",
value: "A11",
},
{
name: "HBRa3",
value: "hbra3",
value: "A12",
},
{
name: "HVK-30",
value: "hvk30",
value: "A13",
},
{
name: "DR-H",
value: "drh",
value: "A14",
},
{
name: "Peacekeeper MK2",
value: "peacekeepermk2",
value: "A15",
},
{
name: "FR .556",
value: "fr556",
value: "A16",
},
{
name: "AS VAL",
value: "asval",
value: "A17",
},
{
name: "CR-56 AMAX",
value: "cr56amax",
value: "A18",
},
{
name: "M13",
value: "m13",
value: "A19",
},
{
name: "Swordfish",
value: "swordfish",
value: "A20",
},
{
name: "Kilo 141",
value: "A21",
},
// {
// name: "Kilo 141",
// value: "kilo",
// },
],
},
{
@ -163,71 +164,71 @@ module.exports = {
choices: [
{
name: "RUS-79u",
value: "rus79u",
},
{
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",
value: "D01",
},
{
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",
value: "agr556",
value: "D12",
},
{
name: "QXR",
value: "qxr",
value: "D13",
},
{
name: "PP19 Bizon",
value: "pp19bizon",
value: "D14",
},
{
name: "MX9",
value: "mx9",
value: "D15",
},
{
name: "CBR4",
value: "cbr4",
value: "D16",
},
{
name: "PPSh 41",
value: "ppsh",
value: "D17",
},
],
},
@ -284,41 +285,41 @@ module.exports = {
description: "Name of the Gun",
required: true,
choices: [
// {
// name: "XPR-50",
// value: "B01",
// },
{
name: "Arctic .50",
value: "arctic50",
value: "B02",
},
{
name: "M21 EBR",
value: "m21ebr",
value: "B03",
},
{
name: "DL Q33",
value: "dlq33",
value: "B04",
},
{
name: "Locus",
value: "locus",
value: "B05",
},
// {
// name: "XPR-50",
// value: "xpr50",
// },
// {
// name: "NA-45",
// value: "na45",
// value: "B06",
// },
{
name: "Outlaw",
value: "outlaw",
value: "B07",
},
{
name: "Rytec AMR",
value: "rytecamr",
value: "B08",
},
{
name: "SVD",
value: "svd",
value: "B09",
},
],
},
@ -332,10 +333,6 @@ module.exports = {
name: "Path.exe",
value: "path",
},
// {
// name: "little_b",
// value: "littleb",
// },
],
},
{
@ -377,35 +374,35 @@ module.exports = {
choices: [
{
name: "S36",
value: "s36",
value: "C01",
},
{
name: "UL736",
value: "ul736",
value: "C02",
},
{
name: "RPD",
value: "rpd",
value: "C03",
},
{
name: "M4 LMG",
value: "m4lmg",
value: "C04",
},
{
name: "Chopper",
value: "chopper",
value: "C05",
},
{
name: "Holger 26",
value: "holger26",
value: "C06",
},
{
name: "Hades",
value: "hades",
value: "C07",
},
{
name: "PKM",
value: "pkm",
value: "C08",
},
],
},
@ -460,31 +457,31 @@ module.exports = {
choices: [
{
name: "HS2126",
value: "hs2126",
value: "E01",
},
{
name: "BY15",
value: "by15",
},
{
name: "Striker",
value: "striker",
},
{
name: "KRM_262",
value: "krm262",
},
{
name: "Echo",
value: "echo",
value: "E02",
},
{
name: "HS0405",
value: "hs0405",
value: "E03",
},
{
name: "Striker",
value: "E04",
},
{
name: "KRM_262",
value: "E05",
},
{
name: "Echo",
value: "E06",
},
{
name: "R9-0",
value: "r90",
value: "E07",
},
],
},
@ -535,19 +532,19 @@ module.exports = {
choices: [
{
name: "Kilo Bolt-Action",
value: "kiloboltaction",
value: "F01",
},
{
name: "SKS",
value: "sks",
value: "F02",
},
{
name: "SP-R 208",
value: "spr208",
value: "F03",
},
{
name: "MK2",
value: "mk2",
value: "F04",
},
],
},
@ -561,10 +558,6 @@ module.exports = {
name: "Path.exe",
value: "path",
},
// {
// name: "Little_b",
// value: "littleb",
// },
],
},
{
@ -602,27 +595,27 @@ module.exports = {
choices: [
{
name: "J358",
value: "j358",
value: "G01",
},
{
name: "MW11",
value: "mw11",
value: "G02",
},
{
name: ".50 GS",
value: "gs50",
value: "G03",
},
{
name: "Renetti",
value: "renetti",
value: "G04",
},
{
name: "Shorty",
value: "shorty",
value: "G05",
},
{
name: "Crossbow",
value: "crossbow",
value: "G06",
},
],
},
@ -654,115 +647,13 @@ module.exports = {
},
],
run: async (client, interaction, args) => {
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",
// 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 cwts = args[1];
const cc = args[2];
const tag = args[3];
const data = await axios
.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}`,
{ //Use the new auth methord
headers: {
Authorization: "Gae",
},
@ -770,7 +661,8 @@ module.exports = {
)
.then(res => res.data)
.catch(e => null);
if (!data?.ID) {
if (!data?.ID) { //x what does ?. do
const embed = 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`
@ -784,7 +676,7 @@ module.exports = {
});
const embed = new MessageEmbed()
.setTitle(
`${data.weaponName}(${data.weaponType})'s ${all[tag]} build from ${data.author}`
`${all[tag]} for ${data.weaponName} from ${data.author}`
)
.setDescription(
`<:nyx_description:897379659665264650> **Description** \`\`\` \n${data.notes} \n\`\`\``