nyx

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

commit c047fbb980f3d842043cde5465dc4f2553f315d6
parent 6430e2647931e85202b26f7ae69cde0d176d3764
Author: NK <[email protected]>
Date:   Sun,  2 Apr 2023 13:12:53 +0100

the great revamp

Diffstat:
D.gitattributes | 2--
D.replit | 3---
DProcfile | 2--
Dapp.json | 21---------------------
Mclient/NYX.js | 27++++++++++-----------------
Mcommand/CODM/build.js | 2+-
Mcommand/CODM/class.js | 11++++-------
Mcommand/CODM/loadout.js | 2+-
Mcommand/CODM/perk.js | 2+-
Mcommand/CODM/scorestreak.js | 2+-
Mcommand/Config/settings.js | 2+-
Mcommand/Information/avatar.js | 8++++++--
Mcommand/Information/botinfo.js | 41+++++++++++++++++++----------------------
Mcommand/Information/help.js | 89++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
Mcommand/Information/ping.js | 4++--
Mcommand/Information/userinfo.js | 120++++++++++++++++++++++++++-----------------------------------------------------
Mcommand/Owner/blacklist.js | 4++--
Mcommand/Owner/eval.js | 2--
Mcommand/Owner/guilds.js | 16++++++++++------
Mcommand/Utilities/invite.js | 16++++++++++------
Mcommand/Utilities/poll.js | 16++++++++++------
Mcommand/Utilities/report.js | 19++++++++-----------
Mcommand/Utilities/suggest.js | 104+++++++++++++++++++++----------------------------------------------------------
Mevents/emoji.js | 10+++-------
Mevents/guild.js | 4++--
Mevents/interactionCreate.js | 18++----------------
Mevents/messageCreate.js | 12++++++------
Mevents/typingStart.js | 12++++++++----
Mpackage.json | 2+-
Dstart.bat | 4----
Mutil/Data/domains.json | 11+----------
Dutil/Data/tnd.json | 90-------------------------------------------------------------------------------
Dutil/Data/wyr.json | 128-------------------------------------------------------------------------------
Mutil/functions/function.js | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------
34 files changed, 298 insertions(+), 588 deletions(-)

