nyx

The first CODM discrod bot -- cath.exe Template
git clone https://codeberg.org/night0721/nyx
Log | Files | Refs | LICENSE

commit ef437fa4bac7a31a047440adba4e9d1506d7c6e3
parent 8bbc22c06c5a8f2df9fb30e95d90eb6f14d983d5
Author: night0721 <[email protected]>
Date:   Sat,  8 Jan 2022 08:07:13 +0800

Version v3.5.0

Diffstat:
DCODM/class.js | 55-------------------------------------------------------
DCODM/damage.js | 118-------------------------------------------------------------------------------
DCODM/effects.js | 168-------------------------------------------------------------------------------
DCODM/sgrelo.js | 111-------------------------------------------------------------------------------
Mclient/NYX.js | 2+-
Dcommand/Giveaway/giveaway.js | 144-------------------------------------------------------------------------------
Dcommand/Information/botinfo.js | 77-----------------------------------------------------------------------------
Dcommand/NSFW/milf.js | 40----------------------------------------
Dcommand/NSFW/thighs.js | 42------------------------------------------
Dcommand/Utilities/codebin.js | 17-----------------
Dcommand/Utilities/shorturl.js | 35-----------------------------------
Mpackage.json | 8++++----
Rcommand/Fun/choose.js -> unused/commands/Fun/choose.js | 0
Rcommand/Fun/fun.js -> unused/commands/Fun/fun.js | 0
Rcommand/Fun/hack.js -> unused/commands/Fun/hack.js | 0
Rcommand/Fun/image.js -> unused/commands/Fun/image.js | 0
Rcommand/Fun/kiss.js -> unused/commands/Fun/kiss.js | 0
Rcommand/Fun/rps.js -> unused/commands/Fun/rps.js | 0
Aunused/commands/Giveaway/giveaway.js | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rcommand/Information/banner.js -> unused/commands/Information/banner.js | 0
Aunused/commands/Information/botinfo.js | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rcommand/Information/serverinfo.js -> unused/commands/Information/serverinfo.js | 0
Aunused/commands/Utilities/codebin.js | 17+++++++++++++++++
Rcommand/Utilities/docs.js -> unused/commands/Utilities/docs.js | 0
24 files changed, 243 insertions(+), 812 deletions(-)

