commit 3654a418f2dc34af37e4a72fd663a2bcf44ad0ce
parent 1f0361c4b968a5838e9533ecb32e04c8798b8c87
Author: ThunderE75 <[email protected]>
Date: Thu, 3 Feb 2022 14:23:05 +0530
Merge branch 'main' into dev
Diffstat:
12 files changed, 321 insertions(+), 1059 deletions(-)
diff --git a/CODM/builds.js b/CODM/builds.js
@@ -1,85 +0,0 @@
-const builds = require("../util/Data/builds.json");
-const guns = builds.Main;
-const Discord = require("discord.js");
-const nmDt = require("../util/Data/aliases.json");
-const weaponActualName = nmDt.weaponActualName;
-const weaponAlliasName = nmDt.weaponAlliasName;
-module.exports = {
- name: "build",
- description: "Check gun builds",
- usage: "(Gun)",
- category: "CODM",
- status: false,
- Owner: true,
- run: async (client, message, args) => {
- const currGun = weaponIdentifier(args.join(" ").replace("\n", " "));
- if (!currGun) message.reply({ content: "Please specify a gun" });
- if (typeof currGun == "string") {
- message.reply({ embeds: [currGun] });
- } else {
- const attachNames = currGun.Attachments.map(
- x => `**${x.Name}** [${builds.AttachmentTypes[x.Type]}]`
- );
- const embed = new Discord.MessageEmbed()
- .setTitle(
- `Build for ${currGun.Name} (${builds.WeaponTypes[currGun.Type]})`
- )
- .setColor(16580400)
- .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
- .setTimestamp()
- .setURL(client.web)
- .setDescription(
- attachNames.reduce(
- (t, x, i, a) => t + (i < a.length - 1 ? "\n" : " \n") + x
- )
- )
- .setImage(currGun.URL);
- return message.reply({ embeds: [embed] });
- }
- },
-};
-function weaponIdentifier(inpWeaponName) {
- if (inpWeaponName.length < 2) {
- return "The name `" + inpWeaponName + "` is too short.";
- }
- let probableWeapons = [];
- for (let i = 0; i < guns.length; i++) {
- if (inpWeaponName.Simplify() == guns[i].Name.Simplify()) {
- return guns[i];
- } else if (guns[i].Name.Simplify().includes(inpWeaponName.Simplify())) {
- probableWeapons.push(i);
- }
- }
-
- if (probableWeapons.length == 1) {
- return guns[probableWeapons[0]];
- }
-
- for (let i = 0; i < weaponAlliasName.length; i++) {
- for (let j = 0; j < weaponAlliasName[i].length; j++) {
- if (weaponAlliasName[i][j].Simplify() == inpWeaponName.Simplify()) {
- for (let i2 = 0; i2 < guns.length; i2++) {
- if (weaponActualName[i].Simplify() == guns[i2].Name.Simplify()) {
- return guns[i2];
- }
- }
- }
- }
- }
- probableWeapons = [...new Set(probableWeapons)];
- if (probableWeapons.length == 1) {
- return guns[probableWeapons[0]];
- }
- if (probableWeapons.length > 1) {
- return (
- "Did you mean `" +
- probableWeapons
- .map(x => guns[x].Name)
- .reduce((out, x, i) =>
- [out, x].join(i === probableWeapons.length - 1 ? "` or `" : "`, `")
- ) +
- "`?"
- );
- }
- return "Couldn't identify the weapon: `" + '"' + inpWeaponName + '"`';
-}
-\ No newline at end of file
diff --git a/command/CODM/build.js b/command/CODM/build.js
@@ -6,7 +6,6 @@ module.exports = {
description: "Get gunsmith builds",
usage: "[Weapon Name] [Author] [Tag]",
type: "CHAT_INPUT",
- usage: "[Weapon Name] [Author] [Tag]",
category: "CODM",
options: [
{
@@ -108,7 +107,7 @@ module.exports = {
},
{
type: 3,
- name: "Author",
+ name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@@ -141,8 +140,8 @@ module.exports = {
value: "passive",
},
{
- name: "Search & Destroy",
- value: "SearchAndDestroy",
+ name: "Search And Destroy",
+ value: "Search And Destroy",
},
{
name: "Respawn",
@@ -164,7 +163,7 @@ module.exports = {
required: true,
choices: [
{
- name: "RUS-79u",
+ name: "RUS-79U",
value: "D01",
},
{
@@ -235,7 +234,7 @@ module.exports = {
},
{
type: 3,
- name: "Author",
+ name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@@ -264,8 +263,8 @@ module.exports = {
value: "passive",
},
{
- name: "Search & Destroy",
- value: "SearchAndDestroy",
+ name: "Search And Destroy",
+ value: "Search And Destroy",
},
{
name: "Respawn",
@@ -326,7 +325,7 @@ module.exports = {
},
{
type: 3,
- name: "Author",
+ name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@@ -351,8 +350,8 @@ module.exports = {
value: "passive",
},
{
- name: "Search & Destroy",
- value: "SearchAndDestroy",
+ name: "Search And Destroy",
+ value: "Search And Destroy",
},
{
name: "Respawn",
@@ -409,7 +408,7 @@ module.exports = {
},
{
type: 3,
- name: "Author",
+ name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@@ -434,8 +433,8 @@ module.exports = {
value: "passive",
},
{
- name: "Search & Destroy",
- value: "SearchAndDestroy",
+ name: "Search And Destroy",
+ value: "Search And Destroy",
},
{
name: "Respawn",
@@ -488,7 +487,7 @@ module.exports = {
},
{
type: 3,
- name: "Author",
+ name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@@ -551,7 +550,7 @@ module.exports = {
},
{
type: 3,
- name: "Author",
+ name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@@ -626,7 +625,7 @@ module.exports = {
},
{
type: 3,
- name: "Author",
+ name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@@ -678,8 +677,8 @@ module.exports = {
aggressive: "Aggressive",
passive: "Passive",
- SearchAndDestroy: "Search And Destroy",
respawn: "Respawn",
+ "Search And Destroy": "Search And Destroy",
ads: "ADS",
hipfire: "Hipfire",
};
diff --git a/command/CODM/loadout.js b/command/CODM/loadout.js
@@ -1,78 +0,0 @@
-const { MessageEmbed } = require("discord.js"); //@night0721 You need to make this
-const items = require("../../util/Data/loadout.json");
-module.exports = {
- name: "class",
- description: "Generate A Random Loadout",
- category: "CODM",
- run: async (client, interaction) => {
- // const data = async () => {
- // const d = await model.findOne({});
- // const types = d.Categories;
- // const names = d.Primary;
- // const category = types[Math.floor(Math.random() * types.length)];
- // const weapons = names[0][category];
- // return `${weapons[Math.floor(Math.random() * weapons.length)]}`;
- // };
- // const primary_weapon = await data();
- // const primary = primary_weapon.replace(/[ -]/g, "_").replace(/\./g, "");
- // const slots = shuffle(Object.keys(Attachments[primary][0]));
- // const slot_1 = slots.next().value,
- // slot_2 = slots.next().value,
- // slot_3 = slots.next().value,
- // slot_4 = slots.next().value,
- // slot_5 = slots.next().value;
- const result = new MessageEmbed()
- .setColor(client.color)
- .setFooter(`Made by ${client.author}`)
- .setURL(client.web)
- .setTitle(`🎲 A Randomly Generated Loadout 🎲`)
- .setDescription(
- `This loadout is a randomly generated, Also try, \`\`\`\`/class\`\`\`\` to get a randomally generated primary weapon gunsmith build`
- )
- .addFields(
- {
- name: `Secondary Weapon`,
- value: ``,
- inline: true,
- },
- {
- name: `Operator Skill`,
- value: ``,
- inline: true,
- },
- {
- name: `Scorestreak`, // 3 Scorestreaks
- value: ``,
- inline: true,
- },
- {
- name: `Red Perk`,
- value: ``,
- inline: true,
- },
- {
- name: `Green Perk`,
- value: ``,
- inline: true,
- },
- {
- name: `Blue Perk`,
- value: ``,
- inline: true,
- }
- )
- .setTimestamp();
- interaction.followUp({ embeds: [result] });
-
- // function* shuffle(array) {
- // let i = array.length;
- // while (i--) {
- // yield array.splice(Math.floor(Math.random() * (i + 1)), 1)[0];
- // }
- // }
- // function getAttachment(gun, slot) {
- // const ca = Attachments[gun][0][slot];
- // return ca[Math.floor(Math.random() * ca.length)];
- // }
- },
-};
diff --git a/command/CODM/new-stats.js b/command/CODM/new-stats.js
@@ -1,774 +0,0 @@
-const { MessageEmbed } = require("discord.js");
-const moment = require("moment");
-const axios = require("axios");
-module.exports = {
- name: "stats",
- description: "Check Stats of a Weapon by SOD",
- usage: "[Weapon Name]",
- category: "CODM",
- options: [
- {
- type: "SUB_COMMAND",
- name: "assault_rifle",
- description: "Get a Stats for Assault Rifle",
- options: [
- {
- type: 3,
- name: "Weapon",
- description: "Name of the Gun",
- required: true,
- choices: [
- {
- name: "Type 25",
- value: "A01",
- },
- {
- name: "M16",
- value: "A02",
- },
- {
- name: "AK117",
- value: "A03",
- },
- {
- name: "AK-47",
- value: "A04",
- },
- {
- name: "ASM10",
- value: "A05",
- },
- {
- name: "M4",
- value: "A06",
- },
- {
- name: "BK57",
- value: "A07",
- },
- {
- name: "LK24",
- value: "A08",
- },
- {
- name: "ICR-1",
- value: "A09",
- },
- {
- name: "Man-o-War",
- value: "A10",
- },
- {
- name: "KN-44",
- value: "A11",
- },
- {
- name: "HBRa3",
- value: "A12",
- },
- {
- name: "HVK-30",
- value: "A13",
- },
- {
- name: "DR-H",
- value: "A14",
- },
- {
- name: "Peacekeeper MK2",
- value: "A15",
- },
- {
- name: "FR .556",
- value: "A16",
- },
- {
- name: "AS VAL",
- value: "A17",
- },
- {
- name: "CR-56 AMAX",
- value: "A18",
- },
- {
- name: "M13",
- value: "A19",
- },
- {
- name: "Swordfish",
- value: "A20",
- },
- {
- name: "Kilo 141",
- value: "A21",
- },
- ],
- },
- ],
- },
- {
- type: "SUB_COMMAND",
- name: "sub_machine_gun",
- description: "Get a Stats for Sub Machine Gun",
- options: [
- {
- type: 3,
- name: "Weapon",
- description: "Name of the Gun",
- required: true,
- choices: [
- {
- name: "RUS-79u",
- value: "D01",
- },
- {
- name: "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: "D12",
- },
- {
- name: "QXR",
- value: "D13",
- },
- {
- name: "PP19 Bizon",
- value: "D14",
- },
- {
- name: "MX9",
- value: "D15",
- },
- {
- name: "CBR4",
- value: "D16",
- },
- {
- name: "PPSh 41",
- value: "D17",
- },
- ],
- },
- ],
- },
- {
- type: "SUB_COMMAND",
- name: "sniper_rifle",
- description: "Get a Stats for Sniper Rifle",
- options: [
- {
- type: 3,
- name: "Weapon",
- description: "Name of the Gun",
- required: true,
- choices: [
- // {
- // name: "XPR-50",
- // value: "B01",
- // },
- {
- name: "Arctic .50",
- value: "B02",
- },
- {
- name: "M21 EBR",
- value: "B03",
- },
- {
- name: "DL Q33",
- value: "B04",
- },
- {
- name: "Locus",
- value: "B05",
- },
- // {
- // name: "NA-45",
- // value: "B06",
- // },
- {
- name: "Outlaw",
- value: "B07",
- },
- {
- name: "Rytec AMR",
- value: "B08",
- },
- {
- name: "SVD",
- value: "B09",
- },
- ],
- },
- ],
- },
- {
- type: "SUB_COMMAND",
- name: "light_machine_gun",
- description: "Get a Stats for Light Machine Gun",
- options: [
- {
- type: 3,
- name: "Weapon",
- description: "Name of the Gun",
- required: true,
- choices: [
- {
- name: "S36",
- value: "C01",
- },
- {
- name: "UL736",
- value: "C02",
- },
- {
- name: "RPD",
- value: "C03",
- },
- {
- name: "M4 LMG",
- value: "C04",
- },
- {
- name: "Chopper",
- value: "C05",
- },
- {
- name: "Holger 26",
- value: "C06",
- },
- {
- name: "Hades",
- value: "C07",
- },
- {
- name: "PKM",
- value: "C08",
- },
- ],
- },
- ],
- },
- {
- type: "SUB_COMMAND",
- name: "shotgun",
- description: "Get a Stats for Shotgun",
- options: [
- {
- type: 3,
- name: "Weapon",
- description: "Name of the Gun",
- required: true,
- choices: [
- {
- name: "HS2126",
- value: "E01",
- },
- {
- name: "BY15",
- value: "E02",
- },
- {
- name: "HS0405",
- value: "E03",
- },
- {
- name: "Striker",
- value: "E04",
- },
- {
- name: "KRM_262",
- value: "E05",
- },
- {
- name: "Echo",
- value: "E06",
- },
- {
- name: "R9-0",
- value: "E07",
- },
- ],
- },
- ],
- },
- {
- type: "SUB_COMMAND",
- name: "marksman_rifle",
- description: "Get a Stats for Marksman Rifle",
- options: [
- {
- type: 3,
- name: "Weapon",
- description: "Name of the Gun",
- required: true,
- choices: [
- {
- name: "Kilo Bolt-Action",
- value: "F01",
- },
- {
- name: "SKS",
- value: "F02",
- },
- {
- name: "SP-R 208",
- value: "F03",
- },
- {
- name: "MK2",
- value: "F04",
- },
- ],
- },
- ],
- },
- {
- type: "SUB_COMMAND",
- name: "pistol",
- description: "Get a Stats for Pistol",
- options: [
- {
- type: 3,
- name: "Weapon",
- description: "Name of the Gun",
- required: true,
- choices: [
- {
- name: "J358",
- value: "G01",
- },
- {
- name: "MW11",
- value: "G02",
- },
- {
- name: ".50 GS",
- value: "G03",
- },
- {
- name: "Renetti",
- value: "G04",
- },
- {
- name: "Shorty",
- value: "G05",
- },
- {
- name: "Crossbow",
- value: "G06",
- },
- ],
- },
- ],
- },
- ],
- // It's not complete, Still work in progress.
- run: async (client, interaction, args) => {
- const cwts = args[1];
- const data = await axios
- .get(`${process.env.api}/api/v1/codm/builds?cwts=${cwts}`, {
- headers: {
- Authorization: process.env.CODM_API_KEY,
- },
- })
- .then((res) => res.data)
- .catch((e) => null);
-
- if (!data?.ID) {
- const embed = new MessageEmbed()
- .setDescription(
- `<:nyx_not_available:897378400031879188> Sorry, We currently don't have Stats for this Weapon`
- )
- .setColor(client.color);
- interaction.followUp({ embeds: [embed] });
- } else {
- const embed = new MessageEmbed()
- .setTitle(
- `${data.author} Statistical Breakdown`
- )
- .setColor(16580400)
- .setImage(data.imageUrl)
- .setFooter(
- `Stats Curtosy of Round Table`,
- )
- // .setFooter(
- // `Stats Curtosy of Stats on Duty`,
- // )
- .setDescription(
- `<:nyx_description:897379659665264650> **Description** \n${data.description}`
- )
- .addFields(
- {
- name: ":id: CWTS:",
- value: `\`\`\`\n${data.cwts}\n\`\`\``,
- inline: true,
- },
- {
- name: "<a:lastupdate:897381474330873887> Last Updated:",
- value: `\`\`\`\n${moment(Date.parse(data.lastUpdate)).format(
- "MMMM Do YYYY"
- )}\n\`\`\``,
- inline: true,
- },
- {
- name: "Basic Stats",
- value: `\`\`\`\n
- BSA Score: ${data.bsa_score}
- Hipfire Score: ${data.hipfire_score}
- Rate of Fire\t\t\t\t: ${data.rof}
- Penetration Level\t\t: ${data.penetration}
- Firing Mode\t\t\t\t\t: Full Auto
-
- \n\`\`\``,
- inline: false,
- },
- {
- name: "Handling & Mobility",
- value: `\`\`\`\n
- Drop Time : 416.6 ms
- Raise Time : 650 ms
- Sprinting Speed : 6.09 m/s
- Walking Speed : 4.51 m/s
- Sprint-to-Fire Time : 165 ms
- \n\`\`\``,
- inline: false,
- },
- {
- name: "Ammunation Stats",
- value: `\`\`\`\n
- Magazine : 30
- Reserve : 120
- Reload Type : Magazine
- Cancel Reload Time : 1.9 s
- Reload Time : 2.3 s
- Full Reload Time : 3.2 s
- \n\`\`\``,
- inline: false,
- },
- {
- name: ":paperclip: Attachments:",
- value: arr.join("\n"),
- },
- {
- name: "<a:tags:897034924140404776> Tags",
- value: data.tags.join(", "),
- }
- )
- .setURL(client.web);
- interaction.followUp({ embeds: [embed] });
- }
- },
-};
-
-// @night0721 Damage profile will be avalable by different command
-
-
-
-// recoilAvailable = false;
-// hasError = false;
-// console.log(args);
-// const repEmb = statsHandler(args.join(" ").replace("\n", " "));
-// if (hasError) {
-// interaction.followUp({ embeds: [repEmb] });
-// }
-// if (recoilAvailable) {
-// repEmb.fields.push({
-// name: "**Recoil Graph**",
-// value:
-// "```\nThe Recoil graph below is dynamic (change based on attachment equipped)```",
-// });
-// const recoilImageLink = await chart.getShortUrl();
-// repEmb.image = { url: recoilImageLink };
-// }
-// interaction.followUp({ embeds: [repEmb] });
-// },
-// }
-
-
-// run: async (client, interaction, args) => {
-// recoilAvailable = false;
-// hasError = false;
-// console.log(args);
-// const repEmb = statsHandler(args.join(" ").replace("\n", " "));
-// if (hasError) {
-// interaction.followUp({ embeds: [repEmb] });
-// }
-// if (recoilAvailable) {
-// repEmb.fields.push({
-// name: "**Recoil Graph**",
-// value:
-// "```\nThe Recoil graph below is dynamic (change based on attachment equipped)```",
-// });
-// const recoilImageLink = await chart.getShortUrl();
-// repEmb.image = { url: recoilImageLink };
-// }
-// interaction.followUp({ embeds: [repEmb] });
-// },
-// };
-
-// function inpHandler(inpmsg) {
-// statsHandler(inpmsg.split("+")[0]);
-// }
-
-// function statsHandler(inpmsg) {
-// let statsNames = [
-// "Pellets",
-// "Detonation Range",
-// "Explosion Radius",
-// "Explosion Damage",
-// "Firing Mode",
-// "Rate of Fire",
-// "Bullet in Burst",
-// "Time Between Burst",
-// "Bullet Speed",
-// "Penetration Level",
-// "Bullet Spread",
-// "Idle Sway",
-// "Hipfire Pellet Spread",
-// "ADS Pellet Spread",
-// "ADS Time",
-// "Sprint-to-Fire Time",
-// "ADS Zoom",
-// "Magazine",
-// "Reserve",
-// "Reload Type",
-// "Cancel Reload Time",
-// "Reload Time",
-// "Full Reload Time",
-// "Drop Time",
-// "Raise Time",
-// "Sprinting Speed",
-// "Walking Speed",
-// "Straifing Speed",
-// "Damage per Tick",
-// "Number of Ticks",
-// "Time Between Ticks",
-// "Breath Hold Time",
-// "shouldNeverHappen0",
-// "shouldNeverHappen1",
-// "shouldNeverHappen2",
-// "shouldNeverHappen3",
-// "shouldNeverHappen4",
-// ],
-// out = [];
-
-// currGun = common.weaponIdentifier(inpmsg);
-// if (typeof currGun == "string") {
-// hasError = true;
-// return currGun;
-// }
-// currStats = currGun.stats;
-// currDRM = currGun.drm[0];
-// currAttachments = [];
-// currAttachments = common.attachmentsIdentifier(
-// inpmsg,
-// currGun.aments,
-// currStats
-// );
-// if (typeof currAttachments == "string") {
-// hasError = true;
-// return currAttachments;
-// }
-// currRecoilArr = [1, 1, currGun.stats[17]];
-// if (currAttachments.length != 0) {
-// const totalEffects = common.totaler(currAttachments);
-
-// currStats = common.updateStatswithEffects(totalEffects, currStats);
-// currRecoilArr = [totalEffects[2], totalEffects[3], currGun.stats[17]]; // must happen after currStats update
-// currDRM = currGun.drm[totalEffects[37]];
-// currDRM.range = currDRM.range.map(x =>
-// Math.round(x * (1 + totalEffects[13] / 100))
-// );
-// out = common.attachmentHandler(totalEffects, currStats);
-// }
-// function statsWorker() {
-// if (currStats[19] === 2) {
-// currStats[21] =
-// currStats[20] + currStats[21] * currStats[17] + currStats[22];
-// currStats[20] = 0;
-// currStats[22] = 0;
-// }
-// currStats[25] = (currStats[25] * currStats[26]) / 100;
-
-// const outReady = currStats.map((x, i) =>
-// x ? statsNames[i].padEnd(24) + ":".padEnd(3) + beautifier(i) : ""
-// );
-// out = [
-// ...[
-// "Basic Stats",
-// "ADS Stats",
-// "Bullet Stats",
-// "Magazine",
-// "Handling Stats",
-// "Mobility Stats",
-// "Miscellaneous Stats",
-// ].map((x, i) =>
-// fieldMaker(
-// x,
-// [
-// [04, 05, 09],
-// [14, 16, 11, 31],
-// [00, 06, 07, 08, 10, 12, 13],
-// [17, 18, 19, 20, 21, 22],
-// [23, 24],
-// [25, 26, 27, 15],
-// [28, 29, 30, 01, 02, 03],
-// ][i]
-// )
-// ),
-// ...out,
-// ];
-// function fieldMaker(inpName, inpIndx) {
-// inpIndx = inpIndx.filter(x => outReady[x]);
-// return inpIndx.length
-// ? {
-// name: "**" + inpName + "**",
-// value: "```\n" + inpIndx.map(x => outReady[x]).join("\n") + "```",
-// }
-// : "";
-// }
-// }
-// statsWorker();
-
-// function beautifier(j) {
-// switch (j) {
-// case 04:
-// return data.firingModes[currStats[j] - 1];
-// case 09:
-// return data.penetrationLevels[currStats[j] - 1];
-// case 19:
-// return data.reloadTypes[currStats[j] - 1];
-// case 08:
-// if (currStats[j] == -1) {
-// return "Infinity";
-// } else {
-// return parseFloat(currStats[j].toFixed(2)).toString() + " m/s";
-// }
-// case 03:
-// return parseFloat(currStats[j].toFixed(2))
-// .toString()
-// .replace(".", " ~ ");
-// default:
-// return parseFloat(currStats[j].toFixed(2)).toString() + addUnit(j);
-// }
-
-// function addUnit(j) {
-// switch (j) {
-// case 07:
-// case 14:
-// case 15:
-// case 23:
-// case 24:
-// case 31:
-// return " ms";
-// case 27:
-// case 28:
-// case 25:
-// case 26:
-// return " m/s";
-// case 20:
-// case 21:
-// case 22:
-// return " s";
-// case 16:
-// return "%";
-// case 06:
-// return " Rounds";
-// case 05:
-// return " RPM";
-// default:
-// return "";
-// }
-// }
-// }
-// interpretion = currGun.gunname + common.interpretioner(currAttachments);
-// if (currGun.recoil.hr.length > 2) {
-// chart = common.recoilHandler(
-// currGun.recoil.hr,
-// currGun.recoil.vr,
-// currRecoilArr[0],
-// currRecoilArr[1],
-// currRecoilArr[2]
-// );
-// recoilAvailable = true;
-// } else {
-// recoilAvailable = false;
-// }
-// if (chart == "none") {
-// recoilAvailable = false;
-// }
-// if (chart == "err" || currAttachments == "err") {
-// hasError = true;
-// return "Cocaineeee";
-// }
-// const dmg =
-// common.damageHandler(
-// currDRM.damage,
-// currDRM.range,
-// 1,
-// 100,
-// 60000 / currStats[5],
-// currStats[7],
-// currStats[6],
-// currStats[0]
-// ) || "```This should never happen```";
-// out = [
-// currGun.description
-// ? {
-// name: "**Description:**",
-// value: "```\n" + currGun.description + "```",
-// }
-// : {},
-// { name: "**Damage Profile:**", value: dmg },
-// ...out,
-// ];
-// out = out.filter(x => x.value);
-// return {
-// title: interpretion,
-// color: 5814783,
-// fields: out,
-// footer: {
-// text: "[OUTDATED] All data courtesy of Project Lighthouse 2.0 and CoDM Research Crew",
-// icon_url:
-// "https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png",
-// },
-// };
diff --git a/command/CODM/scorestreak.js b/command/CODM/scorestreak.js
@@ -0,0 +1,170 @@
+const { MessageEmbed } = require("discord.js");
+const c = require("../../client/CODMClient");
+module.exports = {
+ name: "scorestreak",
+ description: "Get Scorestreak stats",
+ type: "CHAT_INPUT",
+ usage: "{Scorestreak}",
+ category: "CODM",
+ options: [
+ {
+ type: 1,
+ 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: "Chopper Gunner",
+ value: "choppergunner",
+ },
+ {
+ name: "Stealth Chopper",
+ value: "stealthchopper",
+ },
+ {
+ name: "Swarm",
+ value: "swarm",
+ },
+ {
+ name: "Napalm",
+ value: "napalm",
+ },
+ {
+ name: "VTOL",
+ value: "vtol",
+ },
+ ],
+ },
+ ],
+ },
+ {
+ type: 1,
+ 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.name)
+ .setURL(d.preview_video)
+ .setDescription(
+ `<:nyx_description:897379659665264650> **Description** \`\`\`\n${d.description}\`\`\``
+ )
+ .addFields(
+ {
+ name: "Cost",
+ value: `${d.cost}`,
+ inline: true,
+ },
+ {
+ name: "AI-Assisted",
+ value: `
+ ${
+ d.manual
+ ? "<a:nyx_cross:897244999211696198> No"
+ : "<a:nyx_checkmark:897240322411724841> Yes"
+ }`,
+ inline: true,
+ }
+ )
+ .setThumbnail(d.preview)
+ .setFooter({
+ text: `Made by ${client.author}`,
+ iconURL: client.user.displayAvatarURL(),
+ })
+ .setColor(
+ d.type == "lethal"
+ ? "FF2222"
+ : d.type == "assist"
+ ? "22FF4A"
+ : client.color
+ )
+ .setTimestamp();
+ interaction.followUp({ embeds: [embed] });
+ },
+};
diff --git a/config.js b/config.js
@@ -7,7 +7,7 @@ module.exports = {
Welcome: "837913442228371456",
DMLog: "900549765534736394",
CMDLog: "848613827226239046",
- ErrorLog: "900509758786773022",
+ ErrorLog: "938538311537012796",
ServerLog: "848613714537873518",
Lavalink: {
Host: "lavalink-repl.thunderemperor.repl.co",
diff --git a/events/interactionCreate.js b/events/interactionCreate.js
@@ -115,68 +115,59 @@ client.on("interactionCreate", async interaction => {
}
}
const random = utils.rndint(3, 6);
- try {
- if (cmd.timeout) {
- const current_time = Date.now();
- const cooldown_amount = cmd.timeout;
- cooldown.findOne(
- { User: interaction.user.id, CMD: cmd.name },
- async (er, d) => {
- if (d) {
- const expiration_time = d.Time + cooldown_amount;
- if (current_time < expiration_time) {
- if (data.Guild.Tips) utils.tips(interaction, client);
- utils.cooldown(d.Time, cooldown_amount, interaction);
- } else {
- if (data.Guild.Tips) utils.tips(interaction, client);
- await cooldown.findOneAndUpdate(
- { User: interaction.user.id, CMD: cmd.name },
- { Time: current_time }
- );
- cmd.run(client, interaction, args, utils, data);
- client.addcmdsused(interaction.user.id);
- client.channels.cache.get(client.config.CMDLog).send({
- content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
- });
- // await client.addXP(interaction.user.id, random, interaction);
- }
+ if (cmd.timeout) {
+ const current_time = Date.now();
+ const cooldown_amount = cmd.timeout;
+ cooldown.findOne(
+ { User: interaction.user.id, CMD: cmd.name },
+ async (er, d) => {
+ if (d) {
+ const expiration_time = d.Time + cooldown_amount;
+ if (current_time < expiration_time) {
+ if (data.Guild.Tips) utils.tips(interaction, client);
+ utils.cooldown(d.Time, cooldown_amount, interaction);
} else {
if (data.Guild.Tips) utils.tips(interaction, client);
- cmd.run(client, interaction, args, utils, data);
+ await cooldown.findOneAndUpdate(
+ { User: interaction.user.id, CMD: cmd.name },
+ { Time: current_time }
+ );
+ cmd
+ .run(client, interaction, args, utils, data)
+ .catch(e => sendE(e));
+ client.addcmdsused(interaction.user.id);
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
- client.addcmdsused(interaction.user.id);
// await client.addXP(interaction.user.id, random, interaction);
- new cooldown({
- User: interaction.user.id,
- CMD: cmd.name,
- Time: current_time,
- Cooldown: cmd.timeout,
- }).save();
}
+ } else {
+ if (data.Guild.Tips) utils.tips(interaction, client);
+ cmd
+ .run(client, interaction, args, utils, data)
+ .catch(e => sendE(e));
+ client.channels.cache.get(client.config.CMDLog).send({
+ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
+ });
+ client.addcmdsused(interaction.user.id);
+ // await client.addXP(interaction.user.id, random, interaction);
+ new cooldown({
+ User: interaction.user.id,
+ CMD: cmd.name,
+ Time: current_time,
+ Cooldown: cmd.timeout,
+ }).save();
}
- );
- } else {
- if (data.Guild.Tips) utils.tips(interaction, client);
- cmd.run(client, interaction, args, utils, data);
- client.channels.cache.get(client.config.CMDLog).send({
- content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
- });
- client.addcmdsused(interaction.user.id);
- // await client.addXP(interaction.user.id, random, interaction);
- }
- } catch (e) {
- const embed = new MessageEmbed()
- .setTitle("Command Error")
- .setDescription(`\`\`\`ini\n${e.stack}\`\`\``)
- .setTimestamp()
- .setColor(client.color)
- .setFooter(client.user.username);
- client.channels.cache
- .get(client.config.ErrorLog)
- .send({ embeds: [embed] });
- console.error(e);
+ }
+ );
+ } else {
+ if (data.Guild.Tips) utils.tips(interaction, client);
+ cmd.run(client, interaction, args, utils, data).catch(e => sendE(e));
+ client.channels.cache.get(client.config.CMDLog).send({
+ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
+ });
+ client.addcmdsused(interaction.user.id);
+ // await client.addXP(interaction.user.id, random, interaction);
}
}
if (interaction.isContextMenu()) {
@@ -204,14 +195,19 @@ client.on("interactionCreate", async interaction => {
interaction.member = interaction.guild.members.cache.get(
interaction.user.id
);
- try {
- ownercmd.run(client, interaction, args, utils);
- client.channels.cache.get(client.config.CMDLog).send({
- content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${ownercmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
- });
- client.addcmdsused(interaction.user.id);
- } catch (e) {
- console.log(e);
- }
+ ownercmd.run(client, interaction, args, utils).catch(e => sendE(e));
+ client.channels.cache.get(client.config.CMDLog).send({
+ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${ownercmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
+ });
+ client.addcmdsused(interaction.user.id);
}
});
+function sendE(e) {
+ const embed = new MessageEmbed()
+ .setTitle("Command Error")
+ .setDescription(`\`\`\`yaml\n${e.stack}\`\`\``)
+ .setTimestamp()
+ .setColor(client.color)
+ .setFooter({ text: client.user.username });
+ client.channels.cache.get(client.config.ErrorLog).send({ embeds: [embed] });
+}
diff --git a/events/messageCreate.js b/events/messageCreate.js
@@ -85,6 +85,16 @@ client.on("messageCreate", async message => {
.replace(/(https|http):\/\/+/g, "")
.match(/\s*([^)]+?)\s*\/+/g, "")[0]
.slice(0, -1)
+ ) ||
+ domains.ngrok.includes(
+ message.content
+ .toLowerCase()
+ .match(
+ /(https|http):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+~-]*[\w.,@?^=%&:/~+~-])+/g
+ )?.[0]
+ .replace(/(https|http):\/\/+/g, "")
+ .match(/\s*([^)]+?)\s*\/+/g, "")[0]
+ .slice(0, -1)
)
) {
const _ = new MessageEmbed()
@@ -114,31 +124,26 @@ client.on("messageCreate", async message => {
text: `Tactical Protection by ${client.author}`,
icon_url: client.user.displayAvatarURL(),
});
-
- message
- .delete()
- .catch(() => {})
- .then(() => {
- message.channel.send({
- embeds: [_],
- });
- client.channels.cache.get("936986641585799178").send({
- embeds: [
- _.addFields(
- {
- name: "Message",
- value: message.content,
- inline: false,
- },
- {
- name: "Guild",
- value: message.guild ? message.guild.name : "None",
- inline: true,
- }
- ),
- ],
- });
- });
+ message.channel.send({
+ embeds: [_],
+ });
+ client.channels.cache.get("936986641585799178").send({
+ embeds: [
+ _.addFields(
+ {
+ name: "Message",
+ value: message.content,
+ inline: false,
+ },
+ {
+ name: "Guild",
+ value: message.guild ? message.guild.name : "None",
+ inline: true,
+ }
+ ),
+ ],
+ });
+ message.delete().catch(() => {});
}
if (
diff --git a/index.js b/index.js
@@ -1,8 +1,5 @@
-const { HTTPError, DiscordAPIError } = require("discord.js");
const NYX = require("./client/NYX");
const client = new NYX();
module.exports = client;
-process.on("unhandledRejection", err => {
- console.error(err);
-});
+process.on("unhandledRejection", () => {});
client.start();
diff --git a/package.json b/package.json
@@ -43,7 +43,7 @@
"axios": "^0.25.0",
"cath": "^1.4.7",
"discord.js": "^13.6.0",
- "dotenv": "^14.2.0",
+ "dotenv": "^15.0.0",
"erela.js": "^2.3.3",
"erela.js-spotify": "^1.2.0",
"goosecache": "^9.0.14",
diff --git a/util/Data/domains.json b/util/Data/domains.json
@@ -4104,7 +4104,24 @@
"staemporewed.xyz"
],
"iplogger": [
- "dlscord.org/nitro-gift",
+ "iplogger.org",
+ "2no.co",
+ "iplogger.com",
+ "iplogger.ru",
+ "yip.su",
+ "iplogger.co",
+ "iplogger.info",
+ "ipgrabber.ru",
+ "ipgraber.ru",
+ "iplis.ru",
+ "02ip.ru",
+ "ezstat.ru",
+ "ps3cfw.com",
+ "ythingy.com",
+ "blasze.tk",
+ "fuekos.com",
+ "myiptest.com",
+ "dlscord.org",
"lovebird.guru",
"trulove.guru",
"dateing.club",
@@ -4127,5 +4144,15 @@
"sportshub.bar",
"herald.sbs",
"locations.quest"
+ ],
+ "ngrok": [
+ "localhost:8888",
+ "localhost:8000",
+ "localhost:8080",
+ "localhost:3000",
+ "127.0.0.1:4040",
+ "127.0.0.1:8000",
+ "127.0.0.1:8080",
+ "ngrok.io"
]
}
diff --git a/util/functions/common.js b/util/functions/common.js
@@ -193,6 +193,7 @@ function attachmentsIdentifier(inpmsg, gun) {
outAttachments = [];
for (let i = 0; i < gun.aments.length; i++) {
+ // Eg: "Stippled Grip Tape" -> ["Stippled", "Grip", "Tape"]
splitAttachmentsDataName.push([
...new Set(
gun.aments[i].name
@@ -201,30 +202,35 @@ function attachmentsIdentifier(inpmsg, gun) {
.map(x => x.trim())
),
]);
- // if (Math.max(...splitAttachmentsDataName.map(x => x.length)) > 6) {
- // return "Cocaineeeeee";
- // } ??????????????????? Thats not gonna happen right?
+
+ // splitAttachmentsDataName[i] = ["Stippled", "Grip", "Tape"]
for (let j = 0; j < splitAttachmentsDataName[i].length; j++) {
+ // simplify the attachments name
+ // Eg: ["Stippled", "Grip", "Tape"] -> ["stippled", "grip", "tape"]
splitAttachmentsDataName[i][j] =
splitAttachmentsDataName[i][j].Simplify();
}
}
-
+ // after loop: ["stippled", "grip", "tape"]
for (let i = 0; i < inputAttachmentsNames.length; i++) {
- var probables = [];
+ const probables = [];
+ // loop through all the input attachments and split them into words
var splitInputAttachmentsName = inputAttachmentsNames[i]
.split(" ")
.filter(x => x);
function finder() {
+ //splitInputAttachmentsName = [["stippled", "grip", "tape"], ["545", "ammo"], ["owc","lazer", "tactical"]]
for (let j = 0; j < splitAttachmentsDataName.length; j++) {
for (let i2 = 0; i2 < splitAttachmentsDataName[j].length; i2++) {
for (let i3 = 0; i3 < splitInputAttachmentsName.length; i3++) {
+ // if simplified input attachment name is included in the real attachments name
if (
splitAttachmentsDataName[j][i2].includes(
splitInputAttachmentsName[i3].Simplify()
)
) {
+ // if probables list doesn't include the attachment, push
let probablePushed = false;
for (let i4 = 0; i4 < probables.length; i4++) {
if (!probables[i4].includes(j)) {
@@ -233,15 +239,15 @@ function attachmentsIdentifier(inpmsg, gun) {
break;
}
}
- if (!probablePushed) {
- probables.push([j]);
- }
+ // for the first loop as the probables array is emrpty
+ if (!probablePushed) probables.push([j]);
}
}
}
}
}
finder();
+ // finding magazines attachments
if (
(inputAttachmentsNames[i].includes(" rounds mag") ||
inputAttachmentsNames[i].includes(" round mag")) &&