2021-11-18 18:56:42 +01:00
const { MessageEmbed } = require ( "discord.js" ) ;
const moment = require ( "moment" ) ;
2022-01-28 09:00:28 +01:00
const axios = require ( "axios" ) ;
2021-11-18 18:56:42 +01:00
module . exports = {
name : "build" ,
description : "Get gunsmith builds" ,
type : "CHAT_INPUT" ,
category : "CODM" ,
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 : [
{
2022-01-28 09:00:28 +01:00
name : "Type 25" ,
2022-01-28 09:24:01 +01:00
value : "A01" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "M16" ,
2022-01-28 09:00:28 +01:00
value : "A02" ,
2021-11-18 18:56:42 +01:00
} ,
{
2022-01-28 09:00:28 +01:00
name : "AK117" ,
value : "A03" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "AK-47" ,
2022-01-28 09:00:28 +01:00
value : "A04" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "ASM10" ,
2022-01-28 09:00:28 +01:00
value : "A05" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "M4" ,
2022-01-28 09:00:28 +01:00
value : "A06" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "BK57" ,
2022-01-28 09:00:28 +01:00
value : "A07" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "LK24" ,
2022-01-28 09:00:28 +01:00
value : "A08" ,
2021-11-18 18:56:42 +01:00
} ,
{
2022-01-28 09:00:28 +01:00
name : "ICR-1" ,
value : "A09" ,
2021-11-18 18:56:42 +01:00
} ,
{
2022-01-28 09:00:28 +01:00
name : "Man-o-War" ,
value : "A10" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "KN-44" ,
2022-01-28 09:00:28 +01:00
value : "A11" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "HBRa3" ,
2022-01-28 09:00:28 +01:00
value : "A12" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "HVK-30" ,
2022-01-28 09:00:28 +01:00
value : "A13" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "DR-H" ,
2022-01-28 09:00:28 +01:00
value : "A14" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Peacekeeper MK2" ,
2022-01-28 09:00:28 +01:00
value : "A15" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "FR .556" ,
2022-01-28 09:00:28 +01:00
value : "A16" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "AS VAL" ,
2022-01-28 09:00:28 +01:00
value : "A17" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "CR-56 AMAX" ,
2022-01-28 09:00:28 +01:00
value : "A18" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "M13" ,
2022-01-28 09:00:28 +01:00
value : "A19" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Swordfish" ,
2022-01-28 09:00:28 +01:00
value : "A20" ,
} ,
{
name : "Kilo 141" ,
value : "A21" ,
2021-11-18 18:56:42 +01:00
} ,
] ,
} ,
{
type : 3 ,
name : "youtuber" ,
description : "Select a Content Creator" ,
required : true ,
choices : [
{
2022-01-30 10:03:03 +01:00
name : "path.exe" ,
value : "path.exe" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Jokesta" ,
2022-01-22 14:32:58 +01:00
value : "jokesta" ,
2021-11-18 18:56:42 +01:00
} ,
2022-01-22 08:29:32 +01:00
// {
// name: "Stats On Duty",
// value: "sod",
// },
2021-11-18 18:56:42 +01:00
] ,
} ,
{
type : 3 ,
name : "tag" ,
description : "Playstyle/game mode of the build" ,
required : true ,
choices : [
{
name : "Aggressive" ,
value : "aggressive" ,
} ,
{
name : "Passive" ,
value : "passive" ,
} ,
{
name : "Search & Destroy" ,
value : "snd" ,
} ,
{
name : "Respawn" ,
value : "respawn" ,
} ,
] ,
} ,
] ,
} ,
{
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 : [
{
name : "RUS-79u" ,
2022-01-28 09:00:28 +01:00
value : "D01" ,
} ,
{
name : "Chicom" ,
value : "D02" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "PDW-57" ,
2022-01-28 09:00:28 +01:00
value : "D03" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Razorback" ,
2022-01-28 09:00:28 +01:00
value : "D04" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "MSMC" ,
2022-01-28 09:00:28 +01:00
value : "D05" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "HG40" ,
2022-01-28 09:00:28 +01:00
value : "D06" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Pharo" ,
2022-01-28 09:00:28 +01:00
value : "D07" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "GKS" ,
2022-01-28 09:00:28 +01:00
value : "D08" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Cordite" ,
2022-01-28 09:00:28 +01:00
value : "D09" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "QQ9" ,
2022-01-28 09:00:28 +01:00
value : "D10" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Fennec" ,
2022-01-28 09:00:28 +01:00
value : "D11" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "AGR 556" ,
2022-01-28 09:00:28 +01:00
value : "D12" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "QXR" ,
2022-01-28 09:00:28 +01:00
value : "D13" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "PP19 Bizon" ,
2022-01-28 09:00:28 +01:00
value : "D14" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "MX9" ,
2022-01-28 09:00:28 +01:00
value : "D15" ,
2021-11-18 18:56:42 +01:00
} ,
2021-12-09 20:38:01 +01:00
{
name : "CBR4" ,
2022-01-28 09:00:28 +01:00
value : "D16" ,
2021-12-09 20:38:01 +01:00
} ,
2022-01-22 08:29:32 +01:00
{
name : "PPSh 41" ,
2022-01-28 09:00:28 +01:00
value : "D17" ,
2022-01-22 08:29:32 +01:00
} ,
2021-11-18 18:56:42 +01:00
] ,
} ,
{
type : 3 ,
name : "youtuber" ,
description : "Select a Content Creator" ,
required : true ,
choices : [
{
2022-01-30 10:03:03 +01:00
name : "path.exe" ,
value : "path.exe" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Jokesta" ,
value : "jokesta" ,
} ,
] ,
} ,
{
type : 3 ,
name : "tag" ,
description : "Playstyle/game mode of the build" ,
required : true ,
choices : [
{
name : "Aggressive" ,
value : "aggressive" ,
} ,
{
name : "Passive" ,
value : "passive" ,
} ,
{
name : "Search & Destroy" ,
value : "snd" ,
} ,
{
name : "Respawn" ,
value : "respawn" ,
} ,
] ,
} ,
] ,
} ,
{
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 : [
2022-01-28 09:00:28 +01:00
// {
// name: "XPR-50",
// value: "B01",
// },
2021-11-18 18:56:42 +01:00
{
name : "Arctic .50" ,
2022-01-28 09:00:28 +01:00
value : "B02" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "M21 EBR" ,
2022-01-28 09:00:28 +01:00
value : "B03" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "DL Q33" ,
2022-01-28 09:00:28 +01:00
value : "B04" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Locus" ,
2022-01-28 09:00:28 +01:00
value : "B05" ,
2021-11-18 18:56:42 +01:00
} ,
// {
// name: "NA-45",
2022-01-28 09:00:28 +01:00
// value: "B06",
2021-11-18 18:56:42 +01:00
// },
{
name : "Outlaw" ,
2022-01-28 09:00:28 +01:00
value : "B07" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Rytec AMR" ,
2022-01-28 09:00:28 +01:00
value : "B08" ,
2021-11-18 18:56:42 +01:00
} ,
2021-12-09 20:38:01 +01:00
{
name : "SVD" ,
2022-01-28 09:00:28 +01:00
value : "B09" ,
2021-12-09 20:38:01 +01:00
} ,
2021-11-18 18:56:42 +01:00
] ,
} ,
{
type : 3 ,
name : "youtuber" ,
description : "Select a Content Creator" ,
required : true ,
choices : [
{
2022-01-30 10:03:03 +01:00
name : "path.exe" ,
value : "path.exe" ,
2021-11-18 18:56:42 +01:00
} ,
] ,
} ,
{
type : 3 ,
name : "tag" ,
description : "Playstyle/game mode of the build" ,
required : true ,
choices : [
{
name : "Aggressive" ,
value : "aggressive" ,
} ,
{
name : "Passive" ,
value : "passive" ,
} ,
{
name : "Search & Destroy" ,
value : "snd" ,
} ,
{
name : "Respawn" ,
value : "respawn" ,
} ,
] ,
} ,
] ,
} ,
{
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" ,
2022-01-28 09:00:28 +01:00
value : "C01" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "UL736" ,
2022-01-28 09:00:28 +01:00
value : "C02" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "RPD" ,
2022-01-28 09:00:28 +01:00
value : "C03" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "M4 LMG" ,
2022-01-28 09:00:28 +01:00
value : "C04" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Chopper" ,
2022-01-28 09:00:28 +01:00
value : "C05" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Holger 26" ,
2022-01-28 09:00:28 +01:00
value : "C06" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Hades" ,
2022-01-28 09:00:28 +01:00
value : "C07" ,
2021-11-18 18:56:42 +01:00
} ,
2022-01-22 08:29:32 +01:00
{
name : "PKM" ,
2022-01-28 09:00:28 +01:00
value : "C08" ,
2022-01-22 08:29:32 +01:00
} ,
2021-11-18 18:56:42 +01:00
] ,
} ,
{
type : 3 ,
name : "youtuber" ,
description : "Select a Content Creator" ,
required : true ,
choices : [
{
2022-01-30 10:03:03 +01:00
name : "path.exe" ,
value : "path.exe" ,
2021-11-18 18:56:42 +01:00
} ,
] ,
} ,
{
type : 3 ,
name : "tag" ,
description : "Playstyle/game mode of the build" ,
required : true ,
choices : [
{
name : "Aggressive" ,
value : "aggressive" ,
} ,
{
name : "Passive" ,
value : "passive" ,
} ,
{
name : "Search & Destroy" ,
value : "snd" ,
} ,
{
name : "Respawn" ,
value : "respawn" ,
} ,
] ,
} ,
] ,
} ,
{
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" ,
2022-01-28 09:00:28 +01:00
value : "E01" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "BY15" ,
2022-01-28 09:00:28 +01:00
value : "E02" ,
} ,
{
name : "HS0405" ,
value : "E03" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Striker" ,
2022-01-28 09:00:28 +01:00
value : "E04" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "KRM_262" ,
2022-01-28 09:00:28 +01:00
value : "E05" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Echo" ,
2022-01-28 09:00:28 +01:00
value : "E06" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "R9-0" ,
2022-01-28 09:00:28 +01:00
value : "E07" ,
2021-11-18 18:56:42 +01:00
} ,
] ,
} ,
{
type : 3 ,
name : "youtuber" ,
description : "Select a Content Creator" ,
required : true ,
choices : [
{
2022-01-30 10:03:03 +01:00
name : "path.exe" ,
value : "path.exe" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "dHitman" ,
value : "dhitman" ,
} ,
] ,
} ,
{
type : 3 ,
name : "tag" ,
description : "Playstyle/game mode of the build" ,
required : true ,
choices : [
{
name : "ADS" ,
value : "ads" ,
} ,
{
name : "Hipfire" ,
value : "hipfire" ,
} ,
] ,
} ,
] ,
} ,
{
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" ,
2022-01-28 09:00:28 +01:00
value : "F01" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "SKS" ,
2022-01-28 09:00:28 +01:00
value : "F02" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "SP-R 208" ,
2022-01-28 09:00:28 +01:00
value : "F03" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "MK2" ,
2022-01-28 09:00:28 +01:00
value : "F04" ,
2021-11-18 18:56:42 +01:00
} ,
] ,
} ,
{
type : 3 ,
name : "youtuber" ,
description : "Select a Content Creator" ,
required : true ,
choices : [
{
2022-01-30 10:03:03 +01:00
name : "path.exe" ,
value : "path.exe" ,
2021-11-18 18:56:42 +01:00
} ,
] ,
} ,
{
type : 3 ,
name : "tag" ,
description : "Playstyle/game mode of the build" ,
required : true ,
choices : [
{
name : "Aggressive" ,
value : "aggressive" ,
} ,
{
name : "Passive" ,
value : "passive" ,
} ,
{
name : "Respawn" ,
value : "respawn" ,
} ,
] ,
} ,
] ,
} ,
{
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" ,
2022-01-28 09:00:28 +01:00
value : "G01" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "MW11" ,
2022-01-28 09:00:28 +01:00
value : "G02" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : ".50 GS" ,
2022-01-28 09:00:28 +01:00
value : "G03" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Renetti" ,
2022-01-28 09:00:28 +01:00
value : "G04" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Shorty" ,
2022-01-28 09:00:28 +01:00
value : "G05" ,
2021-11-18 18:56:42 +01:00
} ,
{
name : "Crossbow" ,
2022-01-28 09:00:28 +01:00
value : "G06" ,
2021-11-18 18:56:42 +01:00
} ,
] ,
} ,
{
type : 3 ,
name : "youtuber" ,
description : "Select a Content Creator" ,
required : true ,
choices : [
{
2022-01-30 10:03:03 +01:00
name : "path.exe" ,
value : "path.exe" ,
2021-11-18 18:56:42 +01:00
} ,
] ,
} ,
{
type : 3 ,
name : "tag" ,
description : "Playstyle/game mode of the build" ,
required : true ,
choices : [
{
name : "Respawn" ,
value : "respawn" ,
} ,
] ,
} ,
] ,
} ,
] ,
run : async ( client , interaction , args ) => {
2022-01-28 09:00:28 +01:00
const cwts = args [ 1 ] ;
2021-11-18 18:56:42 +01:00
const cc = args [ 2 ] ;
const tag = args [ 3 ] ;
const data = await axios
. get (
2022-01-30 10:03:03 +01:00
` ${ process . env . api } /api/v1/codm/build?cwts= ${ cwts } &cc= ${ cc } &tag= ${ tag } ` ,
2022-01-28 21:19:50 +01:00
{
2021-11-18 18:56:42 +01:00
headers : {
2022-01-28 21:19:50 +01:00
Authorization : process . env . CODM _API _KEY ,
2021-11-18 18:56:42 +01:00
} ,
}
)
. then ( res => res . data )
2022-01-16 23:39:30 +01:00
. catch ( e => null ) ;
2022-01-30 03:02:25 +01:00
var all = {
2022-01-30 10:03:03 +01:00
"path.exe" : "path.exe" ,
2022-01-30 03:02:25 +01:00
dhitman : "dHitman" ,
jokesta : "Jokesta" ,
// littleb:"Little B",
2022-01-28 09:00:28 +01:00
2022-01-30 03:02:25 +01:00
aggressive : "Aggressive" ,
passive : "Passive" ,
snd : "Search And Destroy" ,
respawn : "Respawn" ,
ads : "ADS" ,
hipfire : "Hipfire" ,
2022-01-30 03:05:30 +01:00
} ;
2022-01-30 10:03:03 +01:00
if ( ! data ? . cwts ) {
2021-12-10 19:42:33 +01:00
const embed = new MessageEmbed ( )
. setDescription (
2022-01-30 10:03:03 +01:00
` <:nyx_not_available:897378400031879188> We don't have a ${ all [ tag ] } gunsmith build for the gun with **CWTS ${ cwts } ** by ** ${ all [ cc ] } **, Please try another tag or a differnt content creator `
2021-12-10 19:42:33 +01:00
)
. setColor ( client . color ) ;
interaction . followUp ( { embeds : [ embed ] } ) ;
2021-11-18 18:56:42 +01:00
} else {
const arr = [ ] ;
data . attachments . map ( ( e , i ) => {
2021-12-09 20:38:01 +01:00
return arr . push ( ` ** ${ i + 1 } :** ${ e } ` ) ;
2021-11-18 18:56:42 +01:00
} ) ;
const embed = new MessageEmbed ( )
. setTitle (
2022-01-28 21:19:50 +01:00
` ${ all [ tag ] } build for ${ data . weaponName } from ${ data . author } `
2021-11-18 18:56:42 +01:00
)
. setDescription (
2022-01-26 16:36:17 +01:00
` <:nyx_description:897379659665264650> **Description** \` \` \` \n ${ data . notes } \n \` \` \` `
2021-11-18 18:56:42 +01:00
)
. setColor ( 16580400 )
. setImage ( data . imageUrl )
2022-01-30 10:03:03 +01:00
. setFooter ( {
text : ` Builds Aggregated by ${ client . author } ` ,
iconURL : client . user . displayAvatarURL ( ) ,
} )
2021-11-18 18:56:42 +01:00
. 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
} ;