diff --git a/CODM/class.js b/CODM/class.js @@ -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)]; - } - }, -}; diff --git a/CODM/damage.js b/CODM/damage.js @@ -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();*/ diff --git a/CODM/effects.js b/CODM/effects.js @@ -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();*/ diff --git a/CODM/sgrelo.js b/CODM/sgrelo.js @@ -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 }); - } - }, -}; diff --git a/client/NYX.js b/client/NYX.js @@ -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", }, diff --git a/command/Giveaway/giveaway.js b/command/Giveaway/giveaway.js @@ -1,144 +0,0 @@ -const GiveawaysClient = require("../../client/GiveawaysClient"); -module.exports = { - name: "giveaway", - description: "Giveaway", - UserPerms: ["MANAGE_MESSAGES"], - options: [ - { - type: "SUB_COMMAND", - name: "start", - description: "Start a giveaway", - options: [ - { - type: 3, - name: "prize", - description: "The prize of the giveaway", - required: true, - choices: [], - }, - { - type: 4, - name: "winners", - description: "The amount of winners of the giveaway", - required: true, - }, - { - type: 3, - name: "time", - description: "The amount of time of the giveaway", - required: true, - }, - { - type: 7, - name: "channel", - description: "The channel of the giveaway", - required: true, - channelTypes: ["GUILD_TEXT"], - }, - { - type: 8, - name: "role1", - description: "The required role to join the giveaway", - }, - { - type: 8, - name: "role2", - description: "The required role to join the giveaway", - }, - { - type: 8, - name: "role3", - description: "The required role to join the giveaway", - }, - ], - }, - { - type: "SUB_COMMAND", - name: "reroll", - description: "Reroll a giveaway", - options: [ - { - type: 3, - name: "message", - description: "The message ID of the giveaway", - required: true, - choices: [], - }, - ], - }, - { - type: "SUB_COMMAND", - name: "end", - description: "End a giveaway", - options: [ - { - type: 3, - name: "message", - description: "The message ID of the giveaway", - required: true, - choices: [], - }, - ], - }, - ], - run: async (client, interaction, args, utils) => { - if (args[0] == "start") { - const [, prize, winners, time, channel, roles1, roles2, roles3] = args; - if (!utils.ms(time)) { - interaction.followUp({ - content: "Time must be a valid time to parse (Example: 10m, 100s)", - }); - } - await GiveawaysClient.create(client, { - prize, - host: interaction.user.id, - winners, - endAfter: time, - requirements: roles1 - ? { - Enabled: true, - Roles: [roles1], - } - : roles2 && roles1 - ? { - Enabled: true, - Roles: [roles1, roles2], - } - : roles1 && roles2 && roles3 - ? { - Enabled: true, - Roles: [roles1, roles2, roles3], - } - : { Enabled: false }, - Channel: channel, - }); - interaction.followUp({ - content: `Giveaway is started in ${interaction.guild.channels.cache.get( - channel - )}`, - }); - } else if (args[0] == "reroll") { - const giveaway = await GiveawaysClient.getByMessage(args[1]); - const m = await client.guilds.cache - .get(giveaway.Guild) - .channels.cache.get(giveaway.Channel) - .messages.fetch(args[1]); - if (!m) { - interaction.followUp({ content: "Unable to find the giveaway ⚠" }); - } else { - await GiveawaysClient.end(m, giveaway, m); - } - } else { - const giveaway = await GiveawaysClient.getByMessage(args[1]); - const m = await client.guilds.cache - .get(giveaway.Guild) - .channels.cache.get(giveaway.Channel) - .messages.fetch(args[1]); - if (!m) { - interaction.followUp({ content: "Unable to find the giveaway ⚠" }); - } else { - await GiveawaysClient.end(m, giveaway, m); - } - } - }, -}; diff --git a/command/Information/botinfo.js b/command/Information/botinfo.js @@ -1,77 +0,0 @@ -const { MessageEmbed, version: djsversion } = require("discord.js"); -const version = require("../../package.json").version; -const { utc } = require("moment"); -const os = require("os"); -module.exports = { - name: "botinfo", - description: "Check the info of the bot", - category: "Information", - type: "CHAT_INPUT", - run: async (client, interaction, args, utils) => { - const core = os.cpus()[0]; - const embed = new MessageEmbed() - .setTitle(`NYX - CODM Gunsmith Bot`) - .setURL( - `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands` - ) - .setThumbnail( - "https://media.discordapp.net/attachments/896078559293104128/896392631565828146/nyx_logo_transparent.webp" - ) - .setColor(client.color) - .addFields( - { - name: `General`, - value: ` - <:nyx_owner:897418259433943120> Owner ❯ <@452076196419600394> - Bot ❯ ${client.user.tag} - Bot ID ❯ \`${client.user.id}\` - Created on ❯ \`${utc(client.user.createdTimestamp).format( - "MMMM Do YYYY" - )}\``, - inline: true, - }, - { - name: `Bot Stats`, - value: ` - Servers ❯ ${client.guilds.cache.size.toLocaleString()} - Users ❯ ${client.guilds.cache - .reduce((a, b) => a + b.memberCount, 0) - .toLocaleString()} - Channels ❯ \`${client.channels.cache.size.toLocaleString()}\` - Commands ❯ \`${client.commands.size}\` - `, - inline: true, - } - ) - .addFields( - { - name: `Platform`, - value: ` - NYX ❯ \`v${version}\` - Discord.js ❯ \`v${djsversion}\` - Node.js ❯ \`${process.version}\``, - }, - { - name: `Hardware`, - value: ` - Uptime:** ${utils.timer(os.uptime() * 1000, { long: true })} - Platform:** ${process.platform} - CPU:** - \u3000 Cores: ${os.cpus().length} - \u3000 Model: ${core.model} - \u3000 Speed: ${core.speed}MHz - **`, - inline: true, - } - ) - .addFields({ - name: `**${client.author}**`, - value: `**Development Management**\n\u3000Εƒ1ght#0001\n\u3000Cat drinking a cat#0795\n\u3000mightyful#6536\n\u3000Thunder#2128\n\u3000mobo#9277\n - **Research & Documentation**\n\u3000𝔔𝓻𝔦ค𝔁𝔖ค𝔦ӄø#0690\n\u3000Thunder#2128\n - **Website**\n\u3000Chunchunmaru#8570`, - }) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) - .setTimestamp(); - interaction.followUp({ embeds: [embed] }); - }, -}; diff --git a/command/NSFW/milf.js b/command/NSFW/milf.js @@ -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 }), - }, - }), - ], - }); - } - }, -}; diff --git a/command/NSFW/thighs.js b/command/NSFW/thighs.js @@ -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 }), - }, - }), - ], - }); - } - }, -}; diff --git a/command/Utilities/codebin.js b/command/Utilities/codebin.js @@ -1,17 +0,0 @@ -const CodeClient = require("../../client/CodeClient"); -module.exports = { - name: "Create Code Bin", - type: "MESSAGE", - run: async (client, interaction) => { - const msg = await interaction.channel.messages.fetch(interaction.targetId); - if (!msg.content) { - interaction.followUp({ content: "The message must have a content" }); - } else { - const title = "Code"; - const description = msg.author.tag; - const code = msg.content; - const link = await CodeClient.createBin(title, description, code); - interaction.followUp({ content: link }); - } - }, -}; diff --git a/command/Utilities/shorturl.js b/command/Utilities/shorturl.js @@ -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}` }); - } - } - }, -}; diff --git a/package.json b/package.json @@ -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" } } diff --git a/command/Fun/choose.js b/unused/commands/Fun/choose.js diff --git a/command/Fun/fun.js b/unused/commands/Fun/fun.js diff --git a/command/Fun/hack.js b/unused/commands/Fun/hack.js diff --git a/command/Fun/image.js b/unused/commands/Fun/image.js diff --git a/command/Fun/kiss.js b/unused/commands/Fun/kiss.js diff --git a/command/Fun/rps.js b/unused/commands/Fun/rps.js diff --git a/unused/commands/Giveaway/giveaway.js b/unused/commands/Giveaway/giveaway.js @@ -0,0 +1,144 @@ +const GiveawaysClient = require("../../../client/GiveawaysClient"); +module.exports = { + name: "giveaway", + description: "Giveaway", + UserPerms: ["MANAGE_MESSAGES"], + options: [ + { + type: "SUB_COMMAND", + name: "start", + description: "Start a giveaway", + options: [ + { + type: 3, + name: "prize", + description: "The prize of the giveaway", + required: true, + choices: [], + }, + { + type: 4, + name: "winners", + description: "The amount of winners of the giveaway", + required: true, + }, + { + type: 3, + name: "time", + description: "The amount of time of the giveaway", + required: true, + }, + { + type: 7, + name: "channel", + description: "The channel of the giveaway", + required: true, + channelTypes: ["GUILD_TEXT"], + }, + { + type: 8, + name: "role1", + description: "The required role to join the giveaway", + }, + { + type: 8, + name: "role2", + description: "The required role to join the giveaway", + }, + { + type: 8, + name: "role3", + description: "The required role to join the giveaway", + }, + ], + }, + { + type: "SUB_COMMAND", + name: "reroll", + description: "Reroll a giveaway", + options: [ + { + type: 3, + name: "message", + description: "The message ID of the giveaway", + required: true, + choices: [], + }, + ], + }, + { + type: "SUB_COMMAND", + name: "end", + description: "End a giveaway", + options: [ + { + type: 3, + name: "message", + description: "The message ID of the giveaway", + required: true, + choices: [], + }, + ], + }, + ], + run: async (client, interaction, args, utils) => { + if (args[0] == "start") { + const [, prize, winners, time, channel, roles1, roles2, roles3] = args; + if (!utils.ms(time)) { + interaction.followUp({ + content: "Time must be a valid time to parse (Example: 10m, 100s)", + }); + } + await GiveawaysClient.create(client, { + prize, + host: interaction.user.id, + winners, + endAfter: time, + requirements: roles1 + ? { + Enabled: true, + Roles: [roles1], + } + : roles2 && roles1 + ? { + Enabled: true, + Roles: [roles1, roles2], + } + : roles1 && roles2 && roles3 + ? { + Enabled: true, + Roles: [roles1, roles2, roles3], + } + : { Enabled: false }, + Channel: channel, + }); + interaction.followUp({ + content: `Giveaway is started in ${interaction.guild.channels.cache.get( + channel + )}`, + }); + } else if (args[0] == "reroll") { + const giveaway = await GiveawaysClient.getByMessage(args[1]); + const m = await client.guilds.cache + .get(giveaway.Guild) + .channels.cache.get(giveaway.Channel) + .messages.fetch(args[1]); + if (!m) { + interaction.followUp({ content: "Unable to find the giveaway ⚠" }); + } else { + await GiveawaysClient.end(m, giveaway, m); + } + } else { + const giveaway = await GiveawaysClient.getByMessage(args[1]); + const m = await client.guilds.cache + .get(giveaway.Guild) + .channels.cache.get(giveaway.Channel) + .messages.fetch(args[1]); + if (!m) { + interaction.followUp({ content: "Unable to find the giveaway ⚠" }); + } else { + await GiveawaysClient.end(m, giveaway, m); + } + } + }, +}; diff --git a/command/Information/banner.js b/unused/commands/Information/banner.js diff --git a/unused/commands/Information/botinfo.js b/unused/commands/Information/botinfo.js @@ -0,0 +1,77 @@ +const { MessageEmbed, version: djsversion } = require("discord.js"); +const version = require("../../../package.json").version; +const { utc } = require("moment"); +const os = require("os"); +module.exports = { + name: "botinfo", + description: "Check the info of the bot", + category: "Information", + type: "CHAT_INPUT", + run: async (client, interaction, args, utils) => { + const core = os.cpus()[0]; + const embed = new MessageEmbed() + .setTitle(`NYX - CODM Gunsmith Bot`) + .setURL( + `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands` + ) + .setThumbnail( + "https://media.discordapp.net/attachments/896078559293104128/896392631565828146/nyx_logo_transparent.webp" + ) + .setColor(client.color) + .addFields( + { + name: `General`, + value: ` + <:nyx_owner:897418259433943120> Owner ❯ <@452076196419600394> + Bot ❯ ${client.user.tag} + Bot ID ❯ \`${client.user.id}\` + Created on ❯ \`${utc(client.user.createdTimestamp).format( + "MMMM Do YYYY" + )}\``, + inline: true, + }, + { + name: `Bot Stats`, + value: ` + Servers ❯ ${client.guilds.cache.size.toLocaleString()} + Users ❯ ${client.guilds.cache + .reduce((a, b) => a + b.memberCount, 0) + .toLocaleString()} + Channels ❯ \`${client.channels.cache.size.toLocaleString()}\` + Commands ❯ \`${client.commands.size}\` + `, + inline: true, + } + ) + .addFields( + { + name: `Platform`, + value: ` + NYX ❯ \`v${version}\` + Discord.js ❯ \`v${djsversion}\` + Node.js ❯ \`${process.version}\``, + }, + { + name: `Hardware`, + value: ` + Uptime:** ${utils.timer(os.uptime() * 1000, { long: true })} + Platform:** ${process.platform} + CPU:** + \u3000 Cores: ${os.cpus().length} + \u3000 Model: ${core.model} + \u3000 Speed: ${core.speed}MHz + **`, + inline: true, + } + ) + .addFields({ + name: `**${client.author}**`, + value: `**Development Management**\n\u3000Εƒ1ght#0001\n\u3000Cat drinking a cat#0795\n\u3000mightyful#6536\n\u3000Thunder#2128\n\u3000mobo#9277\n + **Research & Documentation**\n\u3000𝔔𝓻𝔦ค𝔁𝔖ค𝔦ӄø#0690\n\u3000Thunder#2128\n + **Website**\n\u3000Chunchunmaru#8570`, + }) + .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setTimestamp(); + interaction.followUp({ embeds: [embed] }); + }, +}; diff --git a/command/Information/serverinfo.js b/unused/commands/Information/serverinfo.js diff --git a/unused/commands/Utilities/codebin.js b/unused/commands/Utilities/codebin.js @@ -0,0 +1,17 @@ +const CodeClient = require("../../../client/CodeClient"); +module.exports = { + name: "Create Code Bin", + type: "MESSAGE", + run: async (client, interaction) => { + const msg = await interaction.channel.messages.fetch(interaction.targetId); + if (!msg.content) { + interaction.followUp({ content: "The message must have a content" }); + } else { + const title = "Code"; + const description = msg.author.tag; + const code = msg.content; + const link = await CodeClient.createBin(title, description, code); + interaction.followUp({ content: link }); + } + }, +}; diff --git a/command/Utilities/docs.js b/unused/commands/Utilities/docs.js