scorestreak command
This commit is contained in:
parent
4f3feb9504
commit
6ddb0b7781
7 changed files with 16 additions and 203 deletions
|
@ -1,2 +1,2 @@
|
||||||
const { CODMClient } = require("cath");
|
const { CODMClient } = require("cath");
|
||||||
module.exports = new CODMClient("Gae");
|
module.exports = new CODMClient(process.env.CODM_API_KEY);
|
||||||
|
|
|
@ -764,7 +764,7 @@ module.exports = {
|
||||||
`${process.env.api}/api/v1/codm/builds?name=${gun}&cc=${cc}&tag=${tag}`,
|
`${process.env.api}/api/v1/codm/builds?name=${gun}&cc=${cc}&tag=${tag}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Gae",
|
Authorization: process.env.CODM_API_KEY,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const { MessageEmbed } = require("discord.js");
|
const { MessageEmbed } = require("discord.js");
|
||||||
const { CODMClient } = require("cath");
|
const c = require("../../client/CODMClient");
|
||||||
const c = new CODMClient("Gae");
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "perk",
|
name: "perk",
|
||||||
description: "Get perk stats",
|
description: "Get perk stats",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const { MessageEmbed } = require("discord.js");
|
const { MessageEmbed } = require("discord.js");
|
||||||
const { CODMClient } = require("cath");
|
const c = require("../../client/CODMClient");
|
||||||
const c = new CODMClient("Gae");
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "scorestreak",
|
name: "scorestreak",
|
||||||
description: "Get Scorestreak stats",
|
description: "Get Scorestreak stats",
|
||||||
|
@ -59,10 +58,6 @@ module.exports = {
|
||||||
name: "Cluster Strike",
|
name: "Cluster Strike",
|
||||||
value: "clusterstrike",
|
value: "clusterstrike",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "XS1 Goliath",
|
|
||||||
value: "xs1goliath",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "Stealth Chopper",
|
name: "Stealth Chopper",
|
||||||
value: "stealthchopper",
|
value: "stealthchopper",
|
||||||
|
@ -131,7 +126,7 @@ module.exports = {
|
||||||
const val = args[1];
|
const val = args[1];
|
||||||
const d = await c.getscorestreak(val);
|
const d = await c.getscorestreak(val);
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle(d.scorestreak)
|
.setTitle(d.name)
|
||||||
.setURL(d.preview_video)
|
.setURL(d.preview_video)
|
||||||
.setDescription(`\`\`\`${d.description}\`\`\``)
|
.setDescription(`\`\`\`${d.description}\`\`\``)
|
||||||
.addFields(
|
.addFields(
|
||||||
|
@ -140,21 +135,11 @@ module.exports = {
|
||||||
value: `\`\`\`${d.cost}\`\`\``,
|
value: `\`\`\`${d.cost}\`\`\``,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "Lethal",
|
|
||||||
value: `
|
|
||||||
${
|
|
||||||
d.lethal == true
|
|
||||||
? "<a:nyx_checkmark:897240322411724841> Yes"
|
|
||||||
: "<a:nyx_cross:897244999211696198> No"
|
|
||||||
}`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "AI-Assisted",
|
name: "AI-Assisted",
|
||||||
value: `
|
value: `
|
||||||
${
|
${
|
||||||
d.manual == false
|
d.manual
|
||||||
? "<a:nyx_checkmark:897240322411724841> Yes"
|
? "<a:nyx_checkmark:897240322411724841> Yes"
|
||||||
: "<a:nyx_cross:897244999211696198> No"
|
: "<a:nyx_cross:897244999211696198> No"
|
||||||
}`,
|
}`,
|
||||||
|
@ -162,16 +147,19 @@ module.exports = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "More Info",
|
name: "More Info",
|
||||||
value: `\`\`\`${d.special}\`\`\``,
|
value: `\`\`\`${d.special ? d.special : "** **"}\`\`\``,
|
||||||
inline: false,
|
inline: false,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.setThumbnail(d.preview)
|
.setThumbnail(d.preview)
|
||||||
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
|
.setFooter({
|
||||||
|
text: `Made by ${client.author}`,
|
||||||
|
iconURL: client.user.displayAvatarURL(),
|
||||||
|
})
|
||||||
.setColor(
|
.setColor(
|
||||||
d.type == "lethal"
|
d.type == "lethal"
|
||||||
? "FF2222"
|
? "FF2222"
|
||||||
: d.type == "support"
|
: d.type == "assist"
|
||||||
? "22FF4A"
|
? "22FF4A"
|
||||||
: client.color
|
: client.color
|
||||||
)
|
)
|
|
@ -1,177 +0,0 @@
|
||||||
const { MessageEmbed } = require("discord.js");
|
|
||||||
const { CODMClient } = require("cath");
|
|
||||||
const c = new CODMClient("Gae");
|
|
||||||
module.exports = {
|
|
||||||
name: "scorestreak",
|
|
||||||
description: "Get Scorestreak stats",
|
|
||||||
type: "CHAT_INPUT",
|
|
||||||
usage: "{Scorestreak}",
|
|
||||||
category: "CODM",
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
type: "SUB_COMMAND",
|
|
||||||
name: "lethal",
|
|
||||||
description: "Lethal Scorestreak",
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
type: 3,
|
|
||||||
name: "scorestreak",
|
|
||||||
description: "Select a lethal scorestreak",
|
|
||||||
required: true,
|
|
||||||
choices: [
|
|
||||||
{
|
|
||||||
name: "Shield Turret",
|
|
||||||
value: "shieldturret",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Hunter Killer Drone",
|
|
||||||
value: "hunterkillerdrone",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "MQ-27 Dragonfire",
|
|
||||||
value: "mq27dragonfire",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Predator Missile",
|
|
||||||
value: "predatormissile",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Hawk X3",
|
|
||||||
value: "hawkx3",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Sentry Gun",
|
|
||||||
value: "sentrygun",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Lightning Strike",
|
|
||||||
value: "lightningstrike",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Orbital Laser",
|
|
||||||
value: "orbitallaser",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "XS1 Goliath",
|
|
||||||
value: "xs1goliath",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Cluster Strike",
|
|
||||||
value: "clusterstrike",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "XS1 Goliath",
|
|
||||||
value: "xs1goliath",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Stealth Chopper",
|
|
||||||
value: "stealthchopper",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Swarm",
|
|
||||||
value: "swarm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Napalm",
|
|
||||||
value: "napalm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "VTOL",
|
|
||||||
value: "vtol",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "SUB_COMMAND",
|
|
||||||
name: "support",
|
|
||||||
description: "Support Scorestreak",
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
type: 3,
|
|
||||||
name: "scorestreak",
|
|
||||||
description: "Select a Support Scorestreak",
|
|
||||||
required: true,
|
|
||||||
choices: [
|
|
||||||
{
|
|
||||||
name: "UAV",
|
|
||||||
value: "uav",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Shock RC",
|
|
||||||
value: "shockrc",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Care Package",
|
|
||||||
value: "carepackage",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Counter UAV",
|
|
||||||
value: "cuav",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "SAM Turret",
|
|
||||||
value: "samturret",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Advance UAV",
|
|
||||||
value: "auav",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "EMP Systems",
|
|
||||||
value: "empsystems",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
run: async (client, interaction, args) => {
|
|
||||||
const val = args[1];
|
|
||||||
const d = await c.getscorestreak(val);
|
|
||||||
const embed = new MessageEmbed()
|
|
||||||
.setTitle(d.scorestreak)
|
|
||||||
.setURL(d.preview_video)
|
|
||||||
.setDescription(`\`\`\`${d.description}\`\`\``)
|
|
||||||
.addFields(
|
|
||||||
{
|
|
||||||
name: "Cost",
|
|
||||||
value: `\`\`\`${d.cost}\`\`\``,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Lethal",
|
|
||||||
value: `
|
|
||||||
${d.lethal == true
|
|
||||||
? "<a:nyx_checkmark:897240322411724841> Yes"
|
|
||||||
: "<a:nyx_cross:897244999211696198> No"}`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "AI-Assisted",
|
|
||||||
value: `
|
|
||||||
${d.manual == false
|
|
||||||
? "<a:nyx_checkmark:897240322411724841> Yes"
|
|
||||||
: "<a:nyx_cross:897244999211696198> No"}`,
|
|
||||||
inline: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "More Info",
|
|
||||||
value: `\`\`\`${d.special}\`\`\``,
|
|
||||||
inline: false
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.setThumbnail(`${d.preview}`)
|
|
||||||
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
|
|
||||||
.setColor(
|
|
||||||
d.type == "lethal"
|
|
||||||
? "FF2222"
|
|
||||||
: d.type == "support"
|
|
||||||
? "22FF4A"
|
|
||||||
: client.color
|
|
||||||
)
|
|
||||||
.setTimestamp();
|
|
||||||
interaction.followUp({ embeds: [embed] });
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -41,7 +41,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.25.0",
|
"axios": "^0.25.0",
|
||||||
"cath": "^1.4.6",
|
"cath": "^1.4.7",
|
||||||
"discord.js": "^13.6.0",
|
"discord.js": "^13.6.0",
|
||||||
"dotenv": "^14.2.0",
|
"dotenv": "^14.2.0",
|
||||||
"erela.js": "^2.3.3",
|
"erela.js": "^2.3.3",
|
||||||
|
|
|
@ -5,6 +5,7 @@ const weaponActualName = nmDt.weaponActualName;
|
||||||
const weaponAlliasName = nmDt.weaponAlliasName;
|
const weaponAlliasName = nmDt.weaponAlliasName;
|
||||||
Object.defineProperty(String.prototype, "Simplify", {
|
Object.defineProperty(String.prototype, "Simplify", {
|
||||||
// Function to remove all characters except 0-9 and a-z
|
// Function to remove all characters except 0-9 and a-z
|
||||||
|
// Eg "AK-47" -> "ak47"
|
||||||
value: function Simplify() {
|
value: function Simplify() {
|
||||||
return this.toLowerCase().replace(/[^0-9a-z]/g, "");
|
return this.toLowerCase().replace(/[^0-9a-z]/g, "");
|
||||||
},
|
},
|
||||||
|
@ -112,6 +113,8 @@ function weaponIdentifier(inpmsg) {
|
||||||
: "There isn't any weapon name.";
|
: "There isn't any weapon name.";
|
||||||
}
|
}
|
||||||
let probableWeapons = [];
|
let probableWeapons = [];
|
||||||
|
// Loop through all the weapons to find the probable weapons
|
||||||
|
// Eg: "ak"
|
||||||
for (let i = 0; i < data.cguns.length; i++) {
|
for (let i = 0; i < data.cguns.length; i++) {
|
||||||
if (inpWeaponName.Simplify() == data.cguns[i].gunname.Simplify()) {
|
if (inpWeaponName.Simplify() == data.cguns[i].gunname.Simplify()) {
|
||||||
return JSON.parse(JSON.stringify(data.cguns[i]));
|
return JSON.parse(JSON.stringify(data.cguns[i]));
|
||||||
|
|
Loading…
Reference in a new issue