diff --git a/.gitattributes b/.gitattributes @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto diff --git a/.replit b/.replit @@ -1,2 +0,0 @@ -"language"="nodejs" -"run"="node_modules/.bin/node index.js" -\ No newline at end of file diff --git a/Procfile b/Procfile @@ -1 +0,0 @@ -worker: node index.js -\ No newline at end of file diff --git a/app.json b/app.json @@ -1,21 +0,0 @@ -{ - "name": "NYX - CODM Bot", - "description": "Host cath.exe through Heroku", - "keywords": ["bot", "nyx", "codm", "discord", "gunsmith"], - "repository": "https://github.com/night0721/cath.exe", - "env": { - "TOKEN": { - "description": "Bot Token from https://discord.com/developers/applications", - "value": "" - }, - "MONGO": { - "description": "MongoDB URI from https://mongodb.com/", - "value": "" - } - }, - "buildpacks": [ - { - "url": "heroku/nodejs" - } - ] -} diff --git a/client/NYX.js b/client/NYX.js @@ -32,12 +32,11 @@ class NYX extends Client { ], intents: [ GatewayIntentBits.Guilds, - // GatewayIntentBits.GuildMembers, - // GatewayIntentBits.MessageContent, - // GatewayIntentBits.GuildPresences, - // GatewayIntentBits.GuildMessages, - // GatewayIntentBits.GuildMessageReactions, - // GatewayIntentBits.GuildMessageTyping, + GatewayIntentBits.GuildMembers, + GatewayIntentBits.MessageContent, + GatewayIntentBits.GuildMessages, + GatewayIntentBits.DirectMessageTyping, + GatewayIntentBits.DirectMessages, ], } ) { @@ -76,24 +75,18 @@ class NYX extends Client { .then(() => console.log("Connected to MongoDB ✅")) .catch(e => console.log(e)); } - err(c, e) { + err(interaction, error) { const embed = new EmbedBuilder() .setTitle("An Error Occured") .setColor("Red") - .setDescription(`❌ | ${e}`) + .setDescription(`❌ | ${error}`) .setTimestamp() .setFooter({ text: `Made by ${this.author}`, - iconURL: this.user.displayAvatarURL(), + iconURL: this.user.displayAvatarURL({ dynamic: true }), }); - c.followUp({ embeds: [embed] }); - } - se(c, e) { - const embed = new EmbedBuilder() - .setColor(this.color) - .setDescription(e) - .setTimestamp(); - c.followUp({ embeds: [embed] }); + interaction.channel.send({ embeds: [embed] }); + this.channels.cache.get(this.config.ErrorLog).send({ embeds: [embed] }); } } diff --git a/command/CODM/build.js b/command/CODM/build.js @@ -693,7 +693,7 @@ module.exports = { .setImage(data.imageUrl) .setFooter({ text: `Builds Aggregated by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .addFields( diff --git a/command/CODM/class.js b/command/CODM/class.js @@ -8,11 +8,8 @@ module.exports = { run: async (client, interaction) => { const data = async () => { const d = await model.findOne({}); - const weapons = - d.Primary[0][ - d.Categories[Math.floor(Math.random() * d.Categories.length)] - ]; - return `${weapons[Math.floor(Math.random() * weapons.length)]}`; + const weapons = d.Primary[0][d.Categories.random()]; + return `${weapons.random()}`; }; const primary_weapon = await data(); const primary = primary_weapon.replace(/[ -]/g, "_").replace(/\./g, ""); @@ -40,7 +37,7 @@ module.exports = { .setURL(client.web) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp(); interaction.followUp({ embeds: [result] }); @@ -52,7 +49,7 @@ module.exports = { } function getAttachment(gun, slot) { const ca = Attachments[gun][0][slot]; - return ca[Math.floor(Math.random() * ca.length)]; + return ca.random(); } }, }; diff --git a/command/CODM/loadout.js b/command/CODM/loadout.js @@ -22,7 +22,7 @@ module.exports = { .setColor(client.color) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setURL(client.web) .setTitle(`🎲 A Randomly Generated Loadout 🎲`) diff --git a/command/CODM/perk.js b/command/CODM/perk.js @@ -188,7 +188,7 @@ module.exports = { ) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .setTitle(d.perk) diff --git a/command/CODM/scorestreak.js b/command/CODM/scorestreak.js @@ -154,7 +154,7 @@ module.exports = { .setThumbnail(d.preview) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setColor( d.type == "lethal" diff --git a/command/Config/settings.js b/command/Config/settings.js @@ -487,7 +487,7 @@ module.exports = { .setColor(client.color) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .setDescription(d); diff --git a/command/Information/avatar.js b/command/Information/avatar.js @@ -38,11 +38,15 @@ module.exports = { })})**` ) .setImage( - member.user.displayAvatarURL({ size: 2048, dynamic: true, format: "png" }) + member.user.displayAvatarURL({ + size: 2048, + dynamic: true, + format: "png", + }) ) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setURL(client.web) .setTimestamp(); diff --git a/command/Information/botinfo.js b/command/Information/botinfo.js @@ -5,18 +5,15 @@ module.exports = { name: "botinfo", description: "Check the info of the bot", category: "Information", - - run: async (client, interaction) => { + run: async (client, interaction, args, utils) => { const embed = new EmbedBuilder() .setTitle(`NYX - CODM Gunsmith Bot`) - .setURL( - `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands` - ) + .setURL(utils.inviteLink(client.user.id)) .setThumbnail( "https://media.discordapp.net/attachments/896078559293104128/896392631565828146/nyx_logo_transparent.webp" ) .setColor(client.color) - .addFields( + .addFields([ { name: `General`, value: ` @@ -39,24 +36,24 @@ module.exports = { Commands ❯ \`${client.slashCommands.size}\` `, inline: true, - } - ) - .addFields({ - name: `Platform`, - value: ` - NYX ❯ \`v${version}\` - Discord.js ❯ \`v${djsversion}\` - Node.js ❯ \`${process.version}\``, - }) - .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`, - }) + }, + { + name: `Platform`, + value: ` + NYX ❯ \`v${version}\` + Discord.js ❯ \`v${djsversion}\` + Node.js ❯ \`${process.version}\``, + }, + { + 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\u3000Thunder#2128\n + **Website**\n\u3000Chunchunmaru#8570`, + }, + ]) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp(); interaction.followUp({ embeds: [embed] }); diff --git a/command/Information/help.js b/command/Information/help.js @@ -1,4 +1,12 @@ -const Discord = require("discord.js"); +const { + EmbedBuilder, + Client, + CommandInteraction, + ActionRowBuilder, + StringSelectMenuBuilder, + ComponentType, +} = require("discord.js"); +const Utils = require("../../util/functions/function"); module.exports = { name: "help", usage: "(Command/Category)", @@ -12,20 +20,22 @@ module.exports = { required: false, }, ], + /** + * + * @param {Client} client + * @param {CommandInteraction} interaction + * @param {String[]} args + * @param {Utils} utils + */ run: async (client, interaction, args, utils) => { if (!args[0]) { await interaction.deleteReply(); const emoji = { CODM: "<a:codm:897030768793104385>", + APEX: "🎆", Config: "<a:config:896990033561669762>", - Economy: client.currency, - Fun: "<a:fun:896889821816053790>", - Moderation: "<:discordmod:897364105730617364>", Information: "<a:information:894962394932064346>", Utilities: "<a:utilites:897233087941988392>", - Music: "<a:music:897017864085712936>", - Giveaway: "<a:confetti:896763534682226758>", - NSFW: "🍑", }; const directories = [ ...new Set(client.slashCommands.map(cmd => cmd.directory)), @@ -44,7 +54,7 @@ module.exports = { commands: getCmds, }; }); - const embed = new Discord.EmbedBuilder() + const embed = new EmbedBuilder() .setTitle(`**NYX's Commands**`) .setDescription(`Please choose a category in the dropdown menu`) .setColor(client.color) @@ -52,12 +62,12 @@ module.exports = { .addFields( { name: ":link: **Invite Me**", - value: `[Click Here](https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands)`, + value: `[Click Here](${utils.inviteLink(client.user.id)})`, inline: true, }, { name: "<:support1:867093614403256350> **Need Help ?**", - value: `[Support Server](https://discord.gg/SbQHChmGcp)`, + value: `[Support Server](${client.invite})`, inline: true, }, { @@ -85,8 +95,8 @@ module.exports = { iconURL: interaction.user.displayAvatarURL({ dynamic: true }), }); const components = state => [ - new Discord.ActionRowBuilder().addComponents( - new Discord.MessageSelectMenu() + new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() .setCustomId("help-menu") .setPlaceholder(`Please select a category`) .setDisabled(state) @@ -110,13 +120,13 @@ module.exports = { const filter = m => m.user.id === interaction.user.id; const collector = interaction.channel.createMessageComponentCollector({ filter, - componentType: "SELECT_MENU", + componentType: ComponentType.StringSelect, time: 60000, }); collector.on("collect", async interaction => { const [directory] = interaction.values; const category = categories.find(u => u.directory === directory); - const newembed = new Discord.EmbedBuilder() + const newembed = new EmbedBuilder() .setTitle( `${emoji[directory]} ${directory} Commands ${emoji[directory]}` ) @@ -138,8 +148,8 @@ module.exports = { } else { const command = client.slashCommands.get(args[0].toLowerCase()); if (!command) { - interaction.followUp({ - content: `There isn't any command or category named "${args[0]}"`, + interaction.editReply({ + content: `There isn't any command named "${args[0]}"`, }); } else { if (command.UserPerms && Array.isArray(command.UserPerms)) { @@ -164,36 +174,59 @@ module.exports = { .map(y => y[0] + y.substring(1, y.length).toLowerCase()) .join(" ") ).join(", "); - const embed = new Discord.EmbedBuilder() + const fields = []; + const embed = new EmbedBuilder() .setTitle(`"${command.name}" command details`) - .addField( - "**Command**:", - command.name ? `\`${command.name}\`` : "N/A" - ); + .addFields([ + { + name: "**Command**:", + value: command.name ? `\`${command.name}\`` : "N/A", + }, + ]); if (command.usage) - embed.addField("**Usage**:", `\`/${command.name} ${command.usage}\``); - else embed.addField("**Usage**:", `\`/${command.name}\``); + fields.push({ + name: "**Usage**:", + value: `\`/${command.name} ${command.usage}\``, + }); + else + fields.push({ + name: "**Usage**:", + value: `\`/${command.name}\``, + }); if (command.description) - embed.addField("**Description**:", command.description); + fields.push({ + name: "**Description**:", + value: command.description, + }); if (command.timeout) - embed.addField("**Cooldown**:", utils.timer(command.timeout)); + fields.push({ + name: "**Cooldown**:", + value: utils.timer(command.timeout), + }); if (command.UserPerms) - embed.addField("**Required User Permission**:", UserPerms); + fields.push({ + name: "**Required User Permission**:", + value: UserPerms, + }); if (command.BotPerms) - embed.addField("**Required Bot Permission**:", BotPerms); + fields.push({ + name: "**Required Bot Permission**:", + value: BotPerms, + }); embed .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: interaction.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() + .addFields(fields) .setURL(client.web) .setColor(client.color); - interaction.followUp({ embeds: [embed] }); + interaction.editReply({ embeds: [embed] }); } } }, diff --git a/command/Information/ping.js b/command/Information/ping.js @@ -12,7 +12,7 @@ module.exports = { .setTitle("<a:pong:897383314405605436> Pong!") .setAuthor({ name: interaction.user.username, - iconURL: interaction.user.displayAvatarURL(), + iconURL: interaction.user.displayAvatarURL({ dynamic: true }), }) .setDescription( `\n 📨 • **Message Latency** \`${Math.floor(messageping)}ms\` @@ -20,7 +20,7 @@ module.exports = { ) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .setColor( diff --git a/command/Information/userinfo.js b/command/Information/userinfo.js @@ -1,6 +1,5 @@ -const { EmbedBuilder } = require("discord.js"); -const moment = require("moment"); - +const { Client, CommandInteraction, EmbedBuilder } = require("discord.js"); +const Utils = require("../../util/functions/function"); module.exports = { name: "userinfo", description: "Check the info of a user", @@ -14,43 +13,17 @@ module.exports = { required: false, }, ], - + /** + * + * @param {Client} client + * @param {CommandInteraction} interaction + * @param {String[]} args + * @param {Utils} utils + */ run: async (client, interaction, args, utils) => { const member = interaction.guild.members.cache.get(args[0]) || interaction.member; - const flags = { - DISCORD_EMPLOYEE: "Discord Staff<:staff:840231971526803467>", - PARTNERED_SERVER_OWNER: - "Partnered Server Owner<:partner:840231939944480829>", - BUGHUNTER_LEVEL_1: "Discord Bug Hunter<:bughunter:840231967600803920>", - BUGHUNTER_LEVEL_2: "Discord Bug Hunter<:bughunterlv2:840231970017771571>", - HYPESQUAD_EVENTS: "HypeSquad Events<:HypeSquad:840231908599922721>", - HOUSE_BRAVERY: "HypeSquad Bravery<:bravery:840231941974655007>", - HOUSE_BRILLIANCE: "HypeSquad Brilliance<:brilliance:840231943764443136>", - HOUSE_BALANCE: "HypeSquad Balance<:balance:840231925876523018>", - EARLY_SUPPORTER: "Early Supporter<:earlysupporter:840231983216984085>", - TEAM_USER: "Team User", - SYSTEM: "System", - VERIFIED_BOT: "Verified Bot<:VerifiedBot:840231982054375425>", - EARLY_VERIFIED_BOT_DEVELOPER: - "Early Verified Bot Developer<:discord_bot_dev:840231906200387666>", - DISCORD_CERTIFIED_MODERATOR: "Discord Certified Moderator", - }; - // let status; - // switch (member.presence.status) { - // case "online": - // status = "<:online:840231921123721237>Online"; - // break; - // case "dnd": - // status = "<:do_not_disturb:840231907715448842>Do Not Disturb"; - // break; - // case "idle": - // status = "<:idle:840231935485149184>Idle"; - // break; - // case "offline": - // status = "<:offline:840231954897305620>Offline"; - // break; - // } + const x = Date.now() - member.user.createdAt; const y = Date.now() - interaction.guild.members.cache.get(member.id).joinedAt; @@ -65,22 +38,10 @@ module.exports = { .sort((a, b) => b.position - a.position) .map(role => role.toString()) .slice(0, -1); - const userFlags = member.user.flags.toArray(); - const createdate = moment(member.user.createdAt).format( - "dddd, MMMM Do YYYY, HH:mm:ss" - ); - const joindate = moment(member.joinedAt).format( - "dddd, MMMM Do YYYY, HH:mm:ss" + const createDateFormatted = utils.parseDate( + new Date(member.user.createdAt) ); - // let activities; - // if (member.presence.activities[0] && member.presence.activities[1]) { - // activities = member.presence.activities[1].name; - // } else if ( - // member.presence.activities[0] && - // !member.presence.activities[1] - // ) { - // activities = "None"; - // } else activities = "None"; + const joinDateFormatted = utils.parseDate(new Date(member.joinedAt)); const embed = new EmbedBuilder() .setAuthor({ name: member.user.tag, @@ -91,45 +52,42 @@ module.exports = { .setURL(client.web) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setThumbnail(member.user.displayAvatarURL({ dynamic: true, size: 512 })) .setColor(member.displayHexColor || client.color) - .addField( - "User", - `**❯ Username:** ${member.user.username} + .addFields([ + { + name: "User", + value: `**❯ Username:** ${member.user.username} **❯ Discriminator:** ${member.user.discriminator} **❯ Nickname:** ${nickname} **❯ User ID:** ${member.id} - **❯ Badge:** ${ - userFlags.length - ? userFlags.map(flag => flags[flag]).join(" **|** ") - : "None" - } **❯ Avatar:** [Link to avatar](${member.user.displayAvatarURL({ dynamic: true, size: 2048, })}) - **❯ Time Created:** ${createdate} \nSince ${created} day(s) ago - \u200b` - ) //* *❯ Status:** ${status}* *❯ Game:** ${activities} - .addField( - "Member", - `**❯ Highest Role:** ${ - member.roles.highest.id === interaction.guild.id - ? "None" - : member.roles.highest.name - } - **❯ Server Join Date:** ${joindate} \nSince ${joined} day(s) ago - **❯ Roles [${roles.length}]:** ${ - roles.length < 10 - ? roles.join(" **|** ") - : roles.length > 10 - ? utils.trimArray(roles) - : "None" - } - \u200b` - ); + **❯ Time Created:** ${createDateFormatted} \nSince ${created} day(s) ago + \u200b`, + }, + { + name: "Member", + value: `**❯ Highest Role:** ${ + member.roles.highest.id === interaction.guild.id + ? "None" + : member.roles.highest.name + } + **❯ Server Join Date:** ${joinDateFormatted} \nSince ${joined} day(s) ago + **❯ Roles [${roles.length}]:** ${ + roles.length < 10 + ? roles.join(" **|** ") + : roles.length > 10 + ? utils.trimArray(roles) + : "None" + } + \u200b`, + }, + ]); interaction.followUp({ embeds: [embed] }); }, }; diff --git a/command/Owner/blacklist.js b/command/Owner/blacklist.js @@ -41,7 +41,7 @@ module.exports = { .setColor(client.color) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp(); interaction.followUp({ embeds: [embed] }); @@ -56,7 +56,7 @@ module.exports = { .setColor(client.color) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp(); interaction.followUp({ embeds: [embed] }); diff --git a/command/Owner/eval.js b/command/Owner/eval.js @@ -47,9 +47,7 @@ module.exports = { evaled = err; } if (typeof evaled !== "string") evaled = require("util").inspect(evaled); - console.log(evaled); evaled = chunk([evaled], 750); - console.log(evaled); let reactions = ["❌", "⏪", "◀️", "⏹️", "▶️", "⏩"], page = 0, evaledEmbed = new Discord.EmbedBuilder() diff --git a/command/Owner/guilds.js b/command/Owner/guilds.js @@ -19,21 +19,25 @@ module.exports = { .setTitle("Guilds") .setDescription(description) .setColor(client.color) - .addFields( + .addFields([ { name: `Total Guilds`, - value: client.guilds.cache.size, + value: client.guilds.cache.size + ? client.guilds.cache.size.toString() + : "0", inline: true, }, { name: `Total Members`, - value: client.users.cache.size, + value: client.users.cache.size + ? client.users.cache.size.toString() + : "0", inline: true, - } - ) + }, + ]) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp(); interaction.followUp({ embeds: [embed] }); diff --git a/command/Utilities/invite.js b/command/Utilities/invite.js @@ -9,22 +9,26 @@ module.exports = { const embed = new EmbedBuilder() .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setColor(client.color) .setTimestamp() .setAuthor({ - text: interaction.user.tag, + name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ dynamic: true }), }) .setTitle(`Support/Invite`) .setThumbnail( "https://github.com/night0721/cath.js/blob/master/util/assets/images/nyx_logo_transparent.webp" ) - .addField( - "<a:booster:896527475063025704> **Premium**", - "**You can either boost support server or subscribe to developer's team [Ko-Fi](https://ko-fi.com/cathteam) or gift a nitro to one of the developer team.**" - ); + .addFields([ + { + name: "<a:booster:896527475063025704> **Premium**", + value: + "**You can either boost support server or subscribe to developer's team [Ko-Fi](https://ko-fi.com/cathteam) or gift a nitro to one of the developer team.**", + inline: true, + }, + ]); interaction.followUp({ content: "Please click the buttons below for more information", embeds: [embed], diff --git a/command/Utilities/poll.js b/command/Utilities/poll.js @@ -53,16 +53,20 @@ module.exports = { .setColor("Red") .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp(); + let fields = []; for (let i = 0; i < args.length - 1; i++) { - pollCreateEmbed.addField( - "‎", - `:regional_indicator_${String.fromCharCode(97 + i)}: ${args[i + 1]} - ` - ); + fields.push({ + name: "‎", + value: `:regional_indicator_${String.fromCharCode(97 + i)}: ${ + args[i + 1] + } + `, + }); } + pollCreateEmbed.addFields(fields); let embedMessage = await interaction.followUp({ embeds: [pollCreateEmbed], }); diff --git a/command/Utilities/report.js b/command/Utilities/report.js @@ -4,7 +4,6 @@ module.exports = { name: "report", description: "Report a bug of the bot", category: "Utilities", - options: [ { type: 3, @@ -14,7 +13,6 @@ module.exports = { }, ], run: async (client, interaction, args) => { - const bug = args[0]; interaction.followUp({ embeds: [ new EmbedBuilder() @@ -24,23 +22,22 @@ module.exports = { ) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .setColor("Green"), ], }); - const ch = client.channels.cache.get(client.config.Report); - ch.send({ + client.channels.cache.get(client.config.Report).send({ embeds: [ new EmbedBuilder() - .setAuthor( - interaction.user.tag, - interaction.user.displayAvatarURL({ dynamic: true }) - ) + .setAuthor({ + name: interaction.user.tag, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }), + }) .setTitle("New Bug") - .setDescription(bug) - .setColor("ORANGE") + .setDescription(args[0]) + .setColor("Orange") .setTimestamp(), ], }); diff --git a/command/Utilities/suggest.js b/command/Utilities/suggest.js @@ -3,92 +3,42 @@ module.exports = { name: "suggest", description: "Make a suggestion of the bot", category: "Utilities", - + options: [ + { + type: 3, + name: "suggestion", + description: "The suggestion", + required: true, + }, + ], run: async (client, interaction, args) => { - const questions = [ - "Describe the suggestion", - // "question 2" - ]; - let collectCounter = 0; - let endCounter = 0; - const filter = m => m.author.id === interaction.user.id; - interaction.followUp("Check your dm."); - const appStart = await interaction.user.send({ + client.channels.cache.get(client.config.Suggestion).send({ embeds: [ new EmbedBuilder() - .setAuthor( - interaction.user.username, - interaction.user.displayAvatarURL() + .setAuthor({ + name: interaction.user.tag, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }), + }) + .setTitle("New Suggestion") + .setDescription(args[0]) + .setColor("Orange") + .setTimestamp(), + ], + }); + interaction.followUp({ + embeds: [ + new EmbedBuilder() + .setTitle("SUCCESS!") + .setDescription( + "You have sent a suggestion.\nPlease wait for us to review it" ) - .setDescription(questions[collectCounter++]) + .setColor("Green") .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp(), ], }); - const channel = appStart.channel; - const collector = channel.createMessageCollector({ filter }); - collector.on("collect", () => { - if (collectCounter < questions.length) { - channel.send({ - embeds: [ - new EmbedBuilder() - .setAuthor( - interaction.user.username, - interaction.user.displayAvatarURL() - ) - .setDescription(questions[collectCounter++]) - .setFooter({ - text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), - }) - .setTimestamp(), - ], - }); - } else { - channel.send({ - embeds: [ - new EmbedBuilder() - .setTitle("SUCCESS!") - .setDescription( - "You have sent a suggestion.\nPlease wait for us to review it" - ) - .setColor("Green") - .setFooter({ - text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), - }) - .setTimestamp(), - ], - }); - collector.stop("fulfilled"); - } - }); - const appsChannel = client.channels.cache.get(client.config.Config); - collector.on("end", (collected, reason) => { - if (reason === "fulfilled") { - const mapedResponses = collected - .map(msg => { - return `${questions[endCounter++]}**\n->** ${msg.content}`; - }) - .join("\n\n"); - - appsChannel.send({ - embeds: [ - new EmbedBuilder() - .setAuthor( - interaction.user.tag, - interaction.user.displayAvatarURL({ dynamic: true }) - ) - .setTitle("New Suggestion") - .setDescription(mapedResponses) - .setColor("ORANGE") - .setTimestamp(), - ], - }); - } - }); }, }; diff --git a/events/emoji.js b/events/emoji.js @@ -13,7 +13,7 @@ client.on("messageCreate", async message => { if (message.content.startsWith(":") && message.content.endsWith(":")) { const EmojiName = message.content.slice(1, -1); if (client.path.includes(message.guild.id)) return; - if (Check(EmojiName) === true) { + if (Check(EmojiName)) { const channel = client.channels.cache.get(message.channel.id); try { if (message.author.bot) return; @@ -22,7 +22,7 @@ client.on("messageCreate", async message => { if (webhook === undefined || null || !webhook) { channel .createWebhook(client.user.username, { - avatar: client.user.displayAvatarURL(), + avatar: client.user.displayAvatarURL({ dynamic: true }), }) .then(async w => { const emoji = @@ -42,7 +42,7 @@ client.on("messageCreate", async message => { client.emojis.cache.find(e => e.name == EmojiName).id || message.guild.emojis.cache.find(e => e.name === EmojiName).id; - await webhook.send(`${client.emojis.cache.get(emoji)}`, { + await webhook.send(client.emojis.cache.get(emoji), { username: message.author.username, avatarURL: message.author.displayAvatarURL({ dynamic: true }), }); @@ -50,10 +50,6 @@ client.on("messageCreate", async message => { } catch (e) { console.log(e); } - } else { - return; } - } else { - return; } }); diff --git a/events/guild.js b/events/guild.js @@ -14,7 +14,7 @@ client.on("guildCreate", guild => { }) .setFooter({ text: `${client.user.username} Currently in ${client.guilds.cache.size} servers`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .setThumbnail(guild.iconURL({ dynamic: true })) @@ -42,7 +42,7 @@ client.on("guildDelete", async guild => { }) .setFooter({ text: `${client.user.username} Currently in ${client.guilds.cache.size} servers`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .setThumbnail(guild.iconURL({ dynamic: true })) diff --git a/events/interactionCreate.js b/events/interactionCreate.js @@ -40,12 +40,9 @@ client.on("interactionCreate", async interaction => { if (!guildDB) return; const userDB = await client.data.getUser(interaction.user.id); if (!userDB) return; - // const userEconDB = await client.data.getUserEcon(interaction.user.id); data.Guild = guildDB; data.User = userDB; - // data.UserEcon = userEconDB; if (!guildDB) await client.data.CreateGuild(interaction.guild.id); - //if (!userEconDB) await client.createProfile(interaction.user.id); if (data.User) { if (data.User.Blacklist) { return interaction.followUp({ @@ -74,7 +71,7 @@ client.on("interactionCreate", async interaction => { .setTimestamp() .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }), ], }); @@ -110,13 +107,6 @@ client.on("interactionCreate", async interaction => { } } } - const random = utils.rndint(3, 6); - if (cmd.name == "nsfw" && !data.Guild?.NSFW) { - interaction.followUp({ - content: "NSFW commands have been disabled in this server", - }); - return; - } if (cmd.timeout) { const current_time = Date.now(); const cooldown_amount = cmd.timeout; @@ -141,7 +131,6 @@ client.on("interactionCreate", async interaction => { client.channels.cache.get(client.config.CMDLog).send({ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``, }); - // await client.addXP(interaction.user.id, random, interaction); } } else { if (data.Guild.Tips) utils.tips(interaction, client); @@ -152,7 +141,6 @@ client.on("interactionCreate", async interaction => { content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``, }); // client.addcmdsused(interaction.user.id); - // await client.addXP(interaction.user.id, random, interaction); new cooldown({ User: interaction.user.id, CMD: cmd.name, @@ -170,8 +158,6 @@ client.on("interactionCreate", async interaction => { client.channels.cache.get(client.config.CMDLog).send({ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``, }); - // client.addcmdsused(interaction.user.id); - // await client.addXP(interaction.user.id, random, interaction); } } if (interaction.isContextMenuCommand()) { @@ -205,10 +191,10 @@ client.on("interactionCreate", async interaction => { client.channels.cache.get(client.config.CMDLog).send({ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${ownercmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``, }); - //client.addcmdsused(interaction.user.id); } }); function sendE(e, i) { + console.error(e.stack); const embed = new EmbedBuilder() .setTitle("Command Error") .setDescription(`\`\`\`yaml\n${e.stack}\`\`\``) diff --git a/events/messageCreate.js b/events/messageCreate.js @@ -1,6 +1,6 @@ const client = require(".."); const { EmbedBuilder } = require("discord.js"); -const utils = require("../util/functions/function"); +const Utils = require("../util/functions/function"); const domains = require("../util/Data/domains.json"); client.on("messageCreate", async message => { if (message.author.bot || !message.guild) return; @@ -22,7 +22,7 @@ client.on("messageCreate", async message => { }, { name: ":link: **Invite Me**", - value: `[Click Here](https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands)`, + value: `[Click Here](${Utils.inviteLink(client)})`, inline: true, }, { @@ -53,11 +53,11 @@ client.on("messageCreate", async message => { ) .setTitle(client.user.username) - .setThumbnail(client.user.displayAvatarURL()) + .setThumbnail(client.user.displayAvatarURL({ dynamic: true })) .setURL(client.web) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .setColor(client.color); @@ -125,7 +125,7 @@ client.on("messageCreate", async message => { ) .setFooter({ text: `Tactical Protection by ${client.author}`, - icon_url: client.user.displayAvatarURL(), + icon_url: client.user.displayAvatarURL({ dynamic: true }), }); message.channel.send({ embeds: [_], @@ -164,7 +164,7 @@ client.on("messageCreate", async message => { .addFields( { name: ":link: **Invite Me**", - value: `[Click Here](https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands)`, + value: `[Click Here](${Utils.inviteLink(client.user.id)})`, inline: true, }, { diff --git a/events/typingStart.js b/events/typingStart.js @@ -1,9 +1,13 @@ +const { ChannelType } = require("discord.js"); const client = require(".."); client.on("typingStart", async typing => { - if (!typing.user) return; - if (typing.user.bot) return; - if (!typing.channel) return; - if (typing.channel.type !== "DM") return; + if ( + !typing.user || + typing.user.bot || + !typing.channel || + typing.channel.type != ChannelType.DM + ) + return; typing.user.send({ content: "```DMs is reserved for bug reports/suggestions/feedbacks/queries and is forwarded to the developers. Please refrain from using it as a clipboard or trying to run commands in here [by violating this condition, you agree to let us sell your data]```", diff --git a/package.json b/package.json @@ -42,7 +42,7 @@ "dependencies": { "axios": "^1.1.3", "cath": "^1.5.0", - "discord.js": "^14.6.0", + "discord.js": "^14.9.0", "dotenv": "^16.0.3", "goosecache": "^9.0.14", "moment": "^2.29.4", diff --git a/start.bat b/start.bat @@ -1,3 +0,0 @@ -title cath -node . -pause -\ No newline at end of file diff --git a/util/Data/domains.json b/util/Data/domains.json @@ -4171,14 +4171,5 @@ "herald.sbs", "locations.quest" ], - "ngrok": [ - "localhost:8888", - "localhost:8000", - "localhost:8080", - "localhost:3000", - "127.0.0.1:4040", - "127.0.0.1:8000", - "127.0.0.1:8080", - "ngrok.io" - ] + "ngrok": ["ngrok.io"] } diff --git a/util/Data/tnd.json b/util/Data/tnd.json @@ -1,90 +0,0 @@ -{ - "truth": [ - "When was the last time you lied?", - "When was the last time you cried?", - "What's your biggest fear?", - "What's your biggest fantasy?", - "Do you have any fetishes?", - "What's something you're glad your mum doesn't know about you?", - "Have you ever cheated on someone?", - "What's the worst thing you've ever done?", - "What's a secret you've never told anyone?", - "Do you have a hidden talent?", - "Who was your first celebrity crush?", - "What are your thoughts on polyamory?", - "What's the worst intimate experience you've ever had?", - "What's the best intimate experience you've ever had?", - "Have you ever cheated in an exam?", - "What's the most drunk you've ever been?", - "Have you ever broken the law?", - "What's the most embarrassing thing you've ever done?", - "What's your biggest insecurity?", - "Have you ever stayed friends with someone because it benefitted you beyond just the friendship?", - "What's the biggest mistake you've ever made?", - "What's the most disgusting thing you've ever done?", - "Who would you like to kiss in this room?", - "What's one thing you hate people knowing about you?", - "What's the worst thing anyone's ever done to you?", - "What's the best thing anyone's ever done for you?", - "Have you ever had a run in with the law?", - "What's your worst habit?", - "What's the most embarrassing thing you've done in a taxi?", - "What's the worst thing you've ever said to anyone?", - "Have you ever peed in the shower?", - "What's the strangest dream you've had?", - "Have you ever been caught doing something you shouldn't have?", - "What's the worst date you've been on?", - "What's the best date you've been on?", - "What happened on the latest night out you've ever had?", - "What's your biggest regret?", - "What's the biggest misconception about you?", - "Have you ever said something you regret about someone in this room?", - "What's one thing you wish people knew about you?", - "Where's the weirdest place you've had sex?", - "Why did your last relationship break down?", - "Have you ever lied to get out of a bad date?", - "What's the most trouble you've been in?", - "When did you last have sex outside?", - "What's the worst thing you've lied about?", - "What's one thing you wish you'd lied about?", - "What's the best piece of advice you've been given?", - "What's the most you've spent on a night out?", - "Name a time you think you were a bad partner", - "What's your guilty pleasure?", - "What's one thing you only do when you're alone?", - "If you had to get back with an ex, who would you choose?", - "If you had to cut one friend out of your life, who would it be?", - "Do you have a favourite friend?", - "Do you have a favourite sibling?", - "What's the strangest rumour you've heard about yourself?", - "What's your biggest turn on?", - "What's the silliest reason you've left a club early?", - "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?" - ], - "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 haven’t 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 don’t like her so you can’t be with her anymore.", - "Brush your teeth with your best friend’s 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 crush’s picture as your FB profile picture.", - "Show everyone your search history for the past week." - ] -} diff --git a/util/Data/wyr.json b/util/Data/wyr.json @@ -1,127 +0,0 @@ -[ - "Would you rather always be 10 minutes late or always be 20 minutes early?", - "Would you rather lose all of your money and valuables or all of the pictures you have ever taken?", - "Would you rather be able to see 10 minutes into your own future or 10 minutes into the future of anyone but yourself?", - "Would you rather be famous when you are alive and forgotten when you die or unknown when you are alive but famous after you die?", - "Would you rather go to jail for 4 years for something you didn't do or get away with something horrible you did but always live in fear of being caught?", - "Would you rather accidentally be responsible for the death of a child or accidentally be responsible for the deaths of three adults?", - "Would you rather your shirts be always two sizes too big or one size too small?", - "Would you rather live in the wilderness far from civilization or live on the streets of a city as a homeless person?", - "Would you rather the general public think you are a horrible person but your family be very proud of you or your family think you are a horrible person but the general public be very proud of you?", - "Would you rather live your entire life in a virtual reality where all your wishes are granted or in the real world?", - "Would you rather be alone for the rest of your life or always be surrounded by annoying people?", - "Would you rather never use social media sites / apps again or never watch another movie or TV show?", - "Would you rather have an easy job working for someone else or work for yourself but work incredibly hard?", - "Would you rather be the first person to explore a planet or be the inventor of a drug that cures a deadly disease?", - "Would you rather have a horrible short term memory or a horrible long term memory?", - "Would you rather be completely invisible for one day or be able to fly for one day?", - "Would you rather be locked in a room that is constantly dark for a week or a room that is constantly bright for a week?", - "Would you rather be poor but help people or become incredibly rich by hurting people?", - "Would you rather live without the internet or live without AC and heating?", - "Would you rather have a horrible job, but be able to retire comfortably in 10 years or have your dream job, but have to work until the day you die?", - "Would you rather find your true love or a suitcase with five million dollars inside?", - "Would you rather be able to teleport anywhere or be able to read minds?", - "Would you rather die in 20 years with no regrets or die in 50 years with many regrets?", - "Would you rather be feared by all or loved by all?", - "Would you rather know when you are going to die or how you are going to die? (You can't change the time or method of your death.)", - "Would you rather be transported permanently 500 years into the future or 500 years into the past?", - "Would you rather never be able to use a touchscreen or never be able to use a keyboard and mouse?", - "Would you rather be able to control fire or water?", - "Would you rather have everything you eat be too salty or not salty enough no matter how much salt you add?", - "Would you rather have hands that kept growing as you got older or feet that kept growing as you got older?", - "Would you rather have unlimited sushi for life or unlimited tacos for life? (both are amazingly delicious and can be any type of sushi / taco you want)", - "Would you rather be unable to use search engines or unable to use social media?", - "Would you rather give up bathing for a month or give up the internet for a month?", - "Would you rather donate your body to science or donate your organs to people who need them?", - "Would you rather go back to age 5 with everything you know now or know now everything your future self will learn?", - "Would you rather relive the same day for 365 days or lose a year of your life?", - "Would you rather have a golden voice or a silver tongue?", - "Would you rather be able to control animals (but not humans) with your mind or control electronics with your mind?", - "Would you rather suddenly be elected a senator or suddenly become a CEO of a major company. (You won't have any more knowledge about how to do either job than you do right now.)", - "Would you rather sell all of your possessions or sell one of your organs?", - "Would you rather lose all of your memories from birth to now or lose your ability to make new long term memories?", - "Would you rather be infamous in history books or be forgotten after your death?", - "Would you rather never have to work again or never have to sleep again (you won't feel tired or suffer negative health effects)?", - "Would you rather be beautiful / handsome but stupid or intelligent but ugly?", - "Would you rather get one free round trip international plane ticket every year or be able to fly domestic anytime for free?", - "Would you rather be balding but fit or overweight with a full head of hair?", - "Would you rather be able to be free from junk mail or free from email spam for the rest of your life?", - "Would you rather be fluent in all languages and never be able to travel or be able to travel anywhere for a year but never be able to learn a word of a different language?", - "Would you rather have an unlimited international first class ticket or never have to pay for food at restaurants?", - "Would you rather see what was behind every closed door or be able to guess the combination of every safe on the first try?", - "Would you rather live in virtual reality where you are all powerful or live in the real world and be able to go anywhere but not be able to interact with anyone or anything?", - "Would you rather never be able to eat meat or never be able to eat vegetables?", - "Would you rather give up watching TV / movies for a year or give up playing games for a year?", - "Would you rather always be able to see 5 minutes into the future or always be able to see 100 years into the future?", - "Would you rather super sensitive taste or super sensitive hearing?", - "Would you rather be a practicing doctor or a medical researcher?", - "Would you rather be married to a 10 with a bad personality or a 6 with an amazing personality?", - "Would you rather never be able to drink sodas like coke again or only be able to drink sodas and nothing else?", - "Would you rather have amazingly fast typing / texting speed or be able to read ridiculously fast?", - "Would you rather know the history of every object you touched or be able to talk to animals?", - "Would you rather be a reverse centaur or a reverse mermaid/merman?", - "Would you rather have constantly dry eyes or a constant runny nose?", - "Would you rather be a famous director or a famous actor?", - "Would you rather not be able to open any closed doors (locked or unlocked) or not be able to close any open doors?", - "Would you rather give up all drinks except for water or give up eating anything that was cooked in an oven?", - "Would you rather be constantly tired no matter how much you sleep or constantly hungry no matter what you eat? Assuming that there are no health problems besides the feeling of hunger and sleepiness.", - "Would you rather have to read aloud every word you read or sing everything you say out loud?", - "Would you rather have whatever you are thinking appear above your head for everyone to see or have absolutely everything you do live streamed for anyone to see?", - "Would you rather be put in a maximum security federal prison with the hardest of the hardened criminals for one year or be put in a relatively relaxed prison where wall street types are held for ten years?", - "Would you rather have a clown only you can see that follows you everywhere and just stands silently in a corner watching you without doing or saying anything or have a real life stalker who dresses like the Easter bunny that everyone can see?", - "Would you rather kill one innocent person or five people who committed minor crimes?", - "Would you rather have a completely automated home or a self-driving car?", - "Would you rather work very hard at a rewarding job or hardly have to work at a job that isn't rewarding?", - "Would you rather be held in high regard by your parents or your friends?", - "Would you rather be an amazing painter or a brilliant mathematician?", - "Would you rather be reincarnated as a fly or just cease to exist after you die?", - "Would you rather be able to go to any theme park in the world for free for the rest of your life or eat for free at any drive through restaurant for the rest of your life?", - "Would you rather be only able to watch the few movies with a rotten tomatoes score of 95-100% or only be able to watch the majority of movies with a rotten tomatoes score of 94% and lower?", - "Would you rather never lose your phone again or never lose your keys again?", - "Would you rather have one real get out of jail free card or a key that opens any door?", - "Would you rather have a criminal justice system that actually works and is fair or an administrative government that is free of corruption?", - "Would you rather have real political power but be relatively poor or be ridiculously rich and have no political power?", - "Would you rather have the power to gently nudge anyone's decisions or have complete puppet master control of five people?", - "Would you rather have everyone laugh at your jokes but not find anyone else's jokes funny or have no one laugh at your jokes but you still find other people's jokes funny?", - "Would you rather be the absolute best at something that no one takes seriously or be well above average but not anywhere near the best at something well respected?", - "Would you rather lose the ability to read or lose the ability to speak?", - "Would you rather live under a sky with no stars at night or live under a sky with no clouds during the day?", - "Would you rather humans go to the moon again or go to mars?", - "Would you rather never get angry or never be envious?", - "Would you rather have free Wi-Fi wherever you go or be able to drink unlimited free coffee at any coffee shop?", - "Would you rather be compelled to high five everyone you meet or be compelled to give wedgies to anyone in a green shirt?", - "Would you rather live in a house with see-through walls in a city or in the same see-though house but in the middle of a forest far from civilization?", - "Would you rather take amazing selfies but all of your other pictures are horrible or take breathtaking photographs of anything but yourself?", - "Would you rather use a push lawn mower with a bar that is far too high or far too low?", - "Would you rather be able to dodge anything no matter how fast it's moving or be able ask any three questions and have them answered accurately?", - "Would you rather live on the beach or in a cabin in the woods?", - "Would you rather lose your left hand or right foot?", - "Would you rather face your fears or forget that you have them?", - "Would you rather be forced to dance every time you heard music or be forced to sing along to any song you heard?", - "Would you rather have skin that changes color based on your emotions or tattoos appear all over your body depicting what you did yesterday?", - "Would you rather live in a utopia as a normal person or in a dystopia but you are the supreme ruler?", - "Would you rather snitch on your best friend for a crime they committed or go to jail for the crime they committed?", - "Would you rather have everything on your phone right now (browsing history, photos, etc.) made public to anyone who Google's your name or never use a cell phone again?", - "Would you rather eat a box of dry spaghetti noodles or a cup of uncooked rice?", - "Would you rather wake up as a new random person every year and have full control of them for the whole year or once a week spend a day inside a stranger without having any control of them?", - "Would you rather be born again in a totally different life or born again with all the knowledge you have now?", - "Would you rather be lost in a bad part of town or lost in the forest?", - "Would you rather never get a paper cut again or never get something stuck in your eye again?", - "Would you rather lose your passport or lose your wallet?", - "Would you rather randomly time travel +/- 20 years every time you fart or teleport to a different place on earth (on land, not water) every time you sneeze?", - "Would you rather the aliens that make first contact be robotic or organic?", - "Would you rather be famous but ridiculed or be just a normal person?", - "Would you rather be an amazing virtuoso at any instrument but only if you play naked or be able to speak any language but only if close your eyes and dance while you are doing it?", - "Would you rather have a flying carpet or a car that can drive underwater?", - "Would you rather be an amazing artist but not be able to see any of the art you created or be an amazing musician but not be able to hear any of the music you create?", - "Would you rather there be a perpetual water balloon war going on in your city / town or a perpetual food fight?", - "Would you rather find five dollars on the ground or find all of your missing socks?", - "Would you rather never have another embarrassing fall in public or never feel the need to pass gas in public again?", - "Would you rather be able to talk to land animals, animals that fly, or animals that live under the water?", - "Would you rather lose your best friend or all of your friends except for your best friend?", - "Would you rather it be impossible for you to be woken up for 11 straight hours every day but you wake up feeling amazing or you can be woken up normally but never feel totally rested?", - "Would you rather find true love today or win the lottery next year?", - "Would you rather be forced to sing along or dance to every single song you hear?", - "Would you rather team up with Wonder Woman or Captain Marvel?", - "Would you rather cuddle a koala or pal around with a panda?" -] -\ No newline at end of file diff --git a/util/functions/function.js b/util/functions/function.js @@ -1,7 +1,48 @@ -const { EmbedBuilder, MessageActionRow, MessageButton } = require("discord.js"); +const { + EmbedBuilder, + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, +} = require("discord.js"); +/** + * Returns a random element from an array + * @returns {any} + */ +Array.prototype.random = function () { + return this[~~(Math.random() * this.length)]; +}; function rndint(max, min) { return Math.floor(Math.random() * (max - (min ? min : 0))) + (min ? min : 0); } +function parseDate(date) { + const months = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ]; + let dow = date.getDate().toString(); + return `${date.toLocaleDateString("en-US", { + weekday: "long", + })}, ${months[date.getMonth() - 1]} ${ + dow.endsWith("1") + ? `${dow}st` + : dow.endsWith("2") + ? `${dow}nd` + : dow.endsWith("3") + ? `${dow}rd` + : `${dow}th` + } ${date.getFullYear()}, ${date.toLocaleTimeString()}`; +} + function timer(timestamp) { const timeLeft = timestamp; const days = Math.floor(timeLeft / 86400000); @@ -421,7 +462,7 @@ function tips(interaction, client) { .setDescription(`**💡 Did you know**\n${rTip}`) .setFooter({ text: `Made by ${client.author}`, - iconURL: client.user.displayAvatarURL(), + iconURL: client.user.displayAvatarURL({ dynamic: true }), }) .setTimestamp() .setURL(client.web), @@ -429,35 +470,36 @@ function tips(interaction, client) { }); } } +function inviteLink(client_id) { + return `https://discord.com/oauth2/authorize?client_id=${client_id}&permissions=1512097384560&scope=bot%20applications.commands`; +} function buttons(client) { - const invite = new MessageButton() + const invite = new ButtonBuilder() .setLabel("Invite the bot!") - .setStyle("LINK") + .setStyle(ButtonStyle.Link) .setEmoji("896527406100283462") - .setURL( - `https://discord.com/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands` - ); - const support = new MessageButton() + .setURL(inviteLink(client.user.id)); + const support = new ButtonBuilder() .setLabel("Support Server") - .setStyle("LINK") + .setStyle(ButtonStyle.Link) .setEmoji("867093614403256350") - .setURL("https://discord.gg/SbQHChmGcp"); - const website = new MessageButton() + .setURL(client.invite); + const website = new ButtonBuilder() .setLabel("Website") - .setStyle("LINK") + .setStyle(ButtonStyle.Link) .setEmoji("🖥") - .setURL("https://cath.gq/"); - const youtube = new MessageButton() + .setURL(client.web); + const youtube = new ButtonBuilder() .setLabel("YouTube") - .setStyle("LINK") + .setStyle(ButtonStyle.Link) .setEmoji("841186450497339412") .setURL("https://youtube.com/Kirito01"); - const kofi = new MessageButton() + const kofi = new ButtonBuilder() .setLabel("Ko-fi") - .setStyle("LINK") + .setStyle(ButtonStyle.Link) .setEmoji("900590344364757013") .setURL("https://ko-fi.com/cathteam"); - const row = new MessageActionRow().addComponents( + const row = new ActionRowBuilder().addComponents( invite, support, website, @@ -751,6 +793,7 @@ function convert(value, unit, unitValues) { module.exports = { rndint, + parseDate, timer, sleep, toHHMMSS, @@ -767,6 +810,7 @@ module.exports = { getAllTextFromEmbed, clean, tips, + inviteLink, buttons, colorize, leven,