Merge branch 'main' into dev

This commit is contained in:
Night Kaly 2022-02-01 14:02:58 +00:00 committed by GitHub
commit ca97d20eb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 6165 additions and 5558 deletions

78
CODM/loadout.js Normal file
View file

@ -0,0 +1,78 @@
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, \`\`\`\`/gun\`\`\`\` 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 perks
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)];
// }
},
};

774
CODM/new-stats.js Normal file
View file

@ -0,0 +1,774 @@
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",
// },
// };

View file

@ -97,11 +97,7 @@ function statsHandler(inpmsg) {
currStats = currGun.stats; currStats = currGun.stats;
currDRM = currGun.drm[0]; currDRM = currGun.drm[0];
currAttachments = []; currAttachments = [];
currAttachments = common.attachmentsIdentifier( currAttachments = common.attachmentsIdentifier(inpmsg, currGun);
inpmsg,
currGun.aments,
currStats
);
if (typeof currAttachments == "string") { if (typeof currAttachments == "string") {
hasError = true; hasError = true;
return currAttachments; return currAttachments;

View file

@ -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);

View file

@ -22,6 +22,7 @@ class NYX extends Client {
}, },
shard: "auto", shard: "auto",
restTimeOffset: 0, restTimeOffset: 0,
restRequestTimeout: 99999,
partials: ["MESSAGE", "CHANNEL", "REACTION", "GUILD_MEMBER"], partials: ["MESSAGE", "CHANNEL", "REACTION", "GUILD_MEMBER"],
intents: 24207, intents: 24207,
} }

View file

@ -4,6 +4,7 @@ const axios = require("axios");
module.exports = { module.exports = {
name: "build", name: "build",
description: "Get gunsmith builds", description: "Get gunsmith builds",
usage: "[Weapon Name] [Author] [Tag]",
type: "CHAT_INPUT", type: "CHAT_INPUT",
usage: "[Weapon Name] [Author] [Tag]", usage: "[Weapon Name] [Author] [Tag]",
category: "CODM", category: "CODM",
@ -112,8 +113,8 @@ module.exports = {
required: true, required: true,
choices: [ choices: [
{ {
name: "Path.exe", name: "path.exe",
value: "path", value: "path.exe",
}, },
{ {
name: "Jokesta", name: "Jokesta",
@ -239,8 +240,8 @@ module.exports = {
required: true, required: true,
choices: [ choices: [
{ {
name: "Path.exe", name: "path.exe",
value: "path", value: "path.exe",
}, },
{ {
name: "Jokesta", name: "Jokesta",
@ -330,8 +331,8 @@ module.exports = {
required: true, required: true,
choices: [ choices: [
{ {
name: "Path.exe", name: "path.exe",
value: "path", value: "path.exe",
}, },
], ],
}, },
@ -413,8 +414,8 @@ module.exports = {
required: true, required: true,
choices: [ choices: [
{ {
name: "Path.exe", name: "path.exe",
value: "path", value: "path.exe",
}, },
], ],
}, },
@ -492,8 +493,8 @@ module.exports = {
required: true, required: true,
choices: [ choices: [
{ {
name: "Path.exe", name: "path.exe",
value: "path", value: "path.exe",
}, },
{ {
name: "dHitman", name: "dHitman",
@ -555,8 +556,8 @@ module.exports = {
required: true, required: true,
choices: [ choices: [
{ {
name: "Path.exe", name: "path.exe",
value: "path", value: "path.exe",
}, },
// { // {
// name: "Stats On Duty", // name: "Stats On Duty",
@ -630,8 +631,8 @@ module.exports = {
required: true, required: true,
choices: [ choices: [
{ {
name: "Path.exe", name: "path.exe",
value: "path", value: "path.exe",
}, },
// { // {
// name: "Stats On Duty", // name: "Stats On Duty",
@ -660,7 +661,7 @@ module.exports = {
const tag = args[3]; const tag = args[3];
const data = await axios const data = await axios
.get( .get(
`${process.env.api}/api/v1/codm/builds?cwts=${cwts}&cc=${cc}&tag=${tag}`, `${process.env.api}/api/v1/codm/build?cwts=${cwts}&cc=${cc}&tag=${tag}`,
{ {
headers: { headers: {
Authorization: process.env.CODM_API_KEY, Authorization: process.env.CODM_API_KEY,
@ -669,11 +670,24 @@ module.exports = {
) )
.then(res => res.data) .then(res => res.data)
.catch(e => null); .catch(e => null);
var all = {
"path.exe": "path.exe",
dhitman: "dHitman",
jokesta: "Jokesta",
// littleb:"Little B",
if (!data?.ID) { aggressive: "Aggressive",
passive: "Passive",
snd: "Search And Destroy",
respawn: "Respawn",
ads: "ADS",
hipfire: "Hipfire",
};
if (!data?.cwts) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setDescription( .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` `<: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`
) )
.setColor(client.color); .setColor(client.color);
interaction.followUp({ embeds: [embed] }); interaction.followUp({ embeds: [embed] });
@ -691,10 +705,10 @@ module.exports = {
) )
.setColor(16580400) .setColor(16580400)
.setImage(data.imageUrl) .setImage(data.imageUrl)
.setFooter( .setFooter({
`Builds Aggregated by ${client.author}`, text: `Builds Aggregated by ${client.author}`,
client.user.displayAvatarURL() iconURL: client.user.displayAvatarURL(),
) })
.setTimestamp() .setTimestamp()
.addFields( .addFields(
{ {

View file

@ -39,11 +39,7 @@ function dmg(inpmsg) {
} }
currDRM = currGun.drm[0]; currDRM = currGun.drm[0];
currStats = currGun.stats; currStats = currGun.stats;
currAttachments = common.attachmentsIdentifier( currAttachments = common.attachmentsIdentifier(inpmsg, currGun);
inpmsg,
currGun.aments,
currStats
);
if (typeof currAttachments == "string") { if (typeof currAttachments == "string") {
hasError = true; hasError = true;
return currAttachments; return currAttachments;

View file

@ -114,11 +114,7 @@ function attachments(inpmsg) {
hasAttachments = common.hasAttachments(inpmsg); hasAttachments = common.hasAttachments(inpmsg);
currAttachments = []; currAttachments = [];
if (hasAttachments) { if (hasAttachments) {
currAttachments = common.attachmentsIdentifier( currAttachments = common.attachmentsIdentifier(inpmsg, currGun);
inpmsg,
currGun.aments,
currGun.stats
);
if (typeof currAttachments == "string") { if (typeof currAttachments == "string") {
hasError = true; hasError = true;
return currAttachments; return currAttachments;

View file

@ -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",

View file

@ -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(`<:nyx_description:897379659665264650> **Description** \`\`\`\n${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] });
},
};

View file

@ -1,6 +1,6 @@
const common = require("../../util/functions/common"); const common = require("../../util/functions/common");
const data = require("../../util/Data/data.json"); const data = require("../../util/Data/data.json");
const Discord = require("discord.js"); const { MessageEmbed } = require("discord.js");
let currGun, let currGun,
currStats, currStats,
@ -52,12 +52,15 @@ module.exports = {
}, },
], ],
run: async (client, interaction, args) => { run: async (client, interaction, args) => {
repEmb = null;
recoilAvailable = false; recoilAvailable = false;
hasError = false; hasError = false;
console.log(args); if (args.length == 1)
const repEmb = statsHandler(args.join(" ").replace("\n", " ")); repEmb = statsHandler(args.join(" ").replace("\n", " "));
else repEmb = statsHandler(args.join(" + ").replace("\n", " "));
if (hasError) { if (hasError) {
interaction.followUp({ embeds: [repEmb] }); interaction.followUp({ embeds: [new MessageEmbed(repEmb)] });
} }
if (recoilAvailable) { if (recoilAvailable) {
repEmb.fields.push({ repEmb.fields.push({
@ -68,7 +71,7 @@ module.exports = {
const recoilImageLink = await chart.getShortUrl(); const recoilImageLink = await chart.getShortUrl();
repEmb.image = { url: recoilImageLink }; repEmb.image = { url: recoilImageLink };
} }
interaction.followUp({ embeds: [repEmb] }); interaction.followUp({ embeds: [new MessageEmbed(repEmb)] });
}, },
}; };
@ -126,11 +129,7 @@ function statsHandler(inpmsg) {
currStats = currGun.stats; currStats = currGun.stats;
currDRM = currGun.drm[0]; currDRM = currGun.drm[0];
currAttachments = []; currAttachments = [];
currAttachments = common.attachmentsIdentifier( currAttachments = common.attachmentsIdentifier(inpmsg, currGun);
inpmsg,
currGun.aments,
currStats
);
if (typeof currAttachments == "string") { if (typeof currAttachments == "string") {
hasError = true; hasError = true;
return currAttachments; return currAttachments;

View file

@ -1,18 +1,20 @@
const { MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
const dares = require("../../util/Data/dares.json"); const tnd = require("../../util/Data/tnd.json");
module.exports = { module.exports = {
name: "dare", name: "dare",
description: "The maturity level of the topics the question can relate to", description: "The maturity level of the topics the question can relate to",
run: async (client, interaction) => { run: async (client, interaction) => {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setAuthor( .setAuthor({
interaction.user.tag, name: interaction.user.tag,
interaction.user.displayAvatarURL({ dyamic: true }) iconURL: interaction.user.displayAvatarURL({ dyamic: true }),
) })
.setTitle(dares[Math.round(Math.random() * (dares.length - 1))]) .setTitle(dares[Math.round(Math.random() * tnd.dare.length - 1)])
.setColor(client.color) .setColor(client.color)
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) .setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp(); .setTimestamp();
interaction.followUp({ embeds: [embed] }); interaction.followUp({ embeds: [embed] });
}, },

View file

@ -1,18 +1,20 @@
const { MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
const truth = require("../../util/Data/truth.json"); const tnd = require("../../util/Data/tnd.json");
module.exports = { module.exports = {
name: "truth", name: "truth",
description: "Gives a random question that has to be answered truthfully", description: "Gives a random question that has to be answered truthfully",
run: async (client, interaction, args) => { run: async (client, interaction, args) => {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setAuthor( .setAuthor({
interaction.user.tag, name: interaction.user.tag,
interaction.user.displayAvatarURL({ dyamic: true }) iconURL: interaction.user.displayAvatarURL({ dyamic: true }),
) })
.setTitle(truth[Math.round(Math.random() * truth.length)]) .setTitle(truth[Math.round(Math.random() * tnd.truth.length)])
.setColor(client.color) .setColor(client.color)
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) .setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp(); .setTimestamp();
interaction.followUp({ embeds: [embed] }); interaction.followUp({ embeds: [embed] });
}, },

View file

@ -1,148 +0,0 @@
const fetch = require('node-fetch')
const { MessageActionRow, MessageButton, MessageEmbed, CommandInteraction } = require('discord.js');
module.exports = {
name : 'nsfw',
description: "nsfw command",
/**
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run : async(client, interaction) => {
async function embed() {
if(!interaction.channel.nsfw){
const embed = new MessageEmbed()
.setTitle(`AYO Calm Yo Cheeks`)
.setDescription('This command only works in NSFW Channels!')
.setImage('https://media.discordapp.net/attachments/851761493815853060/893777701599584266/warning.gif')
.setColor("#02023a")
interaction.followUp({ embeds: [embed]})
return;
}
let subreddits = [
'GoneWild',
'WorkGoneWild',
'GoneWild30Plus',
'hentai',
'HentaiAnime',
'nekogirls',
'ass',
'BestBooties',
'BootyGIFs',
'booty_queens',
'BlowJob',
'blowjobs',
'blowjobgifs',
'OralSex',
'boobs',
'GrabHerTitties',
'titfuck',
'milf',
'OnlyHotMilfs',
'realmoms',
'thighs',
'PerfectThighs',
'thickthighs'
]
let reddit = subreddits[Math.round(Math.random() * (subreddits.length - 1))];
let embed1 = null
await fetch(`https://meme-api.herokuapp.com/gimme/${reddit}`).then(res => res.json().then(url => {
embed1 = new MessageEmbed()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setTitle(`${url.title}`)
.setImage(`${url.url}`)
.setTimestamp()
.setColor("RED")
.setFooter(`${url.ups} 👍`)
}))
return embed1
}
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('reload')
.setLabel('Reload')
.setStyle('SUCCESS'),
)
const disabled = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('reload')
.setLabel('Reload')
.setStyle('SECONDARY')
.setDisabled(true)
)
let m = await interaction.followUp({
embeds: [await embed()],
components: [row]
})
const collector = m.createMessageComponentCollector({
componentType: 'BUTTON',
time: 120000,
});
collector.on('collect', async i => {
if (i.user.id === interaction.user.id) {
i.deferUpdate()
await update(m)
collector.stop()
} else {
i.reply({
content: `These buttons aren't for you!`,
ephemeral: true
});
}
})
collector.on('end', (mes, r) => {
if (r == 'time') {
m.edit({
components: [disabled],
})
}
})
async function update(m) {
m.edit({
embeds: [await embed()]
}).catch(e => console.log(e.requestData.json.embeds))
const collector = m.createMessageComponentCollector({
componentType: 'BUTTON',
time: 120000,
});
collector.on('collect', async i => {
if (i.user.id === interaction.user.id) {
i.deferUpdate()
await update(m)
collector.stop()
} else {
i.reply({
content: `These buttons aren't for you!`,
ephemeral: true
});
}
})
collector.on('end', (mes, r) => {
if (r == 'time') {
m.edit({
components: [disabled],
})
}
})
}
}
}

View file

@ -1,9 +1,13 @@
module.exports = { module.exports = {
name: "add", name: "economy",
category: "Owner", category: "Owner",
usage: "(Number)", description: "Add/Remove coins from someone",
description: "Add coins from someone",
Owner: true, Owner: true,
options: [
{
type: 1,
name: "add",
description: "Remove coins from someone",
options: [ options: [
{ {
type: 6, type: 6,
@ -18,7 +22,29 @@ module.exports = {
required: true, required: true,
}, },
], ],
},
{
type: 1,
name: "rmv",
description: "Remove coins from someone",
options: [
{
type: 6,
name: "user",
description: "The user you want to remove",
required: true,
},
{
type: 4,
name: "cp",
description: "The amount of CP you want to remove",
required: true,
},
],
},
],
run: async (client, interaction, args) => { run: async (client, interaction, args) => {
if (args[0] === "add") {
await client.add(args[0], args[1], interaction); await client.add(args[0], args[1], interaction);
interaction.followUp({ interaction.followUp({
content: `<a:nyx_checkmark:897240322411724841> Successfully added **${interaction.options.getInteger( content: `<a:nyx_checkmark:897240322411724841> Successfully added **${interaction.options.getInteger(
@ -27,5 +53,16 @@ module.exports = {
interaction.options.getUser("user").username interaction.options.getUser("user").username
}**'s balance`, }**'s balance`,
}); });
}
if (args[0] === "rmv") {
await client.rmv(args[0], args[1]);
interaction.followUp({
content: `<a:nyx_checkmark:897240322411724841> Successfully removed **${interaction.options.getInteger(
"cp"
)}** ${client.currency} from **${
interaction.options.getUser("user").username
}**'s balance`,
});
}
}, },
}; };

View file

@ -47,19 +47,22 @@ module.exports = {
evaled = err; evaled = err;
} }
if (typeof evaled !== "string") evaled = require("util").inspect(evaled); if (typeof evaled !== "string") evaled = require("util").inspect(evaled);
evaled = utils.chunk(evaled, 750); console.log(evaled);
evaled = chunk([evaled], 750);
console.log(evaled);
let reactions = ["❌", "⏪", "◀️", "⏹️", "▶️", "⏩"], let reactions = ["❌", "⏪", "◀️", "⏹️", "▶️", "⏩"],
page = 0, page = 0,
evaledEmbed = new Discord.MessageEmbed() evaledEmbed = new Discord.MessageEmbed()
.setColor(client.color) .setColor(client.color)
.setDescription(`\`\`\`js\n${evaled[0]}\n\`\`\``) .setDescription(`\`\`\`js\n${evaled[0]}\n\`\`\``)
.setTimestamp() .setTimestamp()
.setAuthor( .setAuthor({
`Evaled by ${interaction.user.tag}`, name: `Evaled by ${interaction.user.tag}`,
interaction.user.displayAvatarURL({ dynamic: true }) iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
) });
.addField(`Type of`, `\`\`\`js\n${typeof evaled[0]}\n\`\`\``); const mainMessage = await interaction.channel.send({
const mainMessage = await interaction.channel.send({ embeds: [evaledEmbed] }); embeds: [evaledEmbed],
});
Discord.TextChannel.prototype.send = oldSend; Discord.TextChannel.prototype.send = oldSend;
await Promise.all( await Promise.all(
(evaled.length === 1 ? ["❌", "⏹️"] : reactions).map(r => (evaled.length === 1 ? ["❌", "⏹️"] : reactions).map(r =>
@ -112,12 +115,17 @@ module.exports = {
} }
evaledEmbed = new Discord.MessageEmbed() evaledEmbed = new Discord.MessageEmbed()
.setColor(interaction.guild.me.displayColor) .setColor(interaction.guild.me.displayColor)
.setDescription(`\`\`\`js\n${evaled[page]}\n\`\`\``) .setDescription(`\`\`\`js\n${evaled[page]}\n\`\`\``);
.addField(`Type of`, `\`\`\`js\n${typeof evaled[page]}\n\`\`\``);
await mainMessage.edit({ await mainMessage.edit({
embeds: [evaledEmbed], embeds: [evaledEmbed],
}); });
}); });
}, },
}; };
function chunk(arr, size) {
let c;
Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => {
c = arr.slice(i * size, i * size + size);
});
return c;
}

View file

@ -18,18 +18,6 @@ module.exports = {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle("Guilds") .setTitle("Guilds")
.setDescription(description) .setDescription(description)
.addFields(
{
name: `Total Guilds`,
value: client.guilds.cache.size,
inline: true
},
{
name: `Total Members`,
value: client.users.cache.size,
inline: true
}
)
.setColor(client.color) .setColor(client.color)
.addFields( .addFields(
{ {

137
command/Owner/nsfw.js Normal file
View file

@ -0,0 +1,137 @@
const { getreddit } = require("cath");
const { MessageActionRow, MessageButton, MessageEmbed } = require("discord.js");
module.exports = {
name: "nsfw",
description: "nsfw command",
run: async (client, interaction) => {
const msg = await interaction.channel.send({ content: "Getting images" });
async function embed() {
if (!interaction.channel.nsfw) {
const embed = new MessageEmbed()
.setTitle(`AYO Calm Yo Cheeks`)
.setDescription("This command only works in NSFW Channels!")
.setImage(
"https://media.discordapp.net/attachments/851761493815853060/893777701599584266/warning.gif"
)
.setColor(client.color)
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
.setTimestamp();
interaction.followUp({ embeds: [embed] });
}
let subreddits = [
"GoneWild",
"WorkGoneWild",
"GoneWild30Plus",
"hentai",
"HentaiAnime",
"nekogirls",
"ass",
"BestBooties",
"BootyGIFs",
"booty_queens",
"BlowJob",
"blowjobs",
"blowjobgifs",
"OralSex",
"boobs",
"GrabHerTitties",
"titfuck",
"milf",
"OnlyHotMilfs",
"realmoms",
"thighs",
"PerfectThighs",
"thickthighs",
];
const reddit = subreddits[Math.round(Math.random() * subreddits.length)];
const data = await getreddit(reddit);
let embed1 = null;
embed1 = new MessageEmbed({
title: data.title,
url: data.url,
image: { url: data.image },
timestamp: Date.now(),
footer: { text: data.footer },
color: client.color,
author: {
name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
},
});
return embed1;
}
const row = new MessageActionRow().addComponents(
new MessageButton()
.setCustomId("reload")
.setLabel("Reload")
.setStyle("SUCCESS")
);
const disabled = new MessageActionRow().addComponents(
new MessageButton()
.setCustomId("reload")
.setLabel("Reload")
.setStyle("SECONDARY")
.setDisabled(true)
);
await msg.delete();
let m = await interaction.followUp({
embeds: [await embed()],
components: [row],
});
const collector = m.createMessageComponentCollector({
componentType: "BUTTON",
time: 120000,
});
collector.on("collect", async i => {
if (i.user.id === interaction.user.id) {
i.deferUpdate();
await update(m);
collector.stop();
} else {
i.reply({
content: `These buttons aren't for you!`,
ephemeral: true,
});
}
});
collector.on("end", (mes, r) => {
if (r == "time") {
m.edit({
components: [disabled],
});
}
});
async function update(m) {
m.edit({
embeds: [await embed()],
}).catch(null);
const collector = m.createMessageComponentCollector({
componentType: "BUTTON",
time: 120000,
});
collector.on("collect", async i => {
if (i.user.id === interaction.user.id) {
i.deferUpdate();
await update(m);
collector.stop();
} else {
i.reply({
content: `These buttons aren't for you!`,
ephemeral: true,
});
}
});
collector.on("end", (mes, r) => {
if (r == "time") {
m.edit({
components: [disabled],
});
}
});
}
},
};

View file

@ -1,31 +0,0 @@
module.exports = {
name: "rmv",
category: "Owner",
usage: "(Number)",
description: "Remove coins from someone",
Owner: true,
options: [
{
type: 6,
name: "user",
description: "The user you want to remove",
required: true,
},
{
type: 4,
name: "cp",
description: "The amount of CP you want to remove",
required: true,
},
],
run: async (client, interaction, args) => {
await client.rmv(args[0], args[1]);
interaction.followUp({
content: `<a:nyx_checkmark:897240322411724841> Successfully removed **${interaction.options.getInteger(
"cp"
)}** ${client.currency} from **${
interaction.options.getUser("user").username
}**'s balance`,
});
},
};

View file

@ -10,9 +10,9 @@ client.on("messageCreate", async message => {
nothahaa.setNickname(`${message.author.username}`).catch(); nothahaa.setNickname(`${message.author.username}`).catch();
await client.data.DelAFK(message.author.id); await client.data.DelAFK(message.author.id);
} }
if (message.mentions.users.first()) { if (message.mentions.users.first()?.id) {
const data1 = await client.data.getUser( const data1 = await client.data.getUser(
message.mentions.members.first().id message.mentions.members.first()?.id
); );
if (data1?.AFK) { if (data1?.AFK) {
message.reply({ message.reply({

View file

@ -1,7 +1,7 @@
const client = require(".."); const client = require("..");
const { MessageEmbed } = require("discord.js"); const { MessageEmbed } = require("discord.js");
const utils = require("../util/functions/function"); const utils = require("../util/functions/function");
const scams = require("../util/Data/scam.json"); const domains = require("../util/Data/domains.json");
client.on("messageCreate", async message => { client.on("messageCreate", async message => {
if (message.author.bot || !message.guild) return; if (message.author.bot || !message.guild) return;
const data = {}; const data = {};
@ -66,7 +66,17 @@ client.on("messageCreate", async message => {
} }
if (data.User?.Blacklist) return; if (data.User?.Blacklist) return;
if ( if (
scams.includes( domains.iplogger.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)
) ||
domains.scam.includes(
message.content message.content
.toLowerCase() .toLowerCase()
.match( .match(
@ -77,14 +87,64 @@ client.on("messageCreate", async message => {
.slice(0, -1) .slice(0, -1)
) )
) { ) {
message.delete(); const _ = new MessageEmbed()
.setTitle(`Scam/IP Grabber detected`)
.setTimestamp()
.setColor(client.color)
.addFields(
{
name: "User",
value: `${message.author.tag} (${message.author.id})`,
inline: true,
},
{
name: "Scam/IP Logger URL",
value: `||https://${message.content
.toLowerCase()
.match(
/(https|http):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+~-]*[\w.,@?^=%&:/~+~-])+/g
)?.[0]
.replace(/(https|http):\/\/+/g, "")
.match(/\s*([^)]+?)\s*\/+/g, "")[0]
.slice(0, -1)}||`,
inline: true,
}
)
.setFooter({
text: `Tactical Protection by ${client.author}`,
icon_url: client.user.displayAvatarURL(),
});
message
.delete()
.catch(() => {})
.then(() => {
message.channel.send({ message.channel.send({
content: `**${message.author.tag}** has sent a scam link and I have deleted it to prevent spread`, 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,
}
),
],
});
}); });
} }
if ( if (
message?.content.startsWith(data.Guild.Prefix) || message?.content.startsWith(data.Guild.Prefix) ||
message?.content.startsWith("C.") message?.content.startsWith("C.") ||
message?.content.startsWith("c.")
) { ) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle(`Message commands are now disabled`) .setTitle(`Message commands are now disabled`)
@ -157,7 +217,15 @@ client.on("messageCreate", async message => {
} }
if (message.content) { if (message.content) {
client.channels.cache.get(client.config.DMLog).send({ client.channels.cache.get(client.config.DMLog).send({
content: `\`${message.author.tag}(${message.author.id})\`: ${message.content}`, embeds: [
new MessageEmbed()
.setDescription(message.content)
.setColor(client.color)
.setAuthor({
name: message.author.tag,
iconURL: message.author.displayAvatarURL({ dynamic: true }),
}),
],
}); });
} }
} }

View file

@ -1,7 +1,8 @@
const { HTTPError, DiscordAPIError } = require("discord.js");
const NYX = require("./client/NYX"); const NYX = require("./client/NYX");
const client = new NYX(); const client = new NYX();
module.exports = client; module.exports = client;
process.on("unhandledRejection", err => { process.on("unhandledRejection", err => {
console.log(err); console.error(err);
}); });
client.start(); client.start();

148
nsfw.js
View file

@ -1,148 +0,0 @@
const fetch = require('node-fetch')
const { MessageActionRow, MessageButton, MessageEmbed, CommandInteraction } = require('discord.js');
module.exports = {
name : 'nsfw',
description: "nsfw command",
/**
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/
run : async(client, interaction) => {
async function embed() {
if(!interaction.channel.nsfw){
const embed = new MessageEmbed()
.setTitle(`AYO Calm Yo Cheeks`)
.setDescription('This command only works in NSFW Channels!')
.setImage('https://media.discordapp.net/attachments/851761493815853060/893777701599584266/warning.gif')
.setColor("#02023a")
interaction.followUp({ embeds: [embed]})
return;
}
let subreddits = [
'GoneWild',
'WorkGoneWild',
'GoneWild30Plus',
'hentai',
'HentaiAnime',
'nekogirls',
'ass',
'BestBooties',
'BootyGIFs',
'booty_queens',
'BlowJob',
'blowjobs',
'blowjobgifs',
'OralSex',
'boobs',
'GrabHerTitties',
'titfuck',
'milf',
'OnlyHotMilfs',
'realmoms',
'thighs',
'PerfectThighs',
'thickthighs'
]
let reddit = subreddits[Math.round(Math.random() * (subreddits.length - 1))];
let embed1 = null
await fetch(`https://meme-api.herokuapp.com/gimme/${reddit}`).then(res => res.json().then(url => {
embed1 = new MessageEmbed()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setTitle(`${url.title}`)
.setImage(`${url.url}`)
.setTimestamp()
.setColor("RED")
.setFooter(`${url.ups} 👍`)
}))
return embed1
}
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('reload')
.setLabel('Reload')
.setStyle('SUCCESS'),
)
const disabled = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('reload')
.setLabel('Reload Meme')
.setStyle('SECONDARY')
.setDisabled(true)
)
let m = await interaction.followUp({
embeds: [await embed()],
components: [row]
})
const collector = m.createMessageComponentCollector({
componentType: 'BUTTON',
time: 120000,
});
collector.on('collect', async i => {
if (i.user.id === interaction.user.id) {
i.deferUpdate()
await update(m)
collector.stop()
} else {
i.reply({
content: `These buttons aren't for you!`,
ephemeral: true
});
}
})
collector.on('end', (mes, r) => {
if (r == 'time') {
m.edit({
components: [disabled],
})
}
})
async function update(m) {
m.edit({
embeds: [await embed()]
}).catch(e => console.log(e.requestData.json.embeds))
const collector = m.createMessageComponentCollector({
componentType: 'BUTTON',
time: 120000,
});
collector.on('collect', async i => {
if (i.user.id === interaction.user.id) {
i.deferUpdate()
await update(m)
collector.stop()
} else {
i.reply({
content: `These buttons aren't for you!`,
ephemeral: true
});
}
})
collector.on('end', (mes, r) => {
if (r == 'time') {
m.edit({
components: [disabled],
})
}
})
}
}
}

View file

@ -11,7 +11,7 @@
"dev": "nodemon .", "dev": "nodemon .",
"start": "node .", "start": "node .",
"lint": "eslint .", "lint": "eslint .",
"node-update": "npm i --save-dev node@16 && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH", "node-update": "npm i --save-dev node@17 && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH",
"node-clean": "rm -rf node_modules && rm package-lock.json && npm cache clear --force && npm cache clean --force && npm i", "node-clean": "rm -rf node_modules && rm package-lock.json && npm cache clear --force && npm cache clean --force && npm i",
"all": "npm run node-update && npm run node-clean" "all": "npm run node-update && npm run node-clean"
}, },
@ -40,10 +40,10 @@
"node": "^17.3.0" "node": "^17.3.0"
}, },
"dependencies": { "dependencies": {
"axios": "^0.24.0", "axios": "^0.25.0",
"cath": "^1.4.6", "cath": "^1.4.7",
"discord.js": "^13.5.1", "discord.js": "^13.6.0",
"dotenv": "^11.0.0", "dotenv": "^14.2.0",
"erela.js": "^2.3.3", "erela.js": "^2.3.3",
"erela.js-spotify": "^1.2.0", "erela.js-spotify": "^1.2.0",
"goosecache": "^9.0.14", "goosecache": "^9.0.14",

View file

@ -50,7 +50,7 @@ module.exports = {
NYX \`v${version}\` NYX \`v${version}\`
Discord.js \`v${djsversion}\` Discord.js \`v${djsversion}\`
Node.js \`${process.version}\``, Node.js \`${process.version}\``,
}, }
// Removed OS Info for troubleshooting. // Removed OS Info for troubleshooting.
// //
// { // {

View file

@ -1015,11 +1015,7 @@
"4x Tactical Scope", "4x Tactical Scope",
"4.4x Tactical Scope" "4.4x Tactical Scope"
], ],
"stock": [ "stock": ["YKM Light Stock", "OWC Skeleton Stock", "RTC Steady Stock"],
"YKM Light Stock",
"OWC Skeleton Stock",
"RTC Steady Stock"
],
"perk": [ "perk": [
"FMJ", "FMJ",
"Sleight of Hand", "Sleight of Hand",
@ -1039,11 +1035,7 @@
"Tactical Foregrip A", "Tactical Foregrip A",
"Bipod" "Bipod"
], ],
"ammo": [ "ammo": ["Extended Mag A", "Fast Reload", "Halberd Mag"],
"Extended Mag A",
"Fast Reload",
"Halberd Mag"
],
"rear_grip": [ "rear_grip": [
"Granulated Grip Tape", "Granulated Grip Tape",
"Ruberized Grip Tape", "Ruberized Grip Tape",
@ -2667,11 +2659,7 @@
"MIP Light FLash Guard", "MIP Light FLash Guard",
"RTC Light Muzzle Brake" "RTC Light Muzzle Brake"
], ],
"barrel": [ "barrel": ["Gurrilla Light Short", "Last Stand Light", "Banner Heavy"],
"Gurrilla Light Short",
"Last Stand Light",
"Banner Heavy"
],
"optic": [ "optic": [
"Red Dot Sight", "Red Dot Sight",
"Holographic Sight", "Holographic Sight",
@ -2697,10 +2685,7 @@
"Tactical Foregrip A", "Tactical Foregrip A",
"Operator Foregrip" "Operator Foregrip"
], ],
"ammo": [ "ammo": ["35 Round Fast Reload", "55 Round Light Reload"],
"35 Round Fast Reload",
"55 Round Light Reload"
],
"rear_grip": [ "rear_grip": [
"Sturdy Grip Tape", "Sturdy Grip Tape",
"Ruberized Grip Tape", "Ruberized Grip Tape",

View file

@ -1,26 +0,0 @@
[
"Shave your arms and send me a pic.",
"Record yourself singing a song and post it on YouTube.",
"Try to lick your own foot!",
"Message someone you havent talked to in at least 1 year on Facebook or Instagram and take a screenshot.",
"Text your crush and ask them out on a date.",
"Cut a piece of your hair.",
"List everyone as the emoji(s) you think best fits them.",
"Change your nickname/username to whatever the group wants.",
"Send me a screenshot of your messages with the last person besides me you texted.",
"Brush your teeth with peanut butter or another condiment and send me a pic.",
"Rate everyone here 1-10 in terms of personality.",
"Take a really unflattering picture and make it your profile picture for one full day.",
"Send me a screenshot of your selfies gallery.",
"Text a random number and write “I see dead people”.",
"Tell the group in detail about your first kiss.",
"Tell a joke until it makes everyone laugh.",
"Tell your girlfriend that your friends dont like her so you cant be with her anymore.",
"Brush your teeth with your best friends toothbrush.",
"Show everyone your unshaved legs.",
"Break a raw egg on your forehead.",
"Call 5 different people and talk to them in 5 different accents.",
"Set your crushs picture as your FB profile picture.",
"Show everyone your search history for the past week."
]

4131
util/Data/domains.json Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
{ {
"secondary": [ // No Weapons from pistol catagory "secondary": [
"Knife / Base Melee", "Knife / Base Melee",
"Axe", "Axe",
"Shovel", "Shovel",
@ -15,7 +15,7 @@
"D13 Sector", "D13 Sector",
"Thumper" "Thumper"
], ],
"perk_1": [ // Red Perks "perk_1": [
"Fast Recover", "Fast Recover",
"Persistence", "Persistence",
"Flak Jacket", "Flak Jacket",
@ -28,7 +28,7 @@
"Martyrdom", "Martyrdom",
"Iron Lungs" "Iron Lungs"
], ],
"perk_2": [ // Green Perks "perk_2": [
"Vulture", "Vulture",
"Toughness", "Toughness",
"Tracker", "Tracker",
@ -40,7 +40,7 @@
"Recon", "Recon",
"Gung-Ho" "Gung-Ho"
], ],
"perk_3": [ // Blue Perks "perk_3": [
"Hard Line", "Hard Line",
"Demo Expert", "Demo Expert",
"Tactical Mask", "Tactical Mask",

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,5 @@
[ {
"truth": [
"When was the last time you lied?", "When was the last time you lied?",
"When was the last time you cried?", "When was the last time you cried?",
"What's your biggest fear?", "What's your biggest fear?",
@ -60,4 +61,30 @@
"What's the silliest reason you've left a club early?", "What's the silliest reason you've left a club early?",
"What have you purchased that's been the biggest waste of money?", "What have you purchased that's been the biggest waste of money?",
"If you could swap lives with someone in this room, who would it be?" "If you could swap lives with someone in this room, who would it be?"
] ],
"dare": [
"Shave your arms and send me a pic.",
"Record yourself singing a song and post it on YouTube.",
"Try to lick your own foot!",
"Message someone you havent talked to in at least 1 year on Facebook or Instagram and take a screenshot.",
"Text your crush and ask them out on a date.",
"Cut a piece of your hair.",
"List everyone as the emoji(s) you think best fits them.",
"Change your nickname/username to whatever the group wants.",
"Send me a screenshot of your messages with the last person besides me you texted.",
"Brush your teeth with peanut butter or another condiment and send me a pic.",
"Rate everyone here 1-10 in terms of personality.",
"Take a really unflattering picture and make it your profile picture for one full day.",
"Send me a screenshot of your selfies gallery.",
"Text a random number and write “I see dead people”.",
"Tell the group in detail about your first kiss.",
"Tell a joke until it makes everyone laugh.",
"Tell your girlfriend that your friends dont like her so you cant be with her anymore.",
"Brush your teeth with your best friends toothbrush.",
"Show everyone your unshaved legs.",
"Break a raw egg on your forehead.",
"Call 5 different people and talk to them in 5 different accents.",
"Set your crushs picture as your FB profile picture.",
"Show everyone your search history for the past week."
]
}

10
util/dist/handler.js vendored
View file

@ -1,3 +1,4 @@
const { DiscordAPIError, HTTPError } = require("discord.js");
const fs = require("fs"); const fs = require("fs");
const cmds = []; const cmds = [];
const ownercmds = []; const ownercmds = [];
@ -30,7 +31,9 @@ module.exports = async client => {
client.on("ready", async () => { client.on("ready", async () => {
const gg = client.guilds.cache.get("840225563193114624"); const gg = client.guilds.cache.get("840225563193114624");
await gg.commands.set(ownercmds); await gg.commands.set(ownercmds);
await client.application.commands.set(cmds).then(async cmd => { await client.application.commands
.set(cmds)
.then(async cmd => {
client.guilds.cache.forEach(g => { client.guilds.cache.forEach(g => {
const getroles = name => { const getroles = name => {
const perms = cmds.find(n => n.name == name).UserPerms; const perms = cmds.find(n => n.name == name).UserPerms;
@ -47,8 +50,9 @@ module.exports = async client => {
}, []); }, []);
return [...accumulator, { id: v.id, permissions }]; return [...accumulator, { id: v.id, permissions }];
}, []); }, []);
g.commands.permissions.set({ fullPermissions }); g.commands.permissions.set({ fullPermissions }).catch(null);
});
}); });
})
.catch(null);
}); });
}; };

View file

@ -4,6 +4,8 @@ const nmDt = require("../Data/aliases.json");
const weaponActualName = nmDt.weaponActualName; 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
// 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, "");
}, },
@ -12,33 +14,30 @@ Object.defineProperty(String.prototype, "Simplify", {
}); });
Object.defineProperty(Number.prototype, "IsPositive", { Object.defineProperty(Number.prototype, "IsPositive", {
// Function to check the number is positive or not
value: function IsPositive() { value: function IsPositive() {
if (this > 0) { if (this > 0) return true;
return true; else return false;
}
return false;
}, },
writable: true, writable: true,
configurable: true, configurable: true,
}); });
Object.defineProperty(Number.prototype, "IsNegative", { Object.defineProperty(Number.prototype, "IsNegative", {
// Function to check the number is negative or not
value: function IsNegative() { value: function IsNegative() {
if (this < 0) { if (this < 0) return true;
return true; else return false;
}
return false;
}, },
writable: true, writable: true,
configurable: true, configurable: true,
}); });
Object.defineProperty(Number.prototype, "ToBool", { Object.defineProperty(Number.prototype, "ToBool", {
// Function to check the number is one or not
value: function ToBool() { value: function ToBool() {
if (this == 1) { if (this == 1) return true;
return true; else return false;
}
return false;
}, },
writable: true, writable: true,
configurable: true, configurable: true,
@ -49,15 +48,19 @@ Object.defineProperty(Number.prototype, "PlusHL", {
if (this.toString()[0] == "-") { if (this.toString()[0] == "-") {
return parseFloat(this.toFixed(2)).toString(); return parseFloat(this.toFixed(2)).toString();
} }
return "+" + parseFloat(this.toFixed(2)).toString(); return `+${parseFloat(this.toFixed(2)).toString()}`;
}, },
writable: true, writable: true,
configurable: true, configurable: true,
}); });
/* Function to fix the input statement */
function inpFixer(inpmsg) { function inpFixer(inpmsg) {
const parts = partExtracter(inpmsg); const parts = PartSpliter(inpmsg);
// parts will be an array
//eg: ["fennec", "akimbo, mono"]
nmDt.attachmentAlliasName[0].map((x, i) => nmDt.attachmentAlliasName[0].map((x, i) =>
// x is the content of each index, i is the number of each index
x.map(y => { x.map(y => {
if (parts[0].startsWith(y + " ") || parts[0].endsWith(" " + y)) { if (parts[0].startsWith(y + " ") || parts[0].endsWith(" " + y)) {
inpmsg = inpmsg =
@ -65,24 +68,30 @@ function inpFixer(inpmsg) {
(parts[1] ? ", " : " + ") + (parts[1] ? ", " : " + ") +
nmDt.attachmentActualName[0][i]; nmDt.attachmentActualName[0][i];
} }
}), })
); );
// so it fking only fix akimbo and stopping power wtf
return inpmsg; return inpmsg;
} }
// Function to split weapon name and the attachments from the input statement
function partExtracter(inpmsg) { function PartSpliter(inpmsg) {
if (inpmsg.includes(" + ")) { if (inpmsg.includes(" + ")) {
// If the input statement has multiple attachments joined by "+", split them and output them as an array of strings [0] is the weapon name, [1] is the attachments
// Eg: "M4A1 + Silencer + Flashlight" -> ["M4A1", "Silencer + Flashlight"]
const out = inpmsg const out = inpmsg
.split(" + ") .split(" + ")
.map(x => x.split("+")) .map(x => x.split("+"))
.flat(); .flat();
return [out.shift(), out.join(", ")]; return [out.shift(), out.join(", ")];
} }
// If there is only one attachment, output it as an array of strings [0] is the weapon name, [1] is the attachment
// Eg: "M4A1 with Flashlight" -> ["M4A1", "Flashlight"]
return inpmsg.split(" with "); return inpmsg.split(" with ");
} }
function hasAttachments(inpmsg) { function hasAttachments(inpmsg) {
inpmsg = inpFixer(inpmsg); inpmsg = inpFixer(inpmsg);
// If the input statement has multiple attachments joined by "+" or "with", split them and output them as an array of strings [0] is the weapon name, [1] is the attachments
if ( if (
inpmsg.split(" with ").filter(x => x.Simplify()).length > 1 || inpmsg.split(" with ").filter(x => x.Simplify()).length > 1 ||
inpmsg.split(" + ").filter(x => x.Simplify()).length > 1 inpmsg.split(" + ").filter(x => x.Simplify()).length > 1
@ -93,100 +102,108 @@ function hasAttachments(inpmsg) {
} }
function isolator(inpmsg) { function isolator(inpmsg) {
return partExtracter(inpFixer(inpmsg)); return PartSpliter(inpFixer(inpmsg));
} }
// identifying the weapon
function weaponIdentifier(inpmsg) { function weaponIdentifier(inpmsg) {
const inpWeaponName = isolator(inpmsg)[0]; const inpWeaponName = isolator(inpmsg)[0];
// ["ak", "mono"] -> inpWeaponName: "ak"
// if weapon name is too short, return the error
if (inpWeaponName.length < 2) { if (inpWeaponName.length < 2) {
return inpmsg.trim().length return inpmsg.trim().length
? "The name `" + inpmsg.trim() + "` is too short." ? `The name ${inpmsg.trim()} is too short.`
: "Empty 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()) {
// if the simplified name of the weapon is the same as the weapon name in the database, return the only one stats object
return JSON.parse(JSON.stringify(data.cguns[i])); return JSON.parse(JSON.stringify(data.cguns[i]));
} } else if (
else if (
data.cguns[i].gunname.Simplify().includes(inpWeaponName.Simplify()) data.cguns[i].gunname.Simplify().includes(inpWeaponName.Simplify())
) { ) {
// If the weapon name is included in the actual name of the weapon
// push the weapon to the probableWeapons array
probableWeapons.push(i); probableWeapons.push(i);
} }
} }
// if there is only one probable weapon, mean the gun has already been identified
if (probableWeapons.length == 1) { if (probableWeapons.length == 1) {
// if there is only one probable weapon, return the only one stats object
return JSON.parse(JSON.stringify(data.cguns[probableWeapons[0]])); return JSON.parse(JSON.stringify(data.cguns[probableWeapons[0]]));
} }
// continue loop when there is no identified weapons or there are more than one identfied weaponds
// detecting aliases
// getting total number of weapons that had added aliases
for (let i = 0; i < weaponAlliasName.length; i++) { for (let i = 0; i < weaponAlliasName.length; i++) {
// getting the number of aliases of each weapon
for (let j = 0; j < weaponAlliasName[i].length; j++) { for (let j = 0; j < weaponAlliasName[i].length; j++) {
// weaponAliases[i][j] is the each alias of each weapon
// finding if simplified alias is same as input weapon name
if (weaponAlliasName[i][j].Simplify() == inpWeaponName.Simplify()) { if (weaponAlliasName[i][j].Simplify() == inpWeaponName.Simplify()) {
// if simplified alias is same as input weapon name
// eg "mow" == "mow", run the loop
for (let i2 = 0; i2 < data.cguns.length; i2++) { for (let i2 = 0; i2 < data.cguns.length; i2++) {
if ( if (weaponActualName[i] == data.cguns[i2].gunname) {
weaponActualName[i].Simplify() == data.cguns[i2].gunname.Simplify() // use the actual name of the weapon to find the weapon
) {
return JSON.parse(JSON.stringify(data.cguns[i2])); return JSON.parse(JSON.stringify(data.cguns[i2]));
} }
} }
} }
} }
} }
// removing duplicates in the array
probableWeapons = [...new Set(probableWeapons)]; probableWeapons = [...new Set(probableWeapons)];
if (probableWeapons.length == 1) { // if there is only one probable weapon, return the only one stats object
if (probableWeapons.length == 1)
return JSON.parse(JSON.stringify(data.cguns[probableWeapons[0]])); return JSON.parse(JSON.stringify(data.cguns[probableWeapons[0]]));
} else if (probableWeapons.length > 1) {
if (probableWeapons.length > 1) { // reply with the question of probable weapons
return ( return `Did you mean ${probableWeapons
"Did you mean `" +
probableWeapons
.map(x => data.cguns[x].gunname) .map(x => data.cguns[x].gunname)
.reduce((out, x, i) => .reduce((out, x, i) =>
[out, x].join(i === probableWeapons.length - 1 ? "` or `" : "`, `"), [out, x].join(i === probableWeapons.length - 1 ? "` or `" : "`, `")
) + )}
"`?" ?`;
); } else return `Couldn't identify the weapon: "${inpWeaponName}"`;
}
return "Couldn't identify the weapon: `" + '"' + inpWeaponName + '"`';
} }
// identifying attachments and return array or error
function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) { function attachmentsIdentifier(inpmsg, gun) {
if (!hasAttachments(inpmsg)) { if (!hasAttachments(inpmsg)) return [];
return [];
}
// no need for isolator because using slash commands, we get individual attachment // no need for isolator because using slash commands, we get individual attachment
let inputAttachmentsNames = isolator(inpmsg)[1] let inputAttachmentsNames = isolator(inpmsg)[1]
.split(/ & |, |,| and /) .split(/ & |, |,| and /)
.filter(x => x); .filter(x => x);
const tooSmall = inputAttachmentsNames.filter(x => x.length < 3); const tooSmall = inputAttachmentsNames.filter(x => x.length < 3);
// filter all elements thats shorter than 2 characters
inputAttachmentsNames = inputAttachmentsNames.filter(x => !(x.length < 3)); inputAttachmentsNames = inputAttachmentsNames.filter(x => !(x.length < 3));
let errorMsgs = "", let errorMsgs = "",
errors = [], errors = [],
unidentifined = []; unidentifined = [];
if (inputAttachmentsNames.length == 00) { if (inputAttachmentsNames.length == 0)
errorMsgs += "\nAttachments are missing!\n"; errorMsgs += "\nAttachments are missing!\n";
} // if (inputAttachmentsNames.length >= 10) return "Cocaineeeeee"; ?????????
if (inputAttachmentsNames.length >= 10) {
return "Cocaineeeeee";
}
// Can directly use args[] to return, no need for isolator, partExtractor, inpFixer // Can directly use args[] to return, no need for isolator, partExtractor, inpFixer
const splitAttachmentsDataName = [], const splitAttachmentsDataName = [],
outAttachments = []; outAttachments = [];
for (let i = 0; i < attachmentsData.length; i++) { for (let i = 0; i < gun.aments.length; i++) {
splitAttachmentsDataName.push([ splitAttachmentsDataName.push([
...new Set( ...new Set(
attachmentsData[i].name gun.aments[i].name
.split(" ") .split(" ")
.filter(x => x) .filter(x => x)
.map(x => x.trim()) .map(x => x.trim())
), ),
]); ]);
if (Math.max(...splitAttachmentsDataName.map(x => x.length)) > 6) { // if (Math.max(...splitAttachmentsDataName.map(x => x.length)) > 6) {
return "Cocaineeeeee"; // return "Cocaineeeeee";
} // } ??????????????????? Thats not gonna happen right?
for (let j = 0; j < splitAttachmentsDataName[i].length; j++) { for (let j = 0; j < splitAttachmentsDataName[i].length; j++) {
splitAttachmentsDataName[i][j] = splitAttachmentsDataName[i][j] =
splitAttachmentsDataName[i][j].Simplify(); splitAttachmentsDataName[i][j].Simplify();
@ -205,7 +222,7 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
for (let i3 = 0; i3 < splitInputAttachmentsName.length; i3++) { for (let i3 = 0; i3 < splitInputAttachmentsName.length; i3++) {
if ( if (
splitAttachmentsDataName[j][i2].includes( splitAttachmentsDataName[j][i2].includes(
splitInputAttachmentsName[i3].Simplify(), splitInputAttachmentsName[i3].Simplify()
) )
) { ) {
let probablePushed = false; let probablePushed = false;
@ -229,13 +246,13 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
(inputAttachmentsNames[i].includes(" rounds mag") || (inputAttachmentsNames[i].includes(" rounds mag") ||
inputAttachmentsNames[i].includes(" round mag")) && inputAttachmentsNames[i].includes(" round mag")) &&
inputAttachmentsNames[i].startsWith( inputAttachmentsNames[i].startsWith(
inputAttachmentsNames[i].replace(/\D/g, ""), inputAttachmentsNames[i].replace(/\D/g, "")
) )
) { ) {
var tmp1 = parseInt(inputAttachmentsNames[i]); var tmp1 = parseInt(inputAttachmentsNames[i]);
const tmp2 = attachmentsData.filter( const tmp2 = gun.aments.filter(
x => x =>
x.type === 8 && x.effects[27] + x.effects[28] + inpStats[17] === tmp1, x.type === 8 && x.effects[27] + x.effects[28] + gun.stats[17] === tmp1
); );
if (tmp2.length === 1) { if (tmp2.length === 1) {
outAttachments.push(tmp2[0]); outAttachments.push(tmp2[0]);
@ -254,8 +271,8 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
if (x.Simplify() === z.Simplify()) { if (x.Simplify() === z.Simplify()) {
splitInputAttachmentsName[i5] = nmDt.attachmentActualName[1][i6]; splitInputAttachmentsName[i5] = nmDt.attachmentActualName[1][i6];
} }
}), })
), )
); );
splitInputAttachmentsName = splitInputAttachmentsName splitInputAttachmentsName = splitInputAttachmentsName
.join(" ") .join(" ")
@ -282,21 +299,17 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
var curr = probables[probables.length - 1]; var curr = probables[probables.length - 1];
const temp1 = probables[probables.length - 1].filter( const temp1 = probables[probables.length - 1].filter(
x => x => gun.aments[x].name.Simplify() == inputAttachmentsNames[i].Simplify()
attachmentsData[x].name.Simplify() ==
inputAttachmentsNames[i].Simplify(),
); );
const temp2 = probables[probables.length - 1].filter( const temp2 = probables[probables.length - 1].filter(
x => x =>
splitAttachmentsDataName[x].length == splitInputAttachmentsName.length, splitAttachmentsDataName[x].length == splitInputAttachmentsName.length
); );
/**/ if (temp1.length === 1 && temp2.length !== 1) { /**/ if (temp1.length === 1 && temp2.length !== 1) {
probables.push([temp1]); probables.push([temp1]);
} } else if (temp1.length !== 1 && temp2.length === 1) {
else if (temp1.length !== 1 && temp2.length === 1) {
probables.push([temp2]); probables.push([temp2]);
} } else if (
else if (
temp1.length === 1 && temp1.length === 1 &&
temp2.length === 1 && temp2.length === 1 &&
temp1[0] == temp2[0] temp1[0] == temp2[0]
@ -310,16 +323,16 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
errors.push( errors.push(
"`" + "`" +
curr curr
.map(x => attachmentsData[x].name) .map(x => gun.aments[x].name)
.reduce((out, x, i) => .reduce((out, x, i) =>
[out, x].join(i === curr.length - 1 ? "` or `" : "`, `"), [out, x].join(i === curr.length - 1 ? "` or `" : "`, `")
) + ) +
'` by `"' + '` by `"' +
inputAttachmentsNames[i] + inputAttachmentsNames[i] +
'"`', '"`'
); );
} }
outAttachments.push(attachmentsData[probables[probables.length - 1][0]]); outAttachments.push(gun.aments[probables[probables.length - 1][0]]);
} }
const outAttachmentsTypes = outAttachments.map(x => x.type - 1), const outAttachmentsTypes = outAttachments.map(x => x.type - 1),
t1 = outAttachments t1 = outAttachments
@ -330,7 +343,7 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
.toString() .toString()
.split("") .split("")
.map((x, i) => .map((x, i) =>
parseInt(x) !== 0 && outAttachmentsTypes.includes(i) ? parseInt(i) : -1, parseInt(x) !== 0 && outAttachmentsTypes.includes(i) ? parseInt(i) : -1
) )
.filter(x => x !== -1); .filter(x => x !== -1);
@ -339,25 +352,21 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
t1 t1
.map(x => data.attachmentTypes[x]) .map(x => data.attachmentTypes[x])
.reduce((out, x, i, a) => .reduce((out, x, i, a) =>
[out, x].join(i === a.length - 1 ? "` or `" : "`, `"), [out, x].join(i === a.length - 1 ? "` or `" : "`, `")
) + ) +
"` with " + "` with " +
outAttachments outAttachments
.filter(x => x.effects[35]) .filter(x => x.effects[35])
.map(x => x.name) .map(x => x.name)
.reduce((out, x, i, a) => .reduce((out, x, i, a) =>
[out, x].join(i === a.length - 1 ? " and " : ", "), [out, x].join(i === a.length - 1 ? " and " : ", ")
) )
: ""; : "";
errorMsgs += errors.length errorMsgs += errors.length ? `\nDid you mean ${errors.join(";\n")}?\n` : "";
? "\nDid you mean " + errors.join(";\n") + "?\n"
: "";
errorMsgs += unidentifined.length errorMsgs += unidentifined.length
? "\nCouldn't identify the attachment" + ? `\nCouldn't identify the attachment(${
(unidentifined.length === 1 ? "" : "s") + unidentifined.length === 1 ? "" : "s"
': `"' + }): \`"${unidentifined.join('"`, `"')}"\`\n`
unidentifined.join('"`, `"') +
'"`\n'
: ""; : "";
errorMsgs += errorMsgs +=
outAttachments.length > 5 ? "\nCan't equip more than 5 attachments!\n" : ""; outAttachments.length > 5 ? "\nCan't equip more than 5 attachments!\n" : "";
@ -374,7 +383,7 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
(tooSmall.length === 1 ? "" : "s") + (tooSmall.length === 1 ? "" : "s") +
': `"' + ': `"' +
tooSmall.reduce((out, x, i) => tooSmall.reduce((out, x, i) =>
[out, x].join(i === curr.length - 1 ? '"` and `"' : '"`, `"'), [out, x].join(i === curr.length - 1 ? '"` and `"' : '"`, `"')
) + ) +
'"` ' + '"` ' +
(tooSmall.length === 1 ? "is" : "are") + (tooSmall.length === 1 ? "is" : "are") +
@ -383,7 +392,7 @@ function attachmentsIdentifier(inpmsg, attachmentsData, inpStats) {
return errorMsgs ? errorMsgs.trim() : outAttachments; return errorMsgs ? errorMsgs.trim() : outAttachments;
} }
// console.log(attachmentsIdentifier("chopper with heavy handle, red sight, granulated", data.cguns[38].aments)); makeError(); // console.log(attachmentsIdentifier("chopper with heavy handle, red sight, granulated", data.cguns[38].aments)); makeError();
// console.log(attachmentsIdentifier("ak + 5mw lazer", data.cguns[0].aments)); //makeError(); // console.log(attachmentsIdentifier("ak + 5mw lazer", data.cguns[0].aments)); makeError();
// console.log(attachmentsIdentifier("117 + 40 round mag", data.cguns[0].aments, data.cguns[0].stats)); makeError(); // console.log(attachmentsIdentifier("117 + 40 round mag", data.cguns[0].aments, data.cguns[0].stats)); makeError();
// console.log(attachmentsIdentifier("117 + rtc muzzle brake, rubberized griptape, tac lazer sight, 40 round mag, no stock", data.cguns[1].aments)); makeError(); // console.log(attachmentsIdentifier("117 + rtc muzzle brake, rubberized griptape, tac lazer sight, 40 round mag, no stock", data.cguns[1].aments)); makeError();
@ -395,7 +404,7 @@ function damageHandler(
tbs, tbs,
tbb, tbb,
bib, bib,
pellets, pellets
) { ) {
currDmgs = [...currDmgs]; currDmgs = [...currDmgs];
currRngs = [...currRngs]; currRngs = [...currRngs];
@ -422,8 +431,7 @@ function damageHandler(
let out; let out;
if (!pellets) { if (!pellets) {
out = Math.ceil(hp / dmg); out = Math.ceil(hp / dmg);
} } else {
else {
out = Math.ceil(hp / (dmg * pellets)); out = Math.ceil(hp / (dmg * pellets));
} }
out = out == Infinity ? "∞" : out; out = out == Infinity ? "∞" : out;
@ -444,8 +452,7 @@ function damageHandler(
out += tbs * (bib - 1) + tbb; out += tbs * (bib - 1) + tbb;
} }
out = out + tbs * (bib - 1); out = out + tbs * (bib - 1);
} } else if (stkVal % bib != 0) {
else if (stkVal % bib != 0) {
for (var i = 0; i <= Math.floor(stkVal / bib) - 1; i++) { for (var i = 0; i <= Math.floor(stkVal / bib) - 1; i++) {
out += tbs * (bib - 1) + tbb; out += tbs * (bib - 1) + tbb;
} }
@ -457,8 +464,7 @@ function damageHandler(
if (out == Infinity) { if (out == Infinity) {
return "∞"; return "∞";
} }
} } else {
else {
out = "No"; out = "No";
} }
return out; return out;
@ -489,7 +495,7 @@ function recoilHandler(
yRecoil, yRecoil,
xMultiplier, xMultiplier,
yMultiplier, yMultiplier,
bulletCount, bulletCount
) { ) {
if (xRecoil.length != yRecoil.length) { if (xRecoil.length != yRecoil.length) {
return "err"; return "err";
@ -515,8 +521,7 @@ function recoilHandler(
x: xRecoil[i] * (1 + xMultiplier / 100), x: xRecoil[i] * (1 + xMultiplier / 100),
y: yRecoil[i] * (1 + yMultiplier / 100), y: yRecoil[i] * (1 + yMultiplier / 100),
}; };
} } else {
else {
recoilObj = { recoilObj = {
x: x:
(recoilPattern[recoilPattern.length - 1].x + xContinuationVal) * (recoilPattern[recoilPattern.length - 1].x + xContinuationVal) *
@ -627,15 +632,14 @@ function attachmentHandler(currEffects, currStats) {
currEffects[0] + currEffects[0] +
"% zoom (+" + "% zoom (+" +
(currEffects[0] - currStats[16]) + (currEffects[0] - currStats[16]) +
"% zoom)", "% zoom)"
); );
} } else if (currEffects[0] != 0 && currEffects[0] != currStats[16]) {
else if (currEffects[0] != 0 && currEffects[0] != currStats[16]) {
neg.push( neg.push(
currEffects[0] + currEffects[0] +
"% zoom (-" + "% zoom (-" +
(currStats[16] - currEffects[0]) + (currStats[16] - currEffects[0]) +
"% zoom)", "% zoom)"
); );
} }
if (currEffects[0] != 0 && currStats[16] <= 110) { if (currEffects[0] != 0 && currStats[16] <= 110) {
@ -662,12 +666,11 @@ function attachmentHandler(currEffects, currStats) {
negGood1(19, "Idle Sway"); negGood1(19, "Idle Sway");
if (currEffects[20] > currStats[3]) { if (currEffects[20] > currStats[3]) {
pos.push( pos.push(
currEffects[20].ToString().Replace(".", " ~ ") + " Explosion Damage", currEffects[20].ToString().Replace(".", " ~ ") + " Explosion Damage"
); );
} } else if (currEffects[20] != 0 && currEffects[20] != currStats[3]) {
else if (currEffects[20] != 0 && currEffects[20] != currStats[3]) {
neg.push( neg.push(
currEffects[20].ToString().Replace(".", " ~ ") + " Explosion Damage", currEffects[20].ToString().Replace(".", " ~ ") + " Explosion Damage"
); );
} }
atrPush3(21, "Visible Laser when not ADS-ed"); atrPush3(21, "Visible Laser when not ADS-ed");
@ -690,7 +693,7 @@ function attachmentHandler(currEffects, currStats) {
.toString() .toString()
.split("") .split("")
.map((x, i) => (parseInt(x) !== 0 ? data.attachmentTypes[i] : 0)) .map((x, i) => (parseInt(x) !== 0 ? data.attachmentTypes[i] : 0))
.filter(x => x), .filter(x => x)
); );
} }
atrPush3(36, "Can't ADS"); atrPush3(36, "Can't ADS");
@ -699,8 +702,7 @@ function attachmentHandler(currEffects, currStats) {
} }
if (currEffects[38] != 0 && currEffects[38] < currStats[4]) { if (currEffects[38] != 0 && currEffects[38] < currStats[4]) {
pos.push("Turns to " + data.firingModes[currEffects[38] - 1]); pos.push("Turns to " + data.firingModes[currEffects[38] - 1]);
} } else if (currEffects[38] != 0 && currEffects[38] != currStats[4]) {
else if (currEffects[38] != 0 && currEffects[38] != currStats[4]) {
neg.push("Turns to " + data.firingModes[currEffects[38] - 1]); neg.push("Turns to " + data.firingModes[currEffects[38] - 1]);
} }
posGood2(39, "Tick Damage"); posGood2(39, "Tick Damage");
@ -710,17 +712,15 @@ function attachmentHandler(currEffects, currStats) {
posGood1(43, "Bullet Speed"); posGood1(43, "Bullet Speed");
if (currEffects[44] == 1) { if (currEffects[44] == 1) {
atr.push("Higher Penetraion Damage"); atr.push("Higher Penetraion Damage");
} } else if (currEffects[44] == -1) {
else if (currEffects[44] == -1) {
atr.push("Lower Penetraion Damage"); atr.push("Lower Penetraion Damage");
} }
posGood2(45, "Round" + (currEffects[45] - 1 ? "s" : "") + " in Reserve"); posGood2(45, `Round ${currEffects[45] - 1 ? "s" : ""} in Reserve`);
function posGood1(i, ext) { function posGood1(i, ext) {
if (currEffects[i].IsPositive()) { if (currEffects[i].IsPositive()) {
pos.push(currEffects[i].PlusHL() + "% " + ext); pos.push(currEffects[i].PlusHL() + "% " + ext);
} } else if (currEffects[i].IsNegative()) {
else if (currEffects[i].IsNegative()) {
neg.push(currEffects[i].PlusHL() + "% " + ext); neg.push(currEffects[i].PlusHL() + "% " + ext);
} }
} }
@ -728,8 +728,7 @@ function attachmentHandler(currEffects, currStats) {
function negGood1(i, ext) { function negGood1(i, ext) {
if (currEffects[i].IsNegative()) { if (currEffects[i].IsNegative()) {
pos.push(currEffects[i].PlusHL() + "% " + ext); pos.push(currEffects[i].PlusHL() + "% " + ext);
} } else if (currEffects[i].IsPositive()) {
else if (currEffects[i].IsPositive()) {
neg.push(currEffects[i].PlusHL() + "% " + ext); neg.push(currEffects[i].PlusHL() + "% " + ext);
} }
} }
@ -737,8 +736,7 @@ function attachmentHandler(currEffects, currStats) {
function posGood2(i, ext) { function posGood2(i, ext) {
if (currEffects[i].IsPositive()) { if (currEffects[i].IsPositive()) {
pos.push(currEffects[i].PlusHL() + " " + ext); pos.push(currEffects[i].PlusHL() + " " + ext);
} } else if (currEffects[i].IsNegative()) {
else if (currEffects[i].IsNegative()) {
neg.push(currEffects[i].PlusHL() + " " + ext); neg.push(currEffects[i].PlusHL() + " " + ext);
} }
} }
@ -746,8 +744,7 @@ function attachmentHandler(currEffects, currStats) {
function negGood2(i, ext) { function negGood2(i, ext) {
if (currEffects[i].IsNegative()) { if (currEffects[i].IsNegative()) {
pos.push(currEffects[i].PlusHL() + " " + ext); pos.push(currEffects[i].PlusHL() + " " + ext);
} } else if (currEffects[i].IsPositive()) {
else if (currEffects[i].IsPositive()) {
neg.push(currEffects[i].PlusHL() + " " + ext); neg.push(currEffects[i].PlusHL() + " " + ext);
} }
} }
@ -757,26 +754,26 @@ function attachmentHandler(currEffects, currStats) {
atr.push(ext); atr.push(ext);
} }
} }
// Return the attributes when there is and use algorithms to join them
return [ return [
pos.length pos.length
? { ? {
name: "**Positives:**", name: "**Positives:**",
value: "```ini\n[" + pos.join("]\n[") + "]\n```", value: `\`\`\`ini\n[${pos.join("]\n[")}]\n\`\`\``,
inline: true, inline: true,
} }
: 0, : 0,
neg.length neg.length
? { ? {
name: "**Negatives:**", name: "**Negatives:**",
value: "```css\n[" + neg.join("]\n[") + "]\n```", value: `\`\`\`css\n[${neg.join("]\n[")}]\n\`\`\``,
inline: true, inline: true,
} }
: 0, : 0,
atr.length atr.length
? { ? {
name: "**Attributes:**", name: "**Attributes:**",
value: "```fix\n[" + atr.join("]\n[") + "]\n```", value: `\`\`\`fix\n[${atr.join("]\n[")}]\n\`\`\``,
} }
: 0, : 0,
].filter(x => x); ].filter(x => x);
@ -799,8 +796,7 @@ function totaler(inpAttachments) {
} }
function makeError() { function makeError() {
let m; undefined.split("L");
m.split("L");
} }
module.exports = { module.exports = {

View file

@ -503,6 +503,7 @@ const leven = (te, t) => {
function chunk(arr, size) { function chunk(arr, size) {
Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => { Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => {
arr.slice(i * size, i * size + size); arr.slice(i * size, i * size + size);
return arr;
}); });
} }
function progressBar(value, maxValue, size) { function progressBar(value, maxValue, size) {