Version v3.5.0

This commit is contained in:
night0721 2022-01-08 08:07:13 +08:00
parent 8bbc22c06c
commit ef437fa4ba
21 changed files with 8 additions and 577 deletions

View file

@ -1,55 +0,0 @@
const { MessageEmbed } = require("discord.js");
const model = require("../../models/weapons");
const Attachments = require("../../util/Data/attachments.json");
module.exports = {
name: "class",
description: "Generate random class in CODM",
category: "CODM",
run: async (client, message, args) => {
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)
.setTitle(`🎲Random Class of ${primary_weapon}🎲`)
.setDescription(
`**Attachments**\n**${getAttachment(
primary,
slot_1,
)}**\n**${getAttachment(primary, slot_2)}**\n**${getAttachment(
primary,
slot_3,
)}**\n**${getAttachment(primary, slot_4)}**\n**${getAttachment(
primary,
slot_5,
)}**`,
)
.setURL(client.web)
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
.setTimestamp();
message.reply({ 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)];
}
},
};

View file

@ -1,118 +0,0 @@
const common = require("../../util/functions/common");
let currGun = {},
currStats = [],
currAttachments = {},
currDRM = {},
totalEffects = [],
interpretion = "",
hasError = false;
const errMsg = "*Generic placeholder error message*";
module.exports = {
name: "damage",
description: "Check gun damage",
usage: "(Gun)",
category: "CODM",
run: async (client, message, args) => {
const repEmb = dmg(args.join(" ").replace("\n", " "));
if (hasError) {
message.reply({ embeds: [repEmb] });
}
else {
message.channel.send({ embeds: [repEmb] });
}
},
};
function dmg(inpmsg) {
currGun = common.weaponIdentifier(inpmsg);
if (typeof currGun == "string") {
hasError = true;
return currGun;
}
currDRM = currGun.drm[0];
currStats = currGun.stats;
currAttachments = common.attachmentsIdentifier(
inpmsg,
currGun.aments,
currStats,
);
if (typeof currAttachments == "string") {
hasError = true;
return currAttachments;
}
if (currAttachments.length) {
totalEffects = common.totaler(currAttachments);
currDRM = currGun.drm[totalEffects[37]];
currDRM.range = currDRM.range.map(
x => (x * (totalEffects[13] + 100)) / 100,
);
currStats = common.updateStatswithEffects(totalEffects, currStats);
}
const mn = [
"Head",
"Neck",
"Upper Chest",
"Lower Chest",
"Shoulders",
"Upper Arms",
"Lower Arms",
"Stomach",
"Belly Button",
"Crotch",
"Thighs",
"Calf Muscles",
"Feet",
],
m1 = currDRM.bodymultiplier,
m2 = [...new Set(m1)], // [1.2, 1, 0.9]
m3 = m1.map(x => m2.indexOf(x)), // [0, 1, 1, 1, 1, 1, 2, 2, 2]
m4 = m2
.map(x =>
m3
.map((y, i) => {
if (x === m2[y]) {
return mn[i];
}
})
.filter(y => y),
)
.map(x =>
x.length === m1.length
? ["All"]
: x.length === m1.length - 1
? ["Others"]
: x,
);
interpretion = currGun.gunname + common.interpretioner(currAttachments);
return {
title: "**" + interpretion + "**",
color: 4849497,
fields: m4.map((x, i) => {
return {
name: x.join(", ") + ":",
value: common.damageHandler(
currDRM.damage,
currDRM.range,
m2[i],
100,
60000 / currStats[5],
currStats[7],
currStats[6],
currStats[0],
),
};
}),
footer: {
text: "All the stats courtesy of Project Lighthouse",
icon_url:
"https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png?width=638&height=638",
},
};
}
// console.log(dmg("47 + mono"));
/* console.log(dmg("47"));
console.log(dmg("striker + choke"));
console.log(dmg("striker + choke"));
console.log(dmg("striker"));
common.makeError();*/

168
CODM/effects.js vendored
View file

@ -1,168 +0,0 @@
const common = require("../util/functions/common");
const data = require("../util/Data/data.json");
let currGun, currAttachments, interpretion, hasError;
const errMsg = "*Generic placeholder error message*";
module.exports = {
name: "effects",
description: "Check gun effects",
usage: "(Gun)",
category: "CODM",
aliases: ["attachements"],
/**
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
const repEmb = attachments(args.join(" ").replace("\n", " "));
if (hasError) {
message.reply({ embeds: [repEmb] });
} else {
message.channel.send({ embeds: [repEmb] });
}
},
};
function attachments(inpmsg) {
const out = "",
at = data.attachmentTypes.map(x => (x.slice(-1) === "s" ? x : x + "s"));
if (inpmsg.includes("+") && inpmsg.includes(":")) {
hasError = true;
return "Bro, can u liek, not do that?";
}
if (inpmsg.includes(":")) {
const inpAll = inpmsg
.split(":")
.map(x => x.trim())
.filter(x => x),
inpType = inpAll.length === 2 ? inpAll[1] : null;
if (!inpType) {
hasError = true;
return inpAll.length < 2
? "Empty " + (inpAll[0] ? "" : "weapon name and ") + "attachment type"
: "Multiple `:`s detected";
}
currGun = common.weaponIdentifier(inpAll[0]);
if (typeof currGun == "string") {
hasError = true;
return currGun;
}
let currAttachmentsType = at.filter(x => simplify(x) == simplify(inpType));
currAttachmentsType = currAttachmentsType.length
? currAttachmentsType
: at.filter(
x => simplify(x.substring(0, x.length - 1)) == simplify(inpType)
);
currAttachmentsType = currAttachmentsType.length
? currAttachmentsType
: at.filter(x => simplify(x).includes(simplify(inpType)));
if (currAttachmentsType.length === 0) {
hasError = true;
return "Couldn't identify `" + inpType + "`";
} else if (currAttachmentsType.length === 1) {
currAttachmentsType = at.indexOf(currAttachmentsType[0]);
} else {
hasError = true;
return (
"Did you mean `" +
currAttachmentsType.reduce((out, x, i) =>
[out, x].join(
i === currAttachmentsType.length - 1 ? "` or `" : "`, `"
)
) +
"`"
);
}
return {
title: currGun.gunname,
color: 11348938,
fields: [
{
name:
"**" +
currGun.gunname +
"** has the following " +
at[currAttachmentsType],
value:
"```\n" +
currGun.aments
.filter(x => x.type - 1 === currAttachmentsType)
.map(x => x.name)
.join("\n") +
"```",
},
],
footer: {
text: "All the stats courtesy of Project Lighthouse",
icon_url:
"https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png?width=638&height=638",
},
};
function simplify(v) {
return v.toLowerCase().replace(/[^0-9a-z]/g, "");
}
}
currGun = common.weaponIdentifier(inpmsg);
if (typeof currGun == "string") {
hasError = true;
return currGun;
}
hasAttachments = common.hasAttachments(inpmsg);
currAttachments = [];
if (hasAttachments) {
currAttachments = common.attachmentsIdentifier(
inpmsg,
currGun.aments,
currGun.stats
);
if (typeof currAttachments == "string") {
hasError = true;
return currAttachments;
}
return {
title: currGun.gunname + common.interpretioner(currAttachments),
color: 11348938,
fields: common.attachmentHandler(
common.totaler(currAttachments),
currGun.stats
),
footer: {
text: "All the stats courtesy of Project Lighthouse",
icon_url:
"https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png?width=638&height=638",
},
};
} else {
const availableAttachmentTypes = [
...new Set(currGun.aments.map(x => x.type)),
];
return {
title: currGun.gunname,
color: 11348938,
fields: [
{
name:
"**" + currGun.gunname + "** has the following attachment types:",
value:
"```\n" +
availableAttachmentTypes.map(x => at[x - 1]).join(",\n") +
"```",
},
],
footer: {
text: "All the stats courtesy of Project Lighthouse",
icon_url:
"https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png?width=638&height=638",
},
};
}
}
// console.log(attachments("Peacekeeper:muzzle")); //common.makeError();
/* console.log(attachments(":")); //common.makeError();
console.log(attachments("47:optics")); //common.makeError();
console.log(attachments("47")); //common.makeError();
console.log(attachments("47 + ")); //common.makeError();
console.log(attachments("47 + :")); //common.makeError();
console.log(attachments("47 + red dot")); common.makeError();*/

View file

@ -1,111 +0,0 @@
module.exports = {
name: "sgrelo",
descriptiom: "Calculate reload time for shotgun",
run: async (client, message, args) => {
let err = "",
wrn = "",
interpretedAs = [];
function mather(inp) {
const inpArr = interpreter(inp),
outArr = [];
inpArr.map((x, i, a) => {
for (let j = i + 1; j < a.length; j++) {
outArr.push(worker(x, a[j]));
}
});
const aArr = outArr.map(x => x.a),
iArr = outArr.map(x => x.i);
return (
"Input: `" +
interpretedAs.join("`, `") +
"`" +
(aArr.length == 1
? "\nOpening and Closing Animation Time: " +
beautifier(aArr[0]) +
"\nReload Time: " +
beautifier(iArr[0])
: "\nAll Opening and Closing Animation Time: " +
aArr.map(x => beautifier(x)).join(", ") +
"\nAll Reload Time: " +
iArr.map(x => beautifier(x)).join(", ") +
"\nAverage Opening and Closing Animation Time: " +
beautifier(aArr.reduce((t, x) => t + x, 0) / aArr.length) +
"\nAverage Reload Time: " +
beautifier(iArr.reduce((t, x) => t + x, 0) / iArr.length))
);
}
function interpreter(inp) {
let out = [
...new Set(
inp
.split(/\n|, |,/g)
.filter(x => x)
.map(x => x.toLowerCase().replace(/[^0-9a-z]/g, ""))
),
];
out = out
.map(x => {
interpretedAs.push(x);
const obj = {
b: 0,
f: 0,
};
if (
x.split(/b/g).length > 2 ||
x.split(/f/g).length > 2 ||
x.split(/[a-z]/g).length > 3
) {
err += "Unknown identifier `" + x + "`\n";
} else if (x.indexOf("b") === -1 || x.indexOf("f") === -1) {
err += "Missing identifier `" + x + "`\n";
} else if (x.indexOf("b") === x.length - 1) {
obj.b = parseFloat(x.split("f")[1].trim());
obj.f = parseFloat(x.split("f")[0].trim());
} else if (x.indexOf("f") === x.length - 1) {
obj.b = parseFloat(x.split("b")[0].trim());
obj.f = parseFloat(x.split("b")[1].trim());
} else {
err += "Unknown identifier `" + x + "`\n";
}
if (!obj.b && obj.f) {
err += "Couldn't interpret `" + x + "`\n";
} else if (!Number.isInteger(obj.b)) {
err += "Decimal bullet count found `" + x + "`\n";
} else if (!Number.isInteger(obj.f)) {
wrn += "Decimal value found `" + x + "`\n";
}
return obj;
})
.filter(x => JSON.stringify(x).length && x);
if (out.length === 1) {
err += "Single equation found\n";
}
return err || !out.length ? [] : out;
}
function worker(o1, o2) {
const out = {
i: 0,
a: 0,
};
out.i = (o1.f - o2.f) / (o1.b - o2.b);
out.a = o1.f - out.i * o1.b;
return out;
}
function beautifier(num) {
return parseFloat(num.toFixed(2)).toString() + "s";
}
const msg = mather(args.join(" "));
if (err !== "") {
message.reply(err);
} else if (wrn !== "") {
message.reply({ content: wrn + "\n" + msg });
} else {
message.channel.send({ content: msg });
}
},
};

View file

@ -14,7 +14,7 @@ class NYX extends Client {
presence: {
activities: [
{
name: `v${require("../package.json").version} | /help`,
name: `/help`,
type: "STREAMING",
url: "https://www.youtube.com/watch?v=YSKDu1gKntY",
},

View file

@ -1,40 +0,0 @@
const { MessageEmbed } = require("discord.js");
const { getreddit } = require("cath");
module.exports = {
name: "milf",
description: "Get some milf images",
run: async (client, interaction) => {
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] });
} else {
const subreddits = ["milf", "OnlyHotMilfs", "realmoms"];
const reddit = subreddits[Math.round(Math.random() * subreddits.length)];
const data = await getreddit(reddit);
interaction.followUp({
embeds: [
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 }),
},
}),
],
});
}
},
};

View file

@ -1,42 +0,0 @@
const { MessageEmbed } = require("discord.js");
const { getreddit } = require("cath");
module.exports = {
name: "thighs",
description: "Get some thighs images",
run: async (client, interaction) => {
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] });
return;
} else {
const subreddits = ["thighs", "PerfectThighs", "thickthighs"];
const reddit = subreddits[Math.round(Math.random() * subreddits.length)];
const data = await getreddit(reddit);
interaction.followUp({
embeds: [
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 }),
},
}),
],
});
}
},
};

View file

@ -1,35 +0,0 @@
const URLClient = require("../../client/URLClient");
module.exports = {
name: "shorten-url",
description: "Shorten a URL",
options: [
{
type: 3,
name: "short-name",
description:
"The short name that for the shorten-url (For example, https://url.cath.gq/youtube)",
required: true,
},
{
type: 3,
name: "link",
description:
"The link for the shorten-url (For example, https://youtube.com)",
required: true,
},
],
run: async (client, interaction, args) => {
if (!args[1].includes("https://")) {
interaction.followUp({ content: "The link must contain 'https://'" });
} else {
const shortName = args[0];
const targetURL = args[1];
const cc = await URLClient.createShortURL(shortName, targetURL);
if (!cc) {
interaction.followUp({ content: `URL already exist` });
} else {
interaction.followUp({ content: `https://url.cath.gq/${cc}` });
}
}
},
};

View file

@ -1,6 +1,6 @@
{
"name": "cath.exe",
"version": "3.4.0",
"version": "0.0.1",
"description": "NYX bot created by Team NYX",
"engines": {
"node": "*",
@ -37,18 +37,18 @@
"url": "https://ko-fi.com/cathteam"
},
"devDependencies": {
"node": "^17.1.0"
"node": "^17.3.0"
},
"dependencies": {
"axios": "^0.24.0",
"cath": "^1.4.6",
"discord.js": "^13.3.1",
"discord.js": "^13.5.1",
"dotenv": "^10.0.0",
"erela.js": "^2.3.3",
"erela.js-spotify": "^1.2.0",
"goosecache": "^9.0.14",
"moment": "^2.29.1",
"mongoose": "^5.13.13",
"mongoose": "^5.13.14",
"quickchart-js": "^2.0.3"
}
}

View file

@ -1,4 +1,4 @@
const GiveawaysClient = require("../../client/GiveawaysClient");
const GiveawaysClient = require("../../../client/GiveawaysClient");
module.exports = {
name: "giveaway",
description: "Giveaway",

View file

@ -1,5 +1,5 @@
const { MessageEmbed, version: djsversion } = require("discord.js");
const version = require("../../package.json").version;
const version = require("../../../package.json").version;
const { utc } = require("moment");
const os = require("os");
module.exports = {

View file

@ -1,4 +1,4 @@
const CodeClient = require("../../client/CodeClient");
const CodeClient = require("../../../client/CodeClient");
module.exports = {
name: "Create Code Bin",
type: "MESSAGE",