nyx

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

commit 4b80768a8f50e2eea82f0d81dec445c9d91660f1
parent 3b46b57862d51fea1079bcb9f3c1703a02a2094b
Author: night0721 <[email protected]>
Date:   Thu, 24 Jun 2021 15:53:19 +0800

Updated configs and added api

Diffstat:
A.gitattributes | 2++
Aapi/app.js | 20++++++++++++++++++++
Aapi/routes/commands.js | 8++++++++
Aapi/routes/routes.js | 4++++
Mcat/Path/fantastic.js | 6+-----
Mcat/Path/fight.js | 11+++++------
Mcat/Path/gae.js | 6+-----
Mcat/Path/gg.js | 6+-----
Mcat/Path/how.js | 6+-----
Mcat/Path/nab.js | 6+-----
Mcat/Path/pp.js | 8++------
Mcommands/Config/check.js | 5-----
Mcommands/Config/choices.js | 5-----
Mcommands/Config/cmd-list.js | 5-----
Mcommands/Config/create.js | 5-----
Mcommands/Config/delete.js | 5-----
Mcommands/Config/disable.js | 5-----
Mcommands/Config/enable.js | 5-----
Mcommands/Config/migrate.js | 5-----
Mcommands/Config/modmail-category.js | 5-----
Mcommands/Config/modmail-role.js | 5-----
Mcommands/Config/panel.js | 5-----
Mcommands/Config/prefix-reset.js | 5-----
Mcommands/Config/prefix.js | 5-----
Mcommands/Config/premium.js | 5-----
Mcommands/Config/rr-add.js | 5-----
Mcommands/Config/rr-rmv.js | 5-----
Mcommands/Config/set.js | 22++++++++++++++++------
Mcommands/Economy/bal.js | 5-----
Mcommands/Economy/bet.js | 25++++++++++++++-----------
Mcommands/Economy/buy.js | 7+------
Mcommands/Economy/daily.js | 9++-------
Mcommands/Economy/drop.js | 5-----
Mcommands/Economy/gift.js | 7+------
Mcommands/Economy/give.js | 5-----
Mcommands/Economy/inv.js | 7+------
Mcommands/Economy/lb.js | 5-----
Mcommands/Economy/shop.js | 9++-------
Mcommands/Economy/slots.js | 8+-------
Mcommands/Economy/steal.js | 5-----
Mcommands/Economy/work.js | 5-----
Acommands/Fun/8ball.js | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcommands/Fun/cat.js | 5-----
Mcommands/Fun/coinflip.js | 8++------
Mcommands/Fun/connect4.js | 5-----
Mcommands/Fun/dog.js | 5-----
Mcommands/Fun/drake.js | 6+-----
Acommands/Fun/ds.js | 18++++++++++++++++++
Mcommands/Fun/hangman.js | 5-----
Acommands/Fun/hexcolor.js | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcommands/Fun/hug.js | 5-----
Mcommands/Fun/kiss.js | 5-----
Mcommands/Fun/meme.js | 5-----
Acommands/Fun/quote.js | 41+++++++++++++++++++++++++++++++++++++++++
Acommands/Fun/rickroll.js | 30++++++++++++++++++++++++++++++
Mcommands/Fun/say.js | 5-----
Mcommands/Fun/simprate.js | 5-----
Acommands/Fun/sr.js | 15+++++++++++++++
Acommands/Fun/triggered.js | 18++++++++++++++++++
Mcommands/Giveaway/end.js | 5-----
Mcommands/Giveaway/giveaway.js | 7+------
Mcommands/Giveaway/reroll.js | 5-----
Mcommands/Moderation/announce.js | 5-----
Mcommands/Moderation/ban.js | 5-----
Mcommands/Moderation/clear.js | 5-----
Mcommands/Moderation/clearWarns.js | 5-----
Mcommands/Moderation/kick.js | 5-----
Mcommands/Moderation/lock.js | 5-----
Mcommands/Moderation/mute.js | 5-----
Mcommands/Moderation/nuke.js | 5-----
Mcommands/Moderation/pin.js | 5-----
Mcommands/Moderation/removeWarn.js | 5-----
Mcommands/Moderation/role.js | 5-----
Mcommands/Moderation/slowmode.js | 5-----
Mcommands/Moderation/unban.js | 5-----
Mcommands/Moderation/unlock.js | 5-----
Mcommands/Moderation/unmute.js | 5-----
Mcommands/Moderation/warn.js | 5-----
Mcommands/Moderation/warns.js | 5-----
Mcommands/Music/leave.js | 9++-------
Mcommands/Music/loop.js | 5-----
Mcommands/Music/lyrics.js | 7+------
Mcommands/Music/nowplaying.js | 5-----
Mcommands/Music/pause.js | 5-----
Mcommands/Music/play.js | 5-----
Mcommands/Music/playlist.js | 5-----
Mcommands/Music/queue.js | 7+------
Mcommands/Music/remove.js | 7+------
Mcommands/Music/resume.js | 6+-----
Mcommands/Music/shuffle.js | 5-----
Mcommands/Music/skip.js | 5-----
Mcommands/Music/skipto.js | 5-----
Mcommands/Music/stop.js | 5-----
Mcommands/Music/volume.js | 5-----
Mcommands/Owner/accept.js | 6------
Mcommands/Owner/add.js | 5-----
Mcommands/Owner/blacklist.js | 5-----
Acommands/Owner/cls.js | 10++++++++++
Mcommands/Owner/deny.js | 6------
Mcommands/Owner/dm.js | 5-----
Mcommands/Owner/encrypt.js | 5-----
Mcommands/Owner/eval.js | 5-----
Mcommands/Owner/getinvite.js | 5-----
Mcommands/Owner/guilds.js | 7+------
Mcommands/Owner/premium.js | 5-----
Mcommands/Owner/reaction-role.js | 9++-------
Mcommands/Owner/restart.js | 14++++----------
Mcommands/Owner/rmv.js | 5-----
Mcommands/Owner/setBotAvatar.js | 5-----
Mcommands/Owner/status.js | 5-----
Mcommands/Owner/try.js | 11+++--------
Dcommands/Utilities/8ball.js | 61-------------------------------------------------------------
Mcommands/Utilities/afk.js | 7+------
Mcommands/Utilities/avatar.js | 7+------
Mcommands/Utilities/botinfo.js | 5-----
Mcommands/Utilities/choose.js | 5-----
Mcommands/Utilities/emoji.js | 5-----
Mcommands/Utilities/emojiadd.js | 27+++++++++++++++------------
Mcommands/Utilities/esnipe.js | 5-----
Mcommands/Utilities/help.js | 176++++++++++++++++++++++++++++---------------------------------------------------
Dcommands/Utilities/hexcolor.js | 84-------------------------------------------------------------------------------
Mcommands/Utilities/invite.js | 29++++++++++++++++++++---------
Mcommands/Utilities/permission.js | 5-----
Mcommands/Utilities/poll.js | 5-----
Acommands/Utilities/rank.js | 41+++++++++++++++++++++++++++++++++++++++++
Mcommands/Utilities/report.js | 5-----
Mcommands/Utilities/servericon.js | 5-----
Mcommands/Utilities/serverinfo.js | 5-----
Mcommands/Utilities/snipe.js | 8+-------
Mcommands/Utilities/suggest.js | 5-----
Dcommands/Utilities/support.js | 16----------------
Mcommands/Utilities/timer.js | 5-----
Mcommands/Utilities/userinfo.js | 35+++++++++++++++--------------------
Mconfig.json | 2+-
Mevents/afk.js | 5++---
Mevents/emoji.js | 9++++-----
Mevents/goodBye.js | 2+-
Mevents/guild.js | 2+-
Mevents/guildCreate.js | 5+++--
Mevents/guildDelete.js | 9+++++----
Mevents/level.js | 2+-
Aevents/log.js | 0
Mevents/message.js | 50+++++++++++++++++++++++++++++---------------------
Mevents/messageUpdate.js | 2+-
Mevents/messsageDelete.js | 2+-
Mevents/reactionroles.js | 2+-
Mevents/ready.js | 2+-
Mevents/slash.js | 4++--
Mindex.js | 124+++++++++----------------------------------------------------------------------
Mmodels/guilds.js | 7+++----
Mpackage-lock.json | 198++++++++++---------------------------------------------------------------------
Mpackage.json | 4+++-
Autil/dist/bash.sh | 25+++++++++++++++++++++++++
Autil/dist/cmds.js | 39+++++++++++++++++++++++++++++++++++++++
Autil/dist/err.js | 215+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Autil/dist/item.js | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dutil/err.js | 216-------------------------------------------------------------------------------
Mutil/functions/mongoose.js | 34++++++++++------------------------
Dutil/item.js | 68--------------------------------------------------------------------
Rutil/pagify.js -> util/pagination/pagify.js | 0
Rutil/pagination.js -> util/pagination/pagination.js | 0
161 files changed, 986 insertions(+), 1565 deletions(-)

diff --git a/.gitattributes b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/api/app.js b/api/app.js @@ -0,0 +1,20 @@ +const express = require("express"); +const app = express(); +const port = process.env.PORT || 3001; +const routes = require("./routes/routes"); +const client = require("../bot"); +client.on("ready", async () => { + var users = client.guilds.cache.reduce((a, b) => a + b.memberCount, 0); + var guilds = client.guilds.cache.size; + const caches = { + users: users, + guilds: guilds, + }; + app.use("/api", routes); + app.use("/client", async (req, res) => { + res.status(200).send(caches); + }); + app.listen(port, () => { + console.log(`Listen on PORT ${port}`); + }); +}); diff --git a/api/routes/commands.js b/api/routes/commands.js @@ -0,0 +1,8 @@ +const { cmds } = require("../../util/dist/cmds"); +const commands = cmds(); +const router = require("express").Router(); + +router.get("/", async (req, res) => { + res.status(200).send(commands); +}); +module.exports = router; diff --git a/api/routes/routes.js b/api/routes/routes.js @@ -0,0 +1,4 @@ +const router = require("express").Router(); +const cmds = require("./commands"); +router.use("/commands", cmds); +module.exports = router; diff --git a/cat/Path/fantastic.js b/cat/Path/fantastic.js @@ -2,11 +2,7 @@ const { Client, Message, MessageEmbed } = require("discord.js"); module.exports = { name: "fantastic", timeout: 60000, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + run: async (client, message, args) => { message.delete(); const player = args.join(" "); diff --git a/cat/Path/fight.js b/cat/Path/fight.js @@ -3,11 +3,7 @@ module.exports = { name: "fight", description: "Goooooooooooooooolag!", timeout: 15000, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + run: async (client, message, args) => { const gaes = [ "Gae", @@ -60,12 +56,15 @@ module.exports = { "a Bot", "locknload with 200 round RPD gae", "ros gae", + "Cath Gae", + "Cat drinking a cat gae", + "Night Gae", ]; const gae = gaes[Math.floor(Math.random() * gaes.length)]; const embed = new MessageEmbed() .setTitle("**Gulag Fight**") .setDescription( - `**${message.author}has taken a chance at redemption in The Gulag. \nYou fight only to find out that you're \`${gae}\`. If you somehow turned out to not be gae, DM an admin to get your timer halved ||only if your mute is less than 69m||**` + `**${message.author} has taken a chance at redemption in The Gulag. \nYou fight only to find out that you're \`${gae}\`. If you somehow turned out to not be gae, DM an admin to get your timer halved ||only if your mute is less than 69m||**` ) .setColor(5198940); message.channel.send(embed); diff --git a/cat/Path/gae.js b/cat/Path/gae.js @@ -2,11 +2,7 @@ const { Client, Message, MessageEmbed } = require("discord.js"); module.exports = { name: "gae", timeout: 15000, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + run: async (client, message, args) => { const MEE6 = [ "u = gae", diff --git a/cat/Path/gg.js b/cat/Path/gg.js @@ -2,11 +2,7 @@ const { Client, Message, MessageEmbed } = require("discord.js"); module.exports = { name: "gg", timeout: 15000, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + run: async (client, message, args) => { const GG = [ "**GIT GUD**", diff --git a/cat/Path/how.js b/cat/Path/how.js @@ -4,11 +4,7 @@ module.exports = { description: "Check how gae is the user", usage: "(User)", Path: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + run: async (client, message, args) => { const target = message.mentions.users.first() || message.author; if (target.id === "366562874039992331") { diff --git a/cat/Path/nab.js b/cat/Path/nab.js @@ -2,11 +2,7 @@ const { Client, Message, MessageEmbed } = require("discord.js"); module.exports = { name: "nab", timeout: 15000, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + run: async (client, message, args) => { const NAB = [ "stop being a nab, nab", diff --git a/cat/Path/pp.js b/cat/Path/pp.js @@ -3,11 +3,7 @@ module.exports = { name: "pp", description: "Check how long is the user", usage: "(User)", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + run: async (client, message, args) => { let user = message.mentions.users.first() || message.author; let embed = new MessageEmbed() @@ -18,7 +14,7 @@ module.exports = { .setColor(client.color) .setTitle("Peepee size machine") .setTimestamp() - .setFooter(`Made by Cath Team`); + .setFooter(`Made by ${client.author}`); message.inlineReply(embed); }, }; diff --git a/commands/Config/check.js b/commands/Config/check.js @@ -5,11 +5,6 @@ module.exports = { usage: "(goodbye/welcome/log) (Channel)", UserPerm: "ADMINISTRATOR", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const data = await client.data.getGuild(message.guild.id); if (!args[0]) return client.err(messgae, "Config", "check", 45); diff --git a/commands/Config/choices.js b/commands/Config/choices.js @@ -6,11 +6,6 @@ module.exports = { description: "Add choices for modmail in a server", usage: "(add/list/rmv) (Emoji) {Text}", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { schema.findOne({ Guild: message.guild.id }, async (err, data) => { if (data) return; diff --git a/commands/Config/cmd-list.js b/commands/Config/cmd-list.js @@ -6,11 +6,6 @@ module.exports = { UserPerm: "ADMINISTRATOR", description: "Check the custom commands in a server", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const data = await schema.find({ Guild: message.guild.id }); if (!!data === false) return client.err(messgae, "Config", "cmd-list", 10); diff --git a/commands/Config/create.js b/commands/Config/create.js @@ -6,11 +6,6 @@ module.exports = { UserPerm: "ADMINISTRATOR", description: "Crate custom commands for a server", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { message.delete(); message.channel.send( diff --git a/commands/Config/delete.js b/commands/Config/delete.js @@ -6,11 +6,6 @@ module.exports = { usage: "(command)", description: "Delete a custom command for a server", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const name = args[0]; if (!name) return client.err(message, "Config", "cc-delete", 47); diff --git a/commands/Config/disable.js b/commands/Config/disable.js @@ -6,11 +6,6 @@ module.exports = { usage: "(Command/Category) (Name)", description: "Disable a command in a server", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const type = args[0].toLowerCase(); if (!type) return client.err(message, "Config", "disable", 17); diff --git a/commands/Config/enable.js b/commands/Config/enable.js @@ -6,11 +6,6 @@ module.exports = { usage: "(Command) {Channel}", description: "Enable a command in a server", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const type = args[0].toLowerCase(); const name = args[1].toLowerCase(); diff --git a/commands/Config/migrate.js b/commands/Config/migrate.js @@ -4,11 +4,6 @@ module.exports = { usage: "(Server ID)", description: "Migrate all emojis from a server", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { const oldGuild = args[0]; diff --git a/commands/Config/modmail-category.js b/commands/Config/modmail-category.js @@ -7,11 +7,6 @@ module.exports = { description: "Setup modmail category in a server", usage: "(Category ID)", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args.length) return client.err(message, "Config", "modmail-category", 0); diff --git a/commands/Config/modmail-role.js b/commands/Config/modmail-role.js @@ -6,11 +6,6 @@ module.exports = { description: "Add role for modmail in a server", usage: "(Role)", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args.length) return client.err(message, "Config", "modmail-role", 0); const role = diff --git a/commands/Config/panel.js b/commands/Config/panel.js @@ -6,11 +6,6 @@ module.exports = { description: "Reaction-Role Panel", UserPerm: "ADMINISTRATOR", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const channel = message.mentions.channels.first() || message.channel; Schema.findOne({ Guild: message.guild.id }, async (err, data) => { diff --git a/commands/Config/prefix-reset.js b/commands/Config/prefix-reset.js @@ -7,11 +7,6 @@ module.exports = { description: 'Reset the prefix to "C." at the server', UserPerm: "ADMINISTRATOR", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message) => { message.channel .send("**Do you want to reset your prefix?**") diff --git a/commands/Config/prefix.js b/commands/Config/prefix.js @@ -6,11 +6,6 @@ module.exports = { description: "Set the prefix at the server", UserPerm: "ADMINISTRATOR", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const res = args.join(" "); if (!res) return client.err(message, "Config", "prefix", 46); diff --git a/commands/Config/premium.js b/commands/Config/premium.js @@ -6,11 +6,6 @@ module.exports = { aliases: ["psadd", "psa", "premiumserver"], description: "Add premium to a server", Premium: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { const user = await client.data.getUser(message.author.id); diff --git a/commands/Config/rr-add.js b/commands/Config/rr-add.js @@ -6,11 +6,6 @@ module.exports = { description: "Create reaction role for server", usage: "(Role) (emoji(Must be in server)", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const role = message.mentions.roles.first() || diff --git a/commands/Config/rr-rmv.js b/commands/Config/rr-rmv.js @@ -6,11 +6,6 @@ module.exports = { UserPerm: "ADMINISTRATOR", description: "Remove reaction role for server", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { message.channel .send("**Do you want to remove the reaction roles?**") diff --git a/commands/Config/set.js b/commands/Config/set.js @@ -5,11 +5,6 @@ module.exports = { usage: "(goodbye/welcome/log) (#Channel)", UserPerm: "ADMINISTRATOR", category: "Config", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0]) return client.err(message, "Config", "set", 45); if (args[0].toLowerCase() === "goodbye") { @@ -20,7 +15,22 @@ module.exports = { } else if (args[0].toLowerCase() === "log") { const channel = message.mentions.channels.first(); if (!channel) return client.err(message, "Config", "set", 28); - await client.data.setLog(message.guild.id, channel.id); + let webhookid; + let webhooktoken; + await channel + .createWebhook(message.guild.name, { + avatar: message.guild.iconURL({ format: "png" }), + }) + .then(webhook => { + webhookid = webhook.id; + webhooktoken = webhook.token; + }); + await client.data.setLog( + message.guild.id, + channel.id, + webhookid, + webhooktoken + ); message.channel.send(`Saved ${channel} as the log channel.`); } else if (args[0].toLowerCase() === "welcome") { const channel = message.mentions.channels.first(); diff --git a/commands/Economy/bal.js b/commands/Economy/bal.js @@ -4,11 +4,6 @@ module.exports = { aliases: ["bal"], usage: "(User)", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const user = message.mentions.members.first() || diff --git a/commands/Economy/bet.js b/commands/Economy/bet.js @@ -6,25 +6,20 @@ module.exports = { timeout: 5000, description: "Win double amount of coins or lose all coins", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const max = 1000000; if (!args[0]) { - return client.err(message, "Economy", "gamble", 5); + return client.err(message, "Economy", "bet", 5); } if (isNaN(args[0])) { - return client.err(message, "Economy", "gamble", 7); + return client.err(message, "Economy", "bet", 7); } const amt = parseInt(args[0]); if ((await client.data.bal(message.author.id)) < amt) { - return client.err(message, "Economy", "gamble", 20); + return client.err(message, "Economy", "bet", 20); } if (amt > max) { - return client.err(message, "Economy", "gamble", 101); + return client.err(message, "Economy", "bet", 101); } if (client.function.random() === true) { const winamt = amt * 1; @@ -33,7 +28,11 @@ module.exports = { .setColor("GREEN") .setTimestamp() .setTitle(`${message.author.username} wins a gamble game`) - .setDescription(`You win\n**${winamt}**${client.currency}`); + .setDescription( + `You win\n**${winamt}**${client.currency}\nYou now have **${ + parseInt(await client.data.bal(message.author.id)) - amt + }**${client.currency}` + ); message.inlineReply(abc); } else { await client.data.rmv(message.author.id, amt); @@ -41,7 +40,11 @@ module.exports = { .setColor("RED") .setTimestamp() .setTitle(`${message.author.username} loses a gamble game`) - .setDescription(`You lost\n**${amt}**${client.currency}`); + .setDescription( + `You lost\n**${winamt}**${client.currency}\nYou now have **${ + parseInt(await client.data.bal(message.author.id)) - amt + }**${client.currency}` + ); message.inlineReply(cba); } }, diff --git a/commands/Economy/buy.js b/commands/Economy/buy.js @@ -1,17 +1,12 @@ const { Client, Message, MessageEmbed } = require("discord.js"); const inventory = require("../../models/econ"); -const items = require("../../util/item"); +const items = require("../../util/dist/item"); module.exports = { name: "purchase", aliases: ["buy"], usage: "(Item)", description: "Buy something from the shop", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0]) { return client.err(message, "Economy", "buy", 21); diff --git a/commands/Economy/daily.js b/commands/Economy/daily.js @@ -4,11 +4,6 @@ module.exports = { description: "Earns daily money", category: "Economy", timeout: 1000 * 60 * 60 * 24, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { var money; const user = await client.data.getUser(message.author.id); @@ -25,7 +20,7 @@ module.exports = { ) .setURL(client.web) .setColor(client.color) - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) .setTimestamp(); await client.data.add(message.author.id, money); return message.inlineReply(pre_embed); @@ -41,7 +36,7 @@ module.exports = { ) .setURL(client.web) .setColor(client.color) - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) .setTimestamp(); await client.data.add(message.author.id, money); return message.inlineReply(norm_embed); diff --git a/commands/Economy/drop.js b/commands/Economy/drop.js @@ -5,11 +5,6 @@ module.exports = { usage: "{Channel} (Number)", description: "Drops money to a channel", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const p = await client.prefix(message); const channel = message.mentions.channels.first() || message.channel; diff --git a/commands/Economy/gift.js b/commands/Economy/gift.js @@ -1,17 +1,12 @@ const { Client, Message, MessageEmbed } = require("discord.js"); const inventory = require("../../models/econ"); -const items = require("../../util/item"); +const items = require("../../util/dist/item"); module.exports = { name: "gift", timeout: 5000, usage: "(User) (Item)", description: "Gift item to an user", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const user = message.mentions.users.first() || diff --git a/commands/Economy/give.js b/commands/Economy/give.js @@ -6,11 +6,6 @@ module.exports = { usage: "(User) (Number)", description: "Give money to an user", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const user = message.mentions.users.first() || diff --git a/commands/Economy/inv.js b/commands/Economy/inv.js @@ -1,6 +1,6 @@ const { Client, Message, MessageEmbed } = require("discord.js"); const inv = require("../../models/econ"); -const util = require("../../util/pagination"); +const util = require("../../util/pagination/pagination"); module.exports = { name: "inventory", aliases: ["inv"], @@ -8,11 +8,6 @@ module.exports = { usage: "{User}", category: "Economy", timeout: 5000, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const p = await client.prefix(message); const user = diff --git a/commands/Economy/lb.js b/commands/Economy/lb.js @@ -6,11 +6,6 @@ module.exports = { timeout: 5000, usage: "Check the leaderboard of a server", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const rawLeaderboard = await Levels.fetchLeaderboard(message.guild.id, 10); if (rawLeaderboard.length < 1) diff --git a/commands/Economy/shop.js b/commands/Economy/shop.js @@ -1,15 +1,10 @@ const { Client, Message, MessageEmbed } = require("discord.js"); -const util = require("../../util/pagination"); -const items = require("../../util/item"); +const util = require("../../util/pagination/pagination"); +const items = require("../../util/dist/item"); module.exports = { name: "shop", description: "Check the items from the shop", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const list = items.map((value, index) => { return `**${value.item}** — ${value.price.toLocaleString()}${ diff --git a/commands/Economy/slots.js b/commands/Economy/slots.js @@ -5,11 +5,6 @@ module.exports = { timeout: 5000, description: "Win more coins by slots", category: "Economy", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const max = 1000000; const slots = [ @@ -81,12 +76,11 @@ module.exports = { ) .setTitle(`${message.author.username} loses a slots game`) .setDescription( - `You lose\n**${amt}**${client.currency}\nYou now have **${ + `You lost\n**${amt}**${client.currency}\nYou now have **${ parseInt(await client.data.bal(message.author.id)) - amt }**${client.currency}` ); message.inlineReply(lost); - console.log(`Coins: ${await client.data.bal(message.author.id)}`); } }, }; diff --git a/commands/Economy/steal.js b/commands/Economy/steal.js @@ -7,11 +7,6 @@ module.exports = { aliases: ["rob"], category: "Economy", timeout: 120000, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { var tryrob = message.mentions.users.first() || diff --git a/commands/Economy/work.js b/commands/Economy/work.js @@ -5,11 +5,6 @@ module.exports = { description: "Work to earn money", category: "Economy", timeout: 1000 * 60 * 10, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const job = [ "Software engineer", diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js @@ -0,0 +1,56 @@ +const { Client, Message, MessageEmbed } = require("discord.js"); + +const answers = [ + "Maybe.", + "Certainly not.", + "I hope so.", + "Not in your wildest dreams.", + "There is a good chance.", + "Quite likely.", + "I think so.", + "I hope not.", + "I hope so.", + "Never!", + "Fuhgeddaboudit.", + "Ahaha! Really?!?", + "Pfft.", + "Sorry, bucko.", + "Hell, yes.", + "Hell to the no.", + "The future is bleak.", + "The future is uncertain.", + "I would rather not say.", + "Who cares?", + "Possibly.", + "Never, ever, ever.", + "There is a small chance.", + "Yes!", +]; + +module.exports = { + name: "8ball", + usage: "(Question)", + description: "8ball an answer", + category: "Fun", + run: async (client, message, args) => { + if (!args.join(" ").endsWith("?")) + return client.err(message, "Fun", "8ball", 101); + else { + const embed = new MessageEmbed() + .setAuthor( + `🎱 ${message.member.displayName} asks`, + message.author.displayAvatarURL({ dynamic: true }) + ) + .setDescription( + `**🎱Question:** \n${args.join(" ")} \n**🎱Answer:** \n ${ + answers[Math.floor(Math.random() * answers.length)] + }` + ) + .setColor(client.color) + .setTimestamp() + .setURL(client.web) + .setFooter(`Made by ${client.author}`); + message.inlineReply(embed); + } + }, +}; diff --git a/commands/Fun/cat.js b/commands/Fun/cat.js @@ -5,11 +5,6 @@ module.exports = { aliases: ["cats"], category: "Fun", description: "A cat command", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const wait = await message.inlineReply("Getting cat picture..."); let subreddits = ["cat", "cats"]; diff --git a/commands/Fun/coinflip.js b/commands/Fun/coinflip.js @@ -3,11 +3,7 @@ module.exports = { name: "coinflip", aliases: ["cf"], description: "Flip a coin", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + category: "Fun", run: async (client, message, args) => { let HT = ["Heads!", "Tails!"]; let pick = HT[Math.floor(Math.random() * HT.length)]; @@ -15,7 +11,7 @@ module.exports = { .setColor(client.color) .setTitle("CoinFilp Game") .setTimestamp() - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) .setDescription(pick); message.inlineReply(embed); }, diff --git a/commands/Fun/connect4.js b/commands/Fun/connect4.js @@ -5,11 +5,6 @@ module.exports = { usage: "(User)", description: "Play a connect 4 game with a user", category: "Fun", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const challenger = message.member; const oppenent = message.mentions.members.first(); diff --git a/commands/Fun/dog.js b/commands/Fun/dog.js @@ -5,11 +5,6 @@ module.exports = { aliases: ["dogs"], category: "Fun", description: "A dog command", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const wait = await message.inlineReply("Getting dog picture..."); let subreddits = ["dog", "dogs"]; diff --git a/commands/Fun/drake.js b/commands/Fun/drake.js @@ -9,11 +9,7 @@ module.exports = { name: "drake", description: "Drake meme", usage: "(Text) (Text)", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + category: "Fun", run: async (client, message, args) => { const t1 = args[0]; const t2 = args.slice(1).join(" "); diff --git a/commands/Fun/ds.js b/commands/Fun/ds.js @@ -0,0 +1,18 @@ +const fetch = require("node-fetch"); +const { Client, Message, MessageEmbed } = require("discord.js"); +module.exports = { + name: "ds", + aliases: ["doublestruck"], + description: "Doublestruck your text", + usage: "(text)", + category: "Fun", + run: async (client, message, args) => { + let text = args.join("+"); + if (!text) return client.err(message, "Fun", "ds", 12); + let res = await fetch( + "https://api.popcatdev.repl.co/doublestruck?text=" + text + ); + let json = await res.json(); + message.inlineReply(json.text); + }, +}; diff --git a/commands/Fun/hangman.js b/commands/Fun/hangman.js @@ -6,11 +6,6 @@ module.exports = { name: "hangman", description: "Play a hangman game", category: "Fun", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (playing.has(message.channel.id)) return message.reply("Only one game may be occurring per channel."); diff --git a/commands/Fun/hexcolor.js b/commands/Fun/hexcolor.js @@ -0,0 +1,84 @@ +const Canvas = require("canvas"); +const { + Client, + Message, + MessageEmbed, + MessageAttachment, +} = require("discord.js"); +const axios = require("axios"); + +module.exports = { + name: "hexcolor", + usage: "(Hex Color Code)", + description: "Get Hex and RGB info of a color", + aliases: ["hex"], + category: "Fun", + run: async (client, message, args) => { + let color; + if (args[0]) { + if (/(#|0x)([0-9A-F]{6})/i.test(args[0])) { + color = args[0].match(/(#|0x)([0-9A-F]{6})/i)[2]; + } else { + return client.err(message, "Fun", "hexcolor", 101); + } + } else { + color = message.member.displayHexColor; + } + try { + message.channel.startTyping(); + const aa = color.replace("#", "", "0x", ""); + const colour = await axios.get( + `https://www.thecolorapi.com/scheme?hex=${aa}` + ); + const canvas = Canvas.createCanvas(200, 200); + const ctx = canvas.getContext("2d"); + ctx.beginPath(); + ctx.rect(0, 0, 200, 200); + ctx.fillStyle = `${colour.data.seed.hex.value}`; + ctx.fill(); + const rightpic = new MessageAttachment(canvas.toBuffer(), "wea.jpg"); + const canvasx = Canvas.createCanvas(500, 100); + const ctxt = canvasx.getContext("2d"); + let y = canvasx.height / 2; + ctxt.font = "12px Roboto"; + ctxt.textAlign = "center"; + let addup = 0; + for (let i = 0; i < 5; i++) { + ctxt.beginPath(); + ctxt.rect(addup, 0, 100, 100); + ctxt.fillStyle = `${colour.data.colors[i].hex.value}`; + ctxt.fill(); + addup = addup + 100; + ctxt.beginPath(); + ctxt.rect(addup - 80, y - 15, 60, 30); + ctxt.fillStyle = `black`; + ctxt.fill(); + ctxt.fillStyle = `white`; + ctxt.fillText( + `${colour.data.colors[i].hex.value}`, + addup - 51, + y + 4.3 + ); + } + const attachment = new MessageAttachment(canvasx.toBuffer(), "color.jpg"); + const embed = new MessageEmbed() + .setColor(`0x${colour.data.seed.hex.value}`) + .setDescription( + `\`HEX: ${colour.data.seed.hex.value} RGB: ${colour.data.seed.rgb.value}\`\n🔽Color Scheme🔽` + ) + .setTitle("Color Information (Click here for more info)") + .setURL(`https://www.colorhexa.com/${colour.data.seed.hex.clean}`) + .attachFiles(attachment) + .setURL(client.web) + .setImage("attachment://color.jpg") + .attachFiles(rightpic) + .setThumbnail("attachment://wea.jpg"); + message.channel.send(embed); + } catch (e) { + console.log(e); + return client.err(message, "Utilities", "hexcolor", 999); + } finally { + message.channel.stopTyping(); + } + }, +}; diff --git a/commands/Fun/hug.js b/commands/Fun/hug.js @@ -4,11 +4,6 @@ module.exports = { usage: "(User)", description: "Hug someone", category: "Fun", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const words = args.slice(1).join(" "); const user = diff --git a/commands/Fun/kiss.js b/commands/Fun/kiss.js @@ -4,11 +4,6 @@ module.exports = { usage: "(User)", description: "Kiss someone", category: "Fun", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const words = args.slice(1).join(" "); const user = diff --git a/commands/Fun/meme.js b/commands/Fun/meme.js @@ -5,11 +5,6 @@ module.exports = { aliases: ["memes"], category: "Fun", description: "A meme command", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const wait = await message.inlineReply("Getting meme..."); let subreddits = ["comedyheaven", "dank", "meme", "memes"]; diff --git a/commands/Fun/quote.js b/commands/Fun/quote.js @@ -0,0 +1,41 @@ +const { + Client, + Message, + MessageEmbed, + MessageAttachment, +} = require("discord.js"); +const { Canvas } = require("canvacord"); +module.exports = { + name: "quote", + description: "Quote a message", + usage: "{User} (Message)", + category: "Fun", + run: async (client, message, args) => { + const member = message.mentions.users.first() || message.author; + if (message.mentions.users.first()) { + const imgae = await Canvas.quote({ + image: member.displayAvatarURL({ + format: "png", + }), + message: args.slice(1).join(" "), + username: member.displayName ? member.displayName : member.username, + color: "ffffff", + }); + const attach = new MessageAttachment(imgae, "quote.png"); + message.inlineReply(attach); + } else { + const imgae = await Canvas.quote({ + image: message.author.displayAvatarURL({ + format: "png", + }), + message: args.join(" "), + username: message.member.nickname + ? message.member.nickname + : member.username, + color: "ffffff", + }); + const attach = new MessageAttachment(imgae, "quote.png"); + message.inlineReply(attach); + } + }, +}; diff --git a/commands/Fun/rickroll.js b/commands/Fun/rickroll.js @@ -0,0 +1,30 @@ +const { + Client, + Message, + MessageEmbed, + MessageAttachment, +} = require("discord.js"); + +module.exports = { + name: "rickroll", + aliases: ["rick", "nevergonnagiveyouup", "never"], + description: "Rickroll?", + category: "Fun", + run: async (client, message, args) => { + const roll = [ + "Never gonna give you up", + "Never gonna let you down", + "Never gonna run around and desert you", + "Never gonna make you cry", + "Never gonna say goodbye", + "Never gonna tell a lie and hurt you", + ]; + const rick = roll[Math.floor(Math.random() * roll.length)]; + const rickroll = new MessageAttachment( + "https://i.pinimg.com/originals/88/82/bc/8882bcf327896ab79fb97e85ae63a002.gif" + ); + message.inlineReply(`**${rick}**`, { + files: [rickroll], + }); + }, +}; diff --git a/commands/Fun/say.js b/commands/Fun/say.js @@ -4,11 +4,6 @@ module.exports = { description: "Pretend a bot to say", usage: "(Words)", category: "Fun", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args.length) return; message.delete(); diff --git a/commands/Fun/simprate.js b/commands/Fun/simprate.js @@ -5,11 +5,6 @@ module.exports = { description: "Check how simp is the user", usage: "(@User)", category: "Fun", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let simp = Math.floor(Math.random() * 100); if (message.mentions.users.first()) { diff --git a/commands/Fun/sr.js b/commands/Fun/sr.js @@ -0,0 +1,15 @@ +const { Client, Message, MessageEmbed } = require("discord.js"); +const supr = require("superscript-text"); +module.exports = { + name: "superscript", + aliases: ["sr"], + description: "Superscript your text", + usage: "(text)", + category: "Fun", + run: async (client, message, args) => { + const text = args.join(" "); + if (!text) return client.err(message, "Fun", "sr", 12); + if (text.includes("@")) return client.err(message, "Fun", "sr", 101); + message.inlineReply(supr(text)); + }, +}; diff --git a/commands/Fun/triggered.js b/commands/Fun/triggered.js @@ -0,0 +1,18 @@ +const { Canvas } = require("canvacord"); +const { Client, Message, MessageAttachment } = require("discord.js"); +module.exports = { + name: "trigger", + aliases: ["triggered"], + usage: "{User}", + description: "Have a trigger effect on a user's avatar", + category: "Fun", + run: async (client, message, args) => { + const user = + message.mentions.users.first() || + message.guild.members.cache.get(args[0]) || + message.author; + const ava = user.displayAvatarURL({ format: "png" }); + const imga = await Canvas.trigger(ava); + message.inlineReply(new MessageAttachment(imga, "imgae.gif")); + }, +}; diff --git a/commands/Giveaway/end.js b/commands/Giveaway/end.js @@ -4,11 +4,6 @@ module.exports = { UserPerm: "MANAGE_MESSAGES", usage: "(Message ID)", description: "End a giveaway", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0]) return client.err(message, "Giveaway", "end", 27); const giveaway = client.giveaways.giveaways.find( diff --git a/commands/Giveaway/giveaway.js b/commands/Giveaway/giveaway.js @@ -6,11 +6,6 @@ module.exports = { description: "Start a giveaway", usage: "(Channel) (Time) (Winners(Number)) (Prize)", UserPerm: "MANAGE_MESSAGES", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const channel = message.mentions.channels.first(); if (!channel) return client.err(message, "Giveaway", "giveaway", 28); @@ -33,7 +28,7 @@ module.exports = { inviteToParticipate: "React with 🎉 to enter!", winMessage: `Congratulations {winners}! You won the **${prize}**!`, noWinner: "Could not determine a winner!", - embedFooter: "Made by Ń1ght", + embedFooter: `Made by ${client.author}`, hostedBy: "Hosted by: {user}", winners: "Winner(s)", messageURL: "", diff --git a/commands/Giveaway/reroll.js b/commands/Giveaway/reroll.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Message ID)", description: "Reroll a giveaway", UserPerm: "MANAGE_MESSAGES", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0]) return client.err(message, "Giveaway", "reroll", 27); const giveaway = client.giveaways.giveaways.find( diff --git a/commands/Moderation/announce.js b/commands/Moderation/announce.js @@ -6,11 +6,6 @@ module.exports = { usage: "{Channel} (Message)", description: "Announce a message to a channel.", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const channel = message.mentions.channels.first() || message.channel; if (!args[0]) return client.err(message, "Moderation", "announce", 4); diff --git a/commands/Moderation/ban.js b/commands/Moderation/ban.js @@ -6,11 +6,6 @@ module.exports = { UserPerm: "BAN_MEMBERS", usage: "(User) {Reason}", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let target = message.mentions.members.first() || diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js @@ -8,11 +8,6 @@ module.exports = { description: "Clear/Purge 1-100 messages in the channel", usage: "(Number)", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if ( !args[0] || diff --git a/commands/Moderation/clearWarns.js b/commands/Moderation/clearWarns.js @@ -6,11 +6,6 @@ module.exports = { description: "Clear an user's warns", UserPerm: "MANAGE_MESSAGES", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const user = message.mentions.members.first() || diff --git a/commands/Moderation/kick.js b/commands/Moderation/kick.js @@ -6,11 +6,6 @@ module.exports = { BotPem: "KICK_MEMBERS", usage: "(User) {Reason}", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let target = message.mentions.members.first() || diff --git a/commands/Moderation/lock.js b/commands/Moderation/lock.js @@ -7,11 +7,6 @@ module.exports = { UserPerm: "MANAGE_CHANNELS", BotPerm: "MANAGE_CHANNELS", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { message.channel .createOverwrite(message.guild.id, { SEND_MESSAGES: false }) diff --git a/commands/Moderation/mute.js b/commands/Moderation/mute.js @@ -7,11 +7,6 @@ module.exports = { UserPerm: "MANAGE_MESSAGES", BotPerm: "MANAGE_ROLES", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let Member = message.mentions.members.first(); const time = args[1]; diff --git a/commands/Moderation/nuke.js b/commands/Moderation/nuke.js @@ -6,11 +6,6 @@ module.exports = { UserPerm: "MANAGE_CHANNELS", BotPerm: "MANAGE_CHANNELS", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { let filter = m => m.author.id === message.author.id; diff --git a/commands/Moderation/pin.js b/commands/Moderation/pin.js @@ -6,11 +6,6 @@ module.exports = { description: "Pin a message in the server", BotPerm: "MANAGE_MESSAGES", UserPerm: "MANAGE_MESSAGES", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0]) return client.err(message, "Moderation", "pin", 27); try { diff --git a/commands/Moderation/removeWarn.js b/commands/Moderation/removeWarn.js @@ -6,11 +6,6 @@ module.exports = { description: "Remove a latest warn for an user", usage: "(User)", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { const user = diff --git a/commands/Moderation/role.js b/commands/Moderation/role.js @@ -6,11 +6,6 @@ module.exports = { usage: "(Role) (User)", description: "Add/Remove a role for an user", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { const target = diff --git a/commands/Moderation/slowmode.js b/commands/Moderation/slowmode.js @@ -7,11 +7,6 @@ module.exports = { BotPerm: "MANAGE_CHANNELS", usage: "(Time)", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { if (!args[0]) { diff --git a/commands/Moderation/unban.js b/commands/Moderation/unban.js @@ -6,11 +6,6 @@ module.exports = { BotPerm: "BAN_MEMBERS", usage: "(User)", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { if (!args[0]) return client.err(message, "Moderation", "unban", 1); diff --git a/commands/Moderation/unlock.js b/commands/Moderation/unlock.js @@ -6,11 +6,6 @@ module.exports = { UserPerm: "MANAGE_CHANNELS", BotPerm: "MANAGE_CHANNELS", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { message.channel .createOverwrite(message.guild.id, { SEND_MESSAGES: true }) diff --git a/commands/Moderation/unmute.js b/commands/Moderation/unmute.js @@ -6,11 +6,6 @@ module.exports = { usage: "(User)", description: "Unmute an user", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { const user = diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js @@ -6,11 +6,6 @@ module.exports = { usage: "(User) {Reason}", description: "Warn a user", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { const user = diff --git a/commands/Moderation/warns.js b/commands/Moderation/warns.js @@ -6,11 +6,6 @@ module.exports = { description: "Check the warns of an user", usage: "{User}", category: "Moderation", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { try { const user = diff --git a/commands/Music/leave.js b/commands/Music/leave.js @@ -4,16 +4,11 @@ module.exports = { aliases: ["dc"], description: "Leave The Voice Channel", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let channel = message.member.voice.channel; - if (!channel) return client.err(message, "Music", "disconnect", 35); + if (!channel) return client.err(message, "Music", "leave", 35); if (!message.guild.me.voice.channel) - return client.err(message, "Music", "disconnect", 41); + return client.err(message, "Music", "leave", 41); try { await message.guild.me.voice.channel.leave(); } catch (error) { diff --git a/commands/Music/loop.js b/commands/Music/loop.js @@ -3,11 +3,6 @@ module.exports = { name: "loop", description: "Music loop", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const serverQueue = message.client.queue.get(message.guild.id); if (serverQueue) { diff --git a/commands/Music/lyrics.js b/commands/Music/lyrics.js @@ -1,16 +1,11 @@ const { Client, Message, MessageEmbed } = require("discord.js"); const lyricsFinder = require("lyrics-finder"); -const splitlyrics = require("../../util/pagination"); +const splitlyrics = require("../../util/pagination/pagination"); module.exports = { name: "lyrics", description: "Get lyrics for the currently playing song", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const queue = message.client.queue.get(message.guild.id); if (!queue) return client.err(message, "Music", "lyrics", 34); diff --git a/commands/Music/nowplaying.js b/commands/Music/nowplaying.js @@ -3,11 +3,6 @@ module.exports = { name: "nowplaying", description: "To show the music which is currently playing in this server", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const serverQueue = message.client.queue.get(message.guild.id); if (!serverQueue) return client.err(message, "Music", "nowplaying", 34); diff --git a/commands/Music/pause.js b/commands/Music/pause.js @@ -3,11 +3,6 @@ module.exports = { name: "pause", description: "To pause the current music in the server", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const serverQueue = message.client.queue.get(message.guild.id); if (serverQueue && serverQueue.playing) { diff --git a/commands/Music/play.js b/commands/Music/play.js @@ -11,11 +11,6 @@ module.exports = { aliases: ["p"], category: "Music", BotPerm: ["CONNECT", "SPEAK"], - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let channel = message.member.voice.channel; if (!channel) return client.err(message, "Music", "play", 35); diff --git a/commands/Music/playlist.js b/commands/Music/playlist.js @@ -10,11 +10,6 @@ module.exports = { usage: "(YouTube Playlist URL)/(Playlist Name)", category: "Music", BotPerm: ["CONNECT", "SPEAK"], - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const channel = message.member.voice.channel; if (!channel) return client.err(message, "Music", "playlist", 35); diff --git a/commands/Music/queue.js b/commands/Music/queue.js @@ -1,16 +1,11 @@ const { Client, Message, MessageEmbed } = require("discord.js"); -const util = require("../../util/pagination"); +const util = require("../../util/pagination/pagination"); module.exports = { name: "queue", description: "To show the songs queue", aliases: ["q"], category: "Music", BotPerm: ["MANAGE_MESSAGES", "ADD_REACTIONS"], - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const queue = message.client.queue.get(message.guild.id); if (!queue) return client.err(message, "Music", "queue", 34); diff --git a/commands/Music/remove.js b/commands/Music/remove.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Number)", aliases: ["rm"], category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const queue = message.client.queue.get(message.guild.id); if (!queue) return client.err(message, "Music", "remove", 37); @@ -23,7 +18,7 @@ module.exports = { const embed = new MessageEmbed() .setColor(client.color) .setDescription(`❌ **|** Removed: **${song[0].title}** from the queue`) - .setTimestamp("Made by Cath Team"); + .setTimestamp(`Made by ${client.author}`); const song = queue.songs.splice(args[0] - 1, 1); message.inlineReply(embed); message.react("✅"); diff --git a/commands/Music/resume.js b/commands/Music/resume.js @@ -4,11 +4,7 @@ module.exports = { description: "To resume the paused music", aliases: ["continue"], category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ + run: async (client, message, args) => { const serverQueue = message.client.queue.get(message.guild.id); if (serverQueue && !serverQueue.playing) { diff --git a/commands/Music/shuffle.js b/commands/Music/shuffle.js @@ -3,11 +3,6 @@ module.exports = { name: "shuffle", description: "Shuffle queue", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const serverQueue = message.client.queue.get(message.guild.id); if (!serverQueue) return client.err(message, "Music", "shuffle", 37); diff --git a/commands/Music/skip.js b/commands/Music/skip.js @@ -3,11 +3,6 @@ module.exports = { name: "skip", description: "To skip the current music", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const channel = message.member.voice.channel; if (!channel) return client.err(message, "Music", "skip", 35); diff --git a/commands/Music/skipto.js b/commands/Music/skipto.js @@ -4,11 +4,6 @@ module.exports = { description: "Skip to the selected queue number", usage: "(Number)", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args.length || isNaN(args[0])) return client.err(message, "Music", "skipto", 101); diff --git a/commands/Music/stop.js b/commands/Music/stop.js @@ -3,11 +3,6 @@ module.exports = { name: "stop", description: "To stop the music and clear the queue", category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const channel = message.member.voice.channel; if (!channel) return client.err(message, "Music", "stop", 35); diff --git a/commands/Music/volume.js b/commands/Music/volume.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Number)", aliases: ["vol"], category: "Music", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const channel = message.member.voice.channel; if (!channel) return client.err(message, "Music", "volume", 35); diff --git a/commands/Owner/accept.js b/commands/Owner/accept.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Message)", description: "Accept a suggestion", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const MessageID = args[0]; const acceptQuery = @@ -21,7 +16,6 @@ module.exports = { client.SuggestionLog ); const suggestEmbed = await suggestionChannel.messages.fetch(MessageID); - console.log(suggestEmbed); const data = suggestEmbed.embeds[0]; const acceptEmbed = new MessageEmbed() .setAuthor(data.author.name, data.author.iconURL) diff --git a/commands/Owner/add.js b/commands/Owner/add.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Number)", description: "Add coins from someone", Owner: true, - /** - * @param {Client}client - * @param {Message}message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0] || isNaN(args[0])) return message.channel.send("Number of coins?"); diff --git a/commands/Owner/blacklist.js b/commands/Owner/blacklist.js @@ -5,11 +5,6 @@ module.exports = { usage: "(User) (Toggle) (Reason)", description: "Blacklist someone from the bot", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let user = args[0]; toggle = args[1]; diff --git a/commands/Owner/cls.js b/commands/Owner/cls.js @@ -0,0 +1,10 @@ +const { Client, Message, MessageEmbed } = require("discord.js"); + +module.exports = { + name: "cls", + run: async (client, message, args) => { + message.channel.send( + "**\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n**" + ); + }, +}; diff --git a/commands/Owner/deny.js b/commands/Owner/deny.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Message)", description: "Deny a suggestion", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const MessageID = args[0]; const denyQuery = @@ -21,7 +16,6 @@ module.exports = { client.SuggestionLog ); const suggestEmbed = await suggestionChannel.messages.fetch(MessageID); - console.log(suggestEmbed); const data = suggestEmbed.embeds[0]; const denyEmbed = new MessageEmbed() .setAuthor(data.author.name, data.author.iconURL) diff --git a/commands/Owner/dm.js b/commands/Owner/dm.js @@ -5,11 +5,6 @@ module.exports = { usage: "(User) (Message)", description: "DM a user", Owner: true, - /** - * @param {Client}client - * @param {Message}message - * @param {String[]} args - */ run: async (client, message, args) => { const user = client.users.cache.get(args[0]); if (!user) return message.inlineReply("User?"); diff --git a/commands/Owner/encrypt.js b/commands/Owner/encrypt.js @@ -3,11 +3,6 @@ const { Client, Message, MessageEmbed } = require("discord.js"); module.exports = { name: "code", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const encrypted = encrypt(args.slice(0).join(" ")); message.channel.send(`\`\`\`${encrypted}\`\`\``); diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js @@ -5,11 +5,6 @@ module.exports = { aliases: ["e"], usage: "(Code)", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let code = args.join(" "); if (!code) return client.err(message, "Owner", "eval", 53); diff --git a/commands/Owner/getinvite.js b/commands/Owner/getinvite.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Guild)", description: "Generates an invitation to the server", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let guild = null; if (!args[0]) return client.err(message, "Owner", "getinvite", 0); diff --git a/commands/Owner/guilds.js b/commands/Owner/guilds.js @@ -4,11 +4,6 @@ module.exports = { category: "Owner", description: "Check top 10 guilds of the bot", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const guilds = client.guilds.cache .sort((a, b) => b.memberCount - a.memberCount) @@ -22,7 +17,7 @@ module.exports = { .setTitle("Guilds") .setDescription(description) .setColor(client.color) - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) .setTimestamp(); message.channel.send(embed); }, diff --git a/commands/Owner/premium.js b/commands/Owner/premium.js @@ -5,11 +5,6 @@ module.exports = { usage: "(User) (Toggle) (Tier)", description: "Set someone into Premium with tiers", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const member = message.mentions.members.first() || diff --git a/commands/Owner/reaction-role.js b/commands/Owner/reaction-role.js @@ -1,12 +1,7 @@ const { Client, Message, MessageEmbed } = require("discord.js"); module.exports = { - name: "test", + name: "rr", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const embed = new MessageEmbed() .setAuthor( @@ -40,7 +35,7 @@ module.exports = { }, { name: "YouTube<:YouTube:841186450497339412>", - value: "<@&765928569397575750>", + value: "<@&841026772790673448>", inline: true, } ) diff --git a/commands/Owner/restart.js b/commands/Owner/restart.js @@ -4,16 +4,10 @@ module.exports = { category: "Owner", description: "Restart the bot", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { - message.channel - .send("Restarting...") - .then(message => client.destroy()) - .then(() => client.login(process.env.TOKEN)); - message.channel.send("Restarted"); + const msg = await message.channel.send("Restarting..."); + await client.destroy(); + await client.login(process.env.TOKEN); + await msg.delete().then(msg => message.channel.send("Restarted")); }, }; diff --git a/commands/Owner/rmv.js b/commands/Owner/rmv.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Number)", description: "Remove coins from someone", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0] || isNaN(args[0])) return message.channel.send("Number of coins?"); diff --git a/commands/Owner/setBotAvatar.js b/commands/Owner/setBotAvatar.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Link)", description: "Set bot avatar from a link", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (message.deletable) { message.delete(); diff --git a/commands/Owner/status.js b/commands/Owner/status.js @@ -5,11 +5,6 @@ module.exports = { description: "Maintenance mode", category: "Owner", Owner: true, - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0]) return message.channel.send("True or False?"); if (args[0].toLowerCase() === "true") { diff --git a/commands/Owner/try.js b/commands/Owner/try.js @@ -1,11 +1,6 @@ const { Client, Message, MessageEmbed } = require("discord.js"); module.exports = { name: "auth", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const random = client.function.rndint(100000, 999999); let ed; @@ -23,7 +18,7 @@ module.exports = { .setTitle("One-Time Password") .setDescription(questions[collectCounter++]) .setColor(client.color) - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) .setTimestamp() ); const channel = appStart.channel; @@ -42,7 +37,7 @@ module.exports = { .setDescription(`Success`) .setTimestamp() .setColor("GREEN") - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) ); } else { message.author.send( @@ -50,7 +45,7 @@ module.exports = { .setDescription(`Failed\nPlease try again.`) .setTimestamp() .setColor("RED") - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) ); } }); diff --git a/commands/Utilities/8ball.js b/commands/Utilities/8ball.js @@ -1,61 +0,0 @@ -const { Client, Message, MessageEmbed } = require("discord.js"); - -const answers = [ - "Maybe.", - "Certainly not.", - "I hope so.", - "Not in your wildest dreams.", - "There is a good chance.", - "Quite likely.", - "I think so.", - "I hope not.", - "I hope so.", - "Never!", - "Fuhgeddaboudit.", - "Ahaha! Really?!?", - "Pfft.", - "Sorry, bucko.", - "Hell, yes.", - "Hell to the no.", - "The future is bleak.", - "The future is uncertain.", - "I would rather not say.", - "Who cares?", - "Possibly.", - "Never, ever, ever.", - "There is a small chance.", - "Yes!", -]; - -module.exports = { - name: "8ball", - usage: "(Question)", - description: "8ball an answer", - category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ - run: async (client, message, args) => { - if (!args.join(" ").endsWith("?")) - return client.err(message, "Utilities", "8ball", 101); - else { - const embed = new MessageEmbed() - .setAuthor( - `🎱 ${message.member.displayName} asks`, - message.author.displayAvatarURL({ dynamic: true }) - ) - .setDescription( - `**🎱Question:** \n${args.join(" ")} \n**🎱Answer:** \n ${ - answers[Math.floor(Math.random() * answers.length)] - }` - ) - .setColor(client.color) - .setTimestamp() - .setURL(client.web) - .setFooter("Made by Cath Team"); - message.inlineReply(embed); - } - }, -}; diff --git a/commands/Utilities/afk.js b/commands/Utilities/afk.js @@ -4,11 +4,6 @@ module.exports = { description: "Tell someone you are AFK.", usage: "{Status}", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let uuser = message.guild.members.cache.get(message.author.id); const content = args.join(" ") || "No status provided."; @@ -19,7 +14,7 @@ module.exports = { `${message.author.username} is set into AFK.\nStatus : ${content}` ) .setTimestamp() - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) .setColor(client.color) .setAuthor( message.author.tag, diff --git a/commands/Utilities/avatar.js b/commands/Utilities/avatar.js @@ -5,11 +5,6 @@ module.exports = { aliases: ["av"], usage: "{User}", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const member = message.mentions.members.first() || @@ -46,7 +41,7 @@ module.exports = { })})**` ) .setImage(member.user.displayAvatarURL({ dynamic: true, size: 1024 })) - .setFooter("Made by Cath Team") + .setFooter(`Made by ${client.author}`) .setURL(client.web) .setTimestamp(); return message.inlineReply(embed); diff --git a/commands/Utilities/botinfo.js b/commands/Utilities/botinfo.js @@ -12,11 +12,6 @@ module.exports = { name: "botinfo", description: "Check the info of the bot", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const core = os.cpus()[0]; const embed = new MessageEmbed() diff --git a/commands/Utilities/choose.js b/commands/Utilities/choose.js @@ -5,11 +5,6 @@ module.exports = { description: "Choose random things", usage: "(Choices)", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const split = args.join(" ").split(" "); if (!split) return client.err(message, "Utilities", "choose", 0); diff --git a/commands/Utilities/emoji.js b/commands/Utilities/emoji.js @@ -5,11 +5,6 @@ module.exports = { usage: "(Emoji)", description: "Show an emoji URL", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args.length) return client.err(message, "Utilities", "emoji", 11); for (const rawEmoji of args) { diff --git a/commands/Utilities/emojiadd.js b/commands/Utilities/emojiadd.js @@ -5,13 +5,9 @@ module.exports = { aliases: ["addemoji"], description: "Show an emoji URL or add the emoji to the server", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args.length) return client.err(message, "Utilities", "emojiadd", 0); + if (message.attachments) { message.attachments.map(m => { if ( @@ -23,14 +19,19 @@ module.exports = { ) { try { if (message.attachments.map(u => u.size) > 256000) - return client.err(message, "Utilities", "emojiadd", 19); - + return client.err(message, "Utilities", "emojiadd", 50); if (args[0].length < 2 || args[0].match(/\W/)) return client.err(message, "Utilities", "emojiadd", 49); message.attachments.map(u => { try { - message.guild.emojis.create(u.url, args[0]); - message.inlineReply(`Added :${args[0]}: to the server`); + message.guild.emojis.create(u.url, args[0]).then(msg => { + const em = message.guild.emojis.cache.find( + a => a.name == args[0] + ); + message.inlineReply( + `Added <:${em.name}:${em.id}> to the server` + ); + }); } catch (e) { console.log(e); return client.err(message, "Utilities", "emojiadd", 999); @@ -45,10 +46,12 @@ module.exports = { } if (args[0].includes("https")) { try { - if (args[0].length < 2 || args[0].match(/\W/)) + if (args[1].length < 2 || args[1].match(/\W/)) return client.err(message, "Utilities", "emojiadd", 49); - message.guild.emojis.create(args[0], args[1]); - message.inlineReply(`Added :${args[1]}: to the server`); + message.guild.emojis.create(args[0], args[1]).then(msg => { + const em = message.guild.emojis.cache.find(a => a.name == args[1]); + message.inlineReply(`Added <:${em.name}:${em.id}> to the server`); + }); } catch (e) { console.log(e); return client.err(message, "Utilities", "emojiadd", 999); diff --git a/commands/Utilities/esnipe.js b/commands/Utilities/esnipe.js @@ -6,11 +6,6 @@ module.exports = { aliases: ["esnipe"], usage: "{Channel}", description: "Snipe an edited message", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { let channel = message.mentions.channels.first() || diff --git a/commands/Utilities/help.js b/commands/Utilities/help.js @@ -1,8 +1,6 @@ const { MessageEmbed } = require("discord.js"); const { readdirSync } = require("fs"); -const { ca } = require("../../config.json"); const ms = require("ms"); -require("../../inlinereply"); module.exports = { name: "help", @@ -10,21 +8,16 @@ module.exports = { usage: "(Command/Category)", description: "Shows all available bot commands", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const p = await client.prefix(message); const emoji = { - CODM: "<a:AA99_codm_logo:821348295045283880>", - Config: "<:staff:829718501224480788>", + CODM: "<a:AA99_codm_logo:840231960441257995>", + Config: "<:staff:840231971526803467>", Economy: client.currency, Fun: "<a:lollll:804325253265621012>", Moderation: ":tools:", Utilities: ":gear:", - Music: "<a:music:824231520993935370>", + Music: "<a:music:840231980692144130>", Giveaway: "<a:DankCat:798963811902160896>", }; if (!args[0]) { @@ -42,9 +35,21 @@ module.exports = { categories.push(data); }); const embed = new MessageEmbed() - .setTitle("**cath.exe commands**") + .setTitle(`**${client.user.username} commands**`) .addFields(categories) - .setDescription(`Links:${ca}`) + + .addField( + "**Invite Link**", + `**Invite me to your server by clicking [here](https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands)**` + ) + .addField( + "**Support Server Invite**", + "**Join the support server by clicking [here](https://discord.gg/SbQHChmGcp)**" + ) + .addField( + "**Premium**", + "**You can either boost support server or gift a nitro to one of the Developer of Cath Team to be premium user**" + ) .setURL(client.web) .setFooter( `Requested by ${message.author.tag}`, @@ -98,7 +103,7 @@ module.exports = { .setURL(client.web) .setColor(client.color) .setTitle( - "<a:AA99_codm_logo:821348295045283880>**CODM Commands**<a:AA99_codm_logo:821348295045283880>" + "<a:AA99_codm_logo:840231960441257995>**CODM Commands**<a:AA99_codm_logo:840231960441257995>" ) ); } else if (args[0] === "config") { @@ -131,9 +136,7 @@ module.exports = { .setTimestamp() .setURL(client.web) .setColor(client.color) - .setTitle( - "<a:BigManRich:815137721084674048>**Economy Commands**<a:BigManRich:815137721084674048>" - ) + .setTitle(`${client.currency}**Economy Commands**${client.currency}`) ); } else if (args[0] === "fun") { const commandList = []; @@ -168,7 +171,7 @@ module.exports = { .setURL(client.web) .setColor(client.color) .setTitle( - "<a:music:824231520993935370>**Music Commands**<a:music:824231520993935370>" + "<a:music:840231980692144130>**Music Commands**<a:music:840231980692144130>" ) ); } else if (args[0] === "giveaway") { @@ -200,109 +203,54 @@ module.exports = { `There isn't any command or category named "${args[0]}"` ); } else { - let BotPerm; - let UserPerm; - const UserPermissions = [command.UserPerm ? command.UserPerm : ""]; - const BotPermissions = [command.BotPerm ? command.BotPerm : ""]; - BotPermissions.forEach(perm => { - if (BotPermissions.includes(command.BotPerm)) - BotPerm = `${perm - .replace("CREATE_INSTANT_INVITE", "Create Invite") - .replace("KICK_MEMBERS", "Kick Members") - .replace("BAN_MEMBERS", "Ban Members") - .replace("ADMINISTRATOR", "Administrator") - .replace("MANAGE_CHANNELS", "Manage Channels") - .replace("MANAGE_GUILD", "Manage Guild") - .replace("ADD_REACTIONS", "Add Reactions") - .replace("VIEW_AUDIT_LOG", "View Audit Log") - .replace("PRIORITY_SPEAKER", "Priority Speaker") - .replace("STREAM", "Stream") - .replace("VIEW_CHANNEL", "View Channel") - .replace("SEND_MESSAGES", "Send Messages") - .replace("SEND_TTS_MESSAGES", "Send TTS Messages") - .replace("MANAGE_MESSAGES", "Manage Messages") - .replace("EMBED_LINKS", "Embed Links") - .replace("ATTACH_FILES", "Attach Files") - .replace("READ_MESSAGE_HISTORY", "Read Message History") - .replace("MENTION_EVERYONE", "Mention Everyone") - .replace("USE_EXTERNAL_EMOJIS", "Use External Emojis") - .replace("VIEW_GUILD_INSIGHTS", "View Guild Insights") - .replace("CONNECT", "Connect") - .replace("SPEAK", "Speak") - .replace("MUTE_MEMBERS", "Mute Members") - .replace("DEAFEN_MEMBERS", "Defean Members") - .replace("MOVE_MEMBERS", "Move Members") - .replace("USE_VAD", "Use VAD") - .replace("CHANGE_NICKNAME", "Change Nickname") - .replace("MANAGE_NICKNAMES", "Manage Nicknames") - .replace("MANAGE_ROLES", "Manage Roles") - .replace("MANAGE_WEBHOOKS", "Manage Webhooks") - .replace("MANAGE_EMOJIS", "Manage Emojis")}\n`; - }); - UserPermissions.forEach(perm => { - if (UserPermissions.includes(command.UserPerm)) - UserPerm = `${perm - .replace("CREATE_INSTANT_INVITE", "Create Invite") - .replace("KICK_MEMBERS", "Kick Members") - .replace("BAN_MEMBERS", "Ban Members") - .replace("ADMINISTRATOR", "Administrator") - .replace("MANAGE_CHANNELS", "Manage Channels") - .replace("MANAGE_GUILD", "Manage Guild") - .replace("ADD_REACTIONS", "Add Reactions") - .replace("VIEW_AUDIT_LOG", "View Audit Log") - .replace("PRIORITY_SPEAKER", "Priority Speaker") - .replace("STREAM", "Stream") - .replace("VIEW_CHANNEL", "View Channel") - .replace("SEND_MESSAGES", "Send Messages") - .replace("SEND_TTS_MESSAGES", "Send TTS Messages") - .replace("MANAGE_MESSAGES", "Manage Messages") - .replace("EMBED_LINKS", "Embed Links") - .replace("ATTACH_FILES", "Attach Files") - .replace("READ_MESSAGE_HISTORY", "Read Message History") - .replace("MENTION_EVERYONE", "Mention Everyone") - .replace("USE_EXTERNAL_EMOJIS", "Use External Emojis") - .replace("VIEW_GUILD_INSIGHTS", "View Guild Insights") - .replace("CONNECT", "Connect") - .replace("SPEAK", "Speak") - .replace("MUTE_MEMBERS", "Mute Members") - .replace("DEAFEN_MEMBERS", "Defean Members") - .replace("MOVE_MEMBERS", "Move Members") - .replace("USE_VAD", "Use VAD") - .replace("CHANGE_NICKNAME", "Change Nickname") - .replace("MANAGE_NICKNAMES", "Manage Nicknames") - .replace("MANAGE_ROLES", "Manage Roles") - .replace("MANAGE_WEBHOOKS", "Manage Webhooks") - .replace("MANAGE_EMOJIS", "Manage Emojis")}\n`; - }); + if (command.UserPerm && Array.isArray(command.UserPerm)) { + UserPermissions = command.UserPerm; + } else UserPermissions = [command.UserPerm ? command.UserPerm : ""]; + if (command.BotPerm && Array.isArray(command.BotPerm)) { + BotPermissions = command.BotPerm; + } else BotPermissions = [command.BotPerm ? command.BotPerm : ""]; + const BotPerms = BotPermissions.map(x => + x + .split("_") + .map(y => y[0] + y.substring(1, y.length).toLowerCase()) + .join(" ") + ).join(", "); + const UserPerms = UserPermissions.map(x => + x + .split("_") + .map(y => y[0] + y.substring(1, y.length).toLowerCase()) + .join(" ") + ).join(", "); const embed = new MessageEmbed() .setTitle(`"${command.name}" command details`) .addField( "**Command**:", command.name ? `\`${command.name}\`` : "N/A" - ) - .addField( - "**Aliases**:", - command.aliases ? `\`${command.aliases.join(", ")}\`` : "N/A" - ) - .addField( + ); + if (command.aliases) { + embed.addField("**Aliases**:", `\`${command.aliases.join(", ")}\``); + } + if (command.usage) { + embed.addField( "**Usage**:", - command.usage - ? `\`${p}${command.name} ${command.usage}\`` - : `\`${p}${command.name}\`` - ) - .addField( - "**Description**:", - command.description ? command.description : "N/A" - ) - .addField( - "**Cooldown**:", - command.timeout ? ms(command.timeout, { long: true }) : "N/A" - ) - .addField( - "**Required User Permission**:", - UserPerm ? UserPerm : "N/A" - ) - .addField("**Required Bot Permission**:", BotPerm ? BotPerm : "N/A") + `\`${p}${command.name} ${command.usage}\`` + ); + } else { + embed.addField("**Usage**:", `\`${p}${command.name}\``); + } + if (command.description) { + embed.addField("**Description**:", command.description); + } + if (command.timeout) { + embed.addField("**Cooldown**:", ms(command.timeout, { long: true })); + } + if (command.UserPerm) { + embed.addField("**Required User Permission**:", UserPerms); + } + if (command.BotPerm) { + embed.addField("**Required Bot Permission**:", BotPerms); + } + embed .setFooter( `Requested by ${message.author.tag}`, message.author.displayAvatarURL({ dynamic: true }) diff --git a/commands/Utilities/hexcolor.js b/commands/Utilities/hexcolor.js @@ -1,84 +0,0 @@ -const Canvas = require("canvas"); -const { - Client, - Message, - MessageEmbed, - MessageAttachment, -} = require("discord.js"); -const axios = require("axios"); - -module.exports = { - name: "hexcolor", - usage: "(Hex Color Code)", - description: "Get Hex and RGB info of a color", - aliases: ["hex"], - category: "Utilities", - run: async (client, message, args) => { - let color; - if (args[0]) { - if (/(#|0x)([0-9A-F]{6})/i.test(args[0])) { - color = args[0].match(/(#|0x)([0-9A-F]{6})/i)[2]; - } else { - return client.err(message, "Utilities", "hexcolor", 101); - } - } else { - color = message.member.displayHexColor; - } - try { - message.channel.startTyping(); - const aa = color.replace("#", "", "0x", ""); - const colour = await axios.get( - `https://www.thecolorapi.com/scheme?hex=${aa}` - ); - const canvas = Canvas.createCanvas(200, 200); - const ctx = canvas.getContext("2d"); - ctx.beginPath(); - ctx.rect(0, 0, 200, 200); - ctx.fillStyle = `${colour.data.seed.hex.value}`; - ctx.fill(); - const rightpic = new MessageAttachment(canvas.toBuffer(), "wea.jpg"); - const canvasx = Canvas.createCanvas(500, 100); - const ctxt = canvasx.getContext("2d"); - let y = canvasx.height / 2; - ctxt.font = "12px Roboto"; - ctxt.textAlign = "center"; - let addup = 0; - for (let i = 0; i < 5; i++) { - ctxt.beginPath(); - ctxt.rect(addup, 0, 100, 100); - ctxt.fillStyle = `${colour.data.colors[i].hex.value}`; - ctxt.fill(); - addup = addup + 100; - ctxt.beginPath(); - ctxt.rect(addup - 80, y - 15, 60, 30); - ctxt.fillStyle = `black`; - ctxt.fill(); - ctxt.fillStyle = `white`; - ctxt.fillText( - `${colour.data.colors[i].hex.value}`, - addup - 51, - y + 4.3 - ); - } - const attachment = new MessageAttachment(canvasx.toBuffer(), "color.jpg"); - const embed = new MessageEmbed() - .setColor(`0x${colour.data.seed.hex.value}`) - .setDescription( - `\`HEX: ${colour.data.seed.hex.value} RGB: ${colour.data.seed.rgb.value}\`\n🔽Color Scheme🔽` - ) - .setTitle("Color Information (Click here for more info)") - .setURL(`https://www.colorhexa.com/${colour.data.seed.hex.clean}`) - .attachFiles(attachment) - .setURL(client.web) - .setImage("attachment://color.jpg") - .attachFiles(rightpic) - .setThumbnail("attachment://wea.jpg"); - message.channel.send(embed); - } catch (e) { - console.log(e); - return client.err(message, "Utilities", "hexcolor", 999); - } finally { - message.channel.stopTyping(); - } - }, -}; diff --git a/commands/Utilities/invite.js b/commands/Utilities/invite.js @@ -2,17 +2,28 @@ const { Client, Message, MessageEmbed } = require("discord.js"); module.exports = { name: "invite", + aliases: ["support", "bot", "server"], description: "Get bot invite link", - aliases: ["bot"], category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { - message.inlineReply( - `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands` - ); + var embed = new MessageEmbed() + .setFooter(`Made by ${client.author}`) + .setColor(client.color) + .setTimestamp() + .setAuthor(message.author.tag, message.author.displayAvatarURL) + .setTitle(`Support/Invite`) + .addField( + "**Invite Link**", + `**Invite me to your server by clicking [here](https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands)**` + ) + .addField( + "**Support Server Invite**", + "**Join the support server by clicking [here](https://discord.gg/SbQHChmGcp)**" + ) + .addField( + "**Premium**", + "**You can either boost support server or gift a nitro to one of the Developer of Cath Team to be premium user**" + ); + message.inlineReply(embed); }, }; diff --git a/commands/Utilities/permission.js b/commands/Utilities/permission.js @@ -5,11 +5,6 @@ module.exports = { usage: "(User)", description: "Show user's permission in server/channel", category: "Utilities", - /** - * @param {Client}client - * @param {Message}message - * @param {String[]args} - */ run: async (client, message, args) => { const yes = "✔️"; const no = "❌"; diff --git a/commands/Utilities/poll.js b/commands/Utilities/poll.js @@ -4,11 +4,6 @@ module.exports = { name: "poll", description: "Join a poll for develop of this bot", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const questions = [ "Which statistic of gun you want to see?", diff --git a/commands/Utilities/rank.js b/commands/Utilities/rank.js @@ -0,0 +1,41 @@ +const { MessageAttachment } = require("discord.js"); +const Levels = require("discord-xp"); +const canvacord = require("canvacord"); +module.exports = { + name: "rank", + description: "Shows the current level and rank of the user!", + usage: "{User}", + timeout: 5000, + category: "Utilities", + run: async (client, message, args) => { + if (!message.guild) return; + if (message.author.bot) return; + const target = + message.mentions.users.first() || + message.guild.members.cache.find( + r => r.user.username.toLowerCase() === args[0].toLocaleLowerCase() + ) || + message.guild.members.cache.find( + r => r.displayName.toLowerCase() === args[0].toLocaleLowerCase() + ) || + message.guild.members.cache.get(args[0]) || + message.author; + const user = await Levels.fetch(target.id, message.guild.id, true); + if (!user) return client.err(message, "Utilities", "rank", 10); + const neededXp = Levels.xpFor(parseInt(user.level) + 1); + const Rank = new canvacord.Rank() + .setAvatar(target.displayAvatarURL({ dynamic: false, format: "png" })) + .setCurrentXP(user.xp) + .setRank(parseInt(user.position)) + .setLevel(user.level) + .setRequiredXP(neededXp) + .setStatus(target.presence.status) + .setProgressBar("BLACK", "COLOR") + .setUsername(target.username) + .setDiscriminator(target.discriminator); + Rank.build().then(data => { + const attachment = new MessageAttachment(data, "RankCard.png"); + message.inlineReply(attachment); + }); + }, +}; diff --git a/commands/Utilities/report.js b/commands/Utilities/report.js @@ -5,11 +5,6 @@ module.exports = { name: "report", description: "Report a bug of the bot", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const questions = [ "Describe the bug", diff --git a/commands/Utilities/servericon.js b/commands/Utilities/servericon.js @@ -4,11 +4,6 @@ module.exports = { name: "servericon", description: "View the icon of the server", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const Embed = new MessageEmbed() .setTitle(`Icon of ${message.guild.name}`) diff --git a/commands/Utilities/serverinfo.js b/commands/Utilities/serverinfo.js @@ -35,11 +35,6 @@ module.exports = { name: "serverinfo", description: "Check the info of the server", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const roles = message.guild.roles.cache .sort((a, b) => b.position - a.position) diff --git a/commands/Utilities/snipe.js b/commands/Utilities/snipe.js @@ -4,11 +4,6 @@ module.exports = { name: "snipe", description: "Snipes a deleted message.", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { var i = 0; var description = ""; @@ -18,14 +13,13 @@ module.exports = { message.author.displayAvatarURL({ dynamic: true }) ) .setColor(client.color) - .setFooter("Made by Cath Team") + .setFooter(`Made by ${client.author}`) .setURL(client.web); client.snipes.reverse().forEach(msg => { if (msg.channel.id != message.channel.id) return; if (i >= 5) return; if (msg.attachment) { if (msg.attachment.length == 1) { - console.log("one"); description = description + `\n\n**Author:** ${msg.author.username}#${ diff --git a/commands/Utilities/suggest.js b/commands/Utilities/suggest.js @@ -3,11 +3,6 @@ module.exports = { name: "suggest", description: "Make a suggestion of the bot", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const questions = [ "Describe the suggestion", diff --git a/commands/Utilities/support.js b/commands/Utilities/support.js @@ -1,16 +0,0 @@ -const { Client, Message, MessageEmbed } = require("discord.js"); - -module.exports = { - name: "support", - description: "Get support server invite link", - aliases: ["server"], - category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ - run: async (client, message, args) => { - message.inlineReply(`https://discord.gg/SbQHChmGcp`); - }, -}; diff --git a/commands/Utilities/timer.js b/commands/Utilities/timer.js @@ -5,11 +5,6 @@ module.exports = { description: "Set a timer for yourself", usage: "(Time)", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { if (!args[0]) { return client.err(message, "Utilities", "timer", 19); diff --git a/commands/Utilities/userinfo.js b/commands/Utilities/userinfo.js @@ -6,11 +6,6 @@ module.exports = { description: "Check the info of a user", usage: "{User}", category: "Utilities", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ run: async (client, message, args) => { const member = message.mentions.members.first() || @@ -24,34 +19,34 @@ module.exports = { ) || message.member; const flags = { - DISCORD_EMPLOYEE: "Discord Staff<:staff:829718501224480788>", - DISCORD_PARTNER: "Partnered Server Owner<:partner:829718449436622858>", - BUGHUNTER_LEVEL_1: "Discord Bug Hunter<:bughunter:829718598343196672>", - BUGHUNTER_LEVEL_2: "Discord Bug Hunter<:bughunterlv2:829718545298358313>", - HYPESQUAD_EVENTS: "HypeSquad Events<:HypeSquad:829718113913405440>", - HOUSE_BRAVERY: "HypeSquad Bravery<:bravery:829718178527182869>", - HOUSE_BRILLIANCE: "HypeSquad Brilliance<:brilliance:829718391727456311>", - HOUSE_BALANCE: "HypeSquad Balance<:balance:829718333204856854>", - EARLY_SUPPORTER: "Early Supporter<:earlysupporter:829717947052195880>", + DISCORD_EMPLOYEE: "Discord Staff<:staff:840231971526803467>", + DISCORD_PARTNER: "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:822497433933709343>", + VERIFIED_BOT: "Verified Bot<:VerifiedBot:840231982054375425>", VERIFIED_DEVELOPER: - "Early Verified Bot Developer<:discord_bot_dev:829717061802131466>", + "Early Verified Bot Developer<:discord_bot_dev:840231906200387666>", }; let status; switch (member.user.presence.status) { case "online": - status = "<:online:829714260199997482>Online"; + status = "<:online:840231921123721237>Online"; break; case "dnd": - status = "<:do_not_disturb:829714335952535632>Do Not Disturb"; + status = "<:do_not_disturb:840231907715448842>Do Not Disturb"; break; case "idle": - status = "<:idle:829714296211505182>Idle"; + status = "<:idle:840231935485149184>Idle"; break; case "offline": - status = "<:offline:829714364511682582>Offline"; + status = "<:offline:840231954897305620>Offline"; break; } let x = Date.now() - member.user.createdAt; diff --git a/config.json b/config.json @@ -1,6 +1,6 @@ { "prefix": "C.", - "mongo": "mongodb://127.0.0.1:27017", + "mongo": "mongodb://127.0.0.1:27017/cath", "URL": "https://cath.gq/", "color": "02023a", "soundcloud": "dmDh7QSlmGpzH9qQoH1YExYCGcyYeYYC", diff --git a/events/afk.js b/events/afk.js @@ -1,7 +1,6 @@ -const client = require("../index"); +const client = require("../bot"); const moment = require("moment"); -require("../inlinereply"); -client.on("message", async (message) => { +client.on("message", async message => { if (message.author.bot) return; if (!message.guild) return; const dataa = await client.data.getUser(message.author.id); diff --git a/events/emoji.js b/events/emoji.js @@ -1,4 +1,4 @@ -const client = require("../index"); +const client = require("../bot"); client.on("message", async message => { function Check(str) { if ( @@ -12,9 +12,8 @@ client.on("message", async message => { } if (message.content.startsWith(":") && message.content.endsWith(":")) { let EmojiName = message.content.slice(1, -1); - + if (client.path.includes(message.guild.id)) return; if (Check(EmojiName) === true) { - console.log("cmeoji"); const channel = client.channels.cache.get(message.channel.id); try { if (message.author.bot) return; @@ -48,8 +47,8 @@ client.on("message", async message => { avatarURL: message.author.displayAvatarURL({ dynamic: true }), }); message.delete(); - } catch (error) { - console.log(`Error :\n${error}`); + } catch (e) { + console.log(e); } } else return; } else return; diff --git a/events/goodBye.js b/events/goodBye.js @@ -1,5 +1,5 @@ const { MessageAttachment } = require("discord.js"); -const client = require("../index"); +const client = require("../bot"); const schema = require("../models/guilds"); const canvas = require("discord-canvas"); diff --git a/events/guild.js b/events/guild.js @@ -1,4 +1,4 @@ -const client = require("../index"); +const client = require("../bot"); const { MessageEmbed } = require("discord.js"); const { Welcome } = require("../config.json"); client.on("guildMemberAdd", async member => { diff --git a/events/guildCreate.js b/events/guildCreate.js @@ -1,4 +1,4 @@ -const client = require("../index"); +const client = require("../bot"); const { MessageEmbed } = require("discord.js"); const db = require("../models/guilds"); const config = require("../config.json"); @@ -16,7 +16,8 @@ client.on("guildCreate", guild => { `**>Owner ID**: \n${guild.owner.id}`, ]) .setFooter( - `${client.user.username} Currently in ${client.guilds.cache.size} servers` + `${client.user.username} Currently in ${client.guilds.cache.size} servers`, + client.user.displayAvatarURL() ) .setTimestamp() .setThumbnail(guild.iconURL({ dynamic: true })) diff --git a/events/guildDelete.js b/events/guildDelete.js @@ -1,13 +1,13 @@ -const client = require("../index"); +const client = require("../bot"); const db = require("../models/guilds"); const { prefix } = require("../config.json"); const { MessageEmbed } = require("discord.js"); client.on("guildDelete", async guild => { - client.data.DelGuild(guild.id).then(() => console.log("Deleted Data")); + client.data.DelGuild(guild.id); client.ServerLog.send( new MessageEmbed() - .setTitle("Deleted from server") + .setTitle("Deleted Server") .addField("Server Info", [ `**>Server Name**: \n${guild.name}`, `**>Server ID**: \n${guild.id}`, @@ -18,7 +18,8 @@ client.on("guildDelete", async guild => { `**>Owner ID**: \n${guild.owner.id}`, ]) .setFooter( - `${client.user.username} Currently in ${client.guilds.cache.size} servers` + `${client.user.username} Currently in ${client.guilds.cache.size} servers`, + client.user.displayAvatarURL() ) .setTimestamp() .setThumbnail(guild.iconURL({ dynamic: true })) diff --git a/events/level.js b/events/level.js @@ -1,5 +1,5 @@ const Levels = require("discord-xp"); -const client = require("../index"); +const client = require("../bot"); const users = require("../models/users"); Levels.setURL(require("../config.json").mongo); client.on("message", async message => { diff --git a/events/log.js b/events/log.js diff --git a/events/message.js b/events/message.js @@ -1,4 +1,4 @@ -const client = require("../index"); +const client = require("../bot"); const leven = require("leven"); const { Collection, MessageEmbed } = require("discord.js"); const { prefix } = require("../config.json"); @@ -7,14 +7,10 @@ const ms = require("ms"); const schema = require("../models/custom-commands"); const Timeout = new Collection(); const Timeout2 = new Collection(); +const db = require("../models/status"); client.on("message", async message => { const p = await client.prefix(message); if (message.author.bot) return; - if (!message.content.startsWith(p)) return; - if (!message.guild) return; - if (!message.member) { - message.member = await message.guild.fetchMember(message); - } if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) { const _ = new MessageEmbed() .setTitle("cath.exe") @@ -25,29 +21,41 @@ client.on("message", async message => { ) .setThumbnail(client.user.displayAvatarURL()) .setURL(client.web) - .setFooter("Made by Cath Team") + .setFooter(`Made by ${client.author}`) .setTimestamp() .setColor(client.color); - return message.inlineReply(_).then(m => m.delete({ timeout: 10000 })); + return message.inlineReply(_).then(m => m.delete({ timeout: 15000 })); } + if (!message.content.toLowerCase().startsWith(p.toLowerCase())) return; + if (!message.guild) return; + if (!message.member) { + message.member = await message.guild.fetchMember(message); + } + + db.findOne({ Bot: client.user.id }, async (err, data) => { + if (!data) { + new db({ + Bot: client.user.id, + Status: "false", + }); + } else { + if ( + data.Status && + data.Status == "true" && + !client.owners.includes(message.author.id) + ) + return message.inlineReply( + `**${client.user.username}** is currently in maintenance.\nYou can use **cath.exe#9686** or **Cath 2#7414** if it is online\nIf you need help, please contact **Cat drinking a cat#0795** or **Ń1ght#0001**` + ); + } + }); const data = {}; let guildDB = await client.data.getGuild(message.guild.id); if (!guildDB) return; let userDB = await client.data.getUser(message.author.id); if (!userDB) return; - let botDB = await client.data.getBot(client.user.id); - if (!botDB) return; - data.Bot = botDB; data.Guild = guildDB; data.User = userDB; - if ( - botDB && - botDB.Status == "true" && - !client.owners.includes(message.author.id) - ) - return message.inlineReply( - `**${client.user.username}** is currently in maintenance.\nYou can use **cath.exe#9686** or **Cath 2#7414** if it is online\nIf you need help, please contact **Cat drinking a cat#0795** or **Ń1ght#0001**` - ); if (!guildDB) { await client.data.CreateGuild(message.guild.id); } @@ -119,10 +127,10 @@ client.on("message", async message => { ) .setColor(client.color) .setDescription( - `You aren't a premium user. Please join [this](https://discord.gg/SbQHChmGcp) server and know more` + `You aren't a premium user. You can either boost support server or gift a nitro to one of the Developer of Cath Team to be premium user` ) .setTimestamp() - .setFooter(`Made by Cath Team`) + .setFooter(`Made by ${client.author}`) ); } } diff --git a/events/messageUpdate.js b/events/messageUpdate.js @@ -1,4 +1,4 @@ -const client = require("../index"); +const client = require("../bot"); client.on("messageUpdate", (message, newMessage) => { function getAllTextFromEmbed(embed) { let text = ""; diff --git a/events/messsageDelete.js b/events/messsageDelete.js @@ -1,4 +1,4 @@ -const client = require("../index.js"); +const client = require("../bot"); client.on("messageDelete", async message => { let all = []; if (message.attachments) { diff --git a/events/reactionroles.js b/events/reactionroles.js @@ -1,4 +1,4 @@ -const client = require("../index"); +const client = require("../bot"); const Schema = require("../models/reaction"); client.on("messageReactionAdd", async (reaction, user) => { diff --git a/events/ready.js b/events/ready.js @@ -1,4 +1,4 @@ -const client = require("../index"); +const client = require("../bot"); const config = require("../config.json"); const prefix = config.prefix; const version = require("../package.json").version; diff --git a/events/slash.js b/events/slash.js @@ -1,5 +1,5 @@ const { Client, Message, MessageEmbed } = require("discord.js"); -const client = require("../index"); +const client = require("../bot"); async function createApiMessage(interaction, content) { const apiMessage = await APIMessage.create( client.channels.resolve(interaction.channel_id), @@ -18,7 +18,7 @@ client.on("ready", async () => { }, }); }); -client.ws.on("INTERACTION_CREATE", async (interaction) => { +client.ws.on("INTERACTION_CREATE", async interaction => { let command = interaction.data.name.toLowerCase(); let args = interaction.data.options; if (command === "help") { diff --git a/index.js b/index.js @@ -1,110 +1,14 @@ -const { - Client, - Collection, - WebhookClient, - MessageEmbed, -} = require("discord.js"); -const { GiveawaysManager } = require("discord-giveaways"); -const fs = require("fs"); -const config = require("./config.json"); -require("dotenv").config(); -const client = new Client({ - disableEveryone: true, - disableMentions: "everyone", - restTimeOffset: 0, - partials: ["MESSAGE", "CHANNEL", "REACTION", "GUILD_MEMBER"], - intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS", "GUILD_PRESENCES"], -}); -module.exports = client; -client.color = config.color; -client.author = "Cath Team"; -client.web = config.URL; -client.DMLog = new WebhookClient(process.env.DMLogID, process.env.DMLogToken); -client.CMDLog = new WebhookClient( - process.env.CMDLogID, - process.env.CMDLogToken -); -client.ReadyLog = new WebhookClient( - process.env.ReadyLogID, - process.env.ReadyLogToken -); -client.ServerLog = new WebhookClient( - process.env.ServerLogID, - process.env.ServerLogToken -); -client.ErrorLog = new WebhookClient( - process.env.ErrorLogID, - process.env.ErrorLogToken -); -process.on("unhandledRejection", async err => { - if (client.user) { - if (client.user.id === client.user.id) { - const embed = new MessageEmbed() - .setTitle("UnhandledRejection Error") - .setDescription(`\`\`\`ini\n${err.stack}\`\`\``) - .setTimestamp() - .setColor(client.color) - .setFooter(client.user.username); - client.ErrorLog.send(embed); - } - } - return console.log(err); -}); -client.SuggestionLog = config.Suggestion; -client.ReportLog = config.Report; -client.commands = new Collection(); -client.aliases = new Collection(); -client.events = new Collection(); -client.snipes = []; -client.esnipes = new Collection(); -client.hide = new Collection(); -client.queue = new Map(); -client.Timers = new Map(); -client.cat = config.ca; -client.function = require("./util/functions/function"); -client.data = require("./util/functions/mongoose"); -client.err = require("./util/err"); -client.data - .connect(config.mongo) - .then(() => console.log("Connected to MongoDB!")) - .catch(e => console.log(e)); -client.owners = [ - "452076196419600394", - "749692825402212494", - "766645910087139338", - "755476040029306952", - "534027706325532694", -]; -client.currency = "<:cp:836630372661329990>"; -client.path = [ - "614423108388126731", - "767173194943168542", - "783633408738721834", - "718762019586572341", - "784052348561522730", - "840225563193114624", - "800396461229080619", -]; -client.xp = [ - "749135655350697986", - "801677847730585620", - "796316316880732160", - "755074176431423609", - "712255334298943569", - "639498286297907230", -]; -client.giveaways = new GiveawaysManager(client, { - storage: "./util/Data/giveaways.json", - updateCountdownEvery: 1000, - default: { - botsCanWin: false, - embedColor: client.color, - reaction: "🎉", - }, -}); -client.categories = fs.readdirSync("./commands/"); -client.paths = fs.readdirSync("./cat/"); -["command"].forEach(handler => { - require(`./util/command-handler`)(client); -}); -client.login(process.env.TOKEN); +const { ShardingManager } = require("discord.js"); +const manger = new ShardingManager(`./bot.js`, { + token: "NzY1NTQyNDI0OTY4ODIyNzg1.X4WU8Q.gEwsAO8uMyJLZ2v7xq_TSRODvfk", + totalShards: `auto`, +}); + +manger.on(`shardCreate`, shard => { + console.log( + `[${new Date().toString().split(" ", 5).join(" ")}] Spawned shard #${ + shard.id + }` + ); +}); +manger.spawn(manger.totalShards, 10000); diff --git a/models/guilds.js b/models/guilds.js @@ -16,10 +16,9 @@ module.exports = mongoose.model( type: String, default: "null", }, - Log: { - type: String, - default: "null", - }, + Log: { type: String, default: "null" }, + LogWebhookID: { type: String, default: "null" }, + LogWebhookToken: { type: String, default: "null" }, Premium: { type: Boolean, default: false, diff --git a/package-lock.json b/package-lock.json @@ -375,6 +375,11 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==" }, + "aesthetically": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/aesthetically/-/aesthetically-0.0.5.tgz", + "integrity": "sha512-jrMnbCfNbqq/z34J+FZI6sYu/cnYv1QrpWVZUDshdfAGPojZ8OWt8gC+yYR6PJZK46fzL9HOWF9mP6Am9Dr7zQ==" + }, "agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -810,9 +815,9 @@ } }, "canvacord": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/canvacord/-/canvacord-5.2.0.tgz", - "integrity": "sha512-Cr+ZM/N2Dhjbvkhm0Tu0Kg3oCx67J/koBFHoSKIrLzOvsiaiFFPAXIRpaJiTXeRVXk8adZa+g1812dwcjmPq6g==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/canvacord/-/canvacord-5.2.1.tgz", + "integrity": "sha512-vauEvj3QEDNyza6laa4C5cKiOSld/O+Uvjr8uzD+ANUxaWtprHE6372J7oXMqrjPEsOd4XAwKuy5zlVPe4a7OQ==", "requires": { "@canvacord/assets": "^1.0.2", "@canvacord/emoji-parser": "^1.0.1", @@ -820,35 +825,6 @@ "gifencoder": "^2.0.1", "moment": "^2.29.1", "moment-duration-format": "^2.3.2" - }, - "dependencies": { - "canvas": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.7.0.tgz", - "integrity": "sha512-pzCxtkHb+5su5MQjTtepMDlIOtaXo277x0C0u3nMOxtkhTyQ+h2yNKhlROAaDllWgRyePAUitC08sXw26Eb6aw==", - "requires": { - "nan": "^2.14.0", - "node-pre-gyp": "^0.15.0", - "simple-get": "^3.0.3" - } - }, - "node-pre-gyp": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.15.0.tgz", - "integrity": "sha512-7QcZa8/fpaU/BKenjcaeFF9hLz2+7S9AqyXFhlH/rilsQ/hPZKK32RtR5EQHJElgu+q5RfbJ34KriI79UWaorA==", - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.3", - "needle": "^2.5.0", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4.4.2" - } - } } }, "canvas": { @@ -1114,9 +1090,9 @@ } }, "css-what": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.0.0.tgz", - "integrity": "sha512-qxyKHQvgKwzwDWC/rGbT821eJalfupxYW2qbSJSAtdSTimsr/MlaGONoNLllaUPZWf8QnbcKM/kPVYUQuEKAFA==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.0.1.tgz", + "integrity": "sha512-FYDTSHb/7KXsWICVsxdmiExPjCfRC4qRFBdVwv7Ax9hMnvMmEjP9RfxTEZ3qPZGmADDn2vAKSo9UcN1jKVYscg==" }, "cssom": { "version": "0.4.4", @@ -1170,21 +1146,6 @@ "whatwg-url": "^8.0.0" } }, - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "requires": { - "ms": "^2.1.1" - }, - "dependencies": { - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - } - } - }, "decimal.js": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", @@ -1861,14 +1822,6 @@ "rimraf": "^2.2.8" } }, - "fs-minipass": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", - "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", - "requires": { - "minipass": "^2.6.0" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2214,14 +2167,6 @@ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, - "ignore-walk": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", - "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", - "requires": { - "minimatch": "^3.0.4" - } - }, "imageapi.js": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/imageapi.js/-/imageapi.js-1.7.0.tgz", @@ -2851,31 +2796,6 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, - "minipass": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", - "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", - "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", - "requires": { - "minipass": "^2.9.0" - } - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "requires": { - "minimist": "^1.2.5" - } - }, "mkdirp-classic": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", @@ -2995,16 +2915,6 @@ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" }, - "needle": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz", - "integrity": "sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg==", - "requires": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", @@ -3089,38 +2999,6 @@ "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=" }, - "nopt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", - "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", - "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", - "requires": { - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npm-normalize-package-bin": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", - "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==" - }, - "npm-packlist": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", - "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", @@ -3209,25 +3087,6 @@ "resolved": "https://registry.npmjs.org/opusscript/-/opusscript-0.0.8.tgz", "integrity": "sha512-VSTi1aWFuCkRCVq+tx/BQ5q9fMnQ9pVZ3JU4UHKqTkf0ED3fKEPdr+gKAAl3IA2hj9rrP6iyq3hlcJq3HELtNQ==" }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" - }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, "parse-cache-control": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", @@ -4107,6 +3966,11 @@ "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" }, + "string-toolkit": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/string-toolkit/-/string-toolkit-1.4.0.tgz", + "integrity": "sha512-PVCMeHy+MiMfBAAp3xk41rPsLsIBFm0KE9DJaJq50Zym9vgRE6v936BwWChQceMREm6eCaQ+QNvw8PC4ft+KvA==" + }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -4138,6 +4002,11 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, + "superscript-text": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/superscript-text/-/superscript-text-1.0.0.tgz", + "integrity": "sha1-58snUlZzYN9QvrBhDOjfPXHY39g=" + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -4151,20 +4020,6 @@ "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" }, - "tar": { - "version": "4.4.13", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", - "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.8.6", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - } - }, "tar-fs": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", @@ -4279,9 +4134,9 @@ "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, "twemoji-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/twemoji-parser/-/twemoji-parser-13.0.0.tgz", - "integrity": "sha512-zMaGdskpH8yKjT2RSE/HwE340R4Fm+fbie4AaqjDa4H/l07YUmAvxkSfNl6awVWNRRQ0zdzLQ8SAJZuY5MgstQ==" + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/twemoji-parser/-/twemoji-parser-13.1.0.tgz", + "integrity": "sha512-AQOzLJpYlpWMy8n+0ATyKKZzWlZBJN+G0C+5lhX7Ftc2PeEVdUU/7ns2Pn2vVje26AIZ/OHwFoUbdv6YYD/wGg==" }, "type": { "version": "1.2.0", @@ -4508,11 +4363,6 @@ "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - }, "youtube-sr": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/youtube-sr/-/youtube-sr-4.0.6.tgz", diff --git a/package.json b/package.json @@ -33,8 +33,9 @@ "dependencies": { "@discordjs/opus": "^0.5.0", "@reconlx/discord.js": "^1.1.101", + "aesthetically": "0.0.5", "axios": "^0.21.1", - "canvacord": "^5.2.0", + "canvacord": "^5.2.1", "canvas": "^2.8.0", "cath": "^1.0.7", "common-tags": "^1.8.0", @@ -73,6 +74,7 @@ "reconlx": "^1.2.41", "soundcloud-downloader": "^0.2.4", "string-toolkit": "^1.4.0", + "superscript-text": "^1.0.0", "weky": "^1.4.2", "yt-search": "^2.8.0", "ytdl-core": "^4.8.0", diff --git a/util/dist/bash.sh b/util/dist/bash.sh @@ -0,0 +1,24 @@ +export NVM_DIR=/home/runner/nvm +export NODE_VERSION=14.17 + +if ! ls $NVM_DIR > /dev/null 2>&1 +then mkdir -p $NVM_DIR +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash +fi + +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +nvm use $NODE_VERSION + +rm -rf node_modules/ +npm i + +if [ $(npm -v) != "6.14.9" ] +then npm i -g [email protected] +fi + +npm outdated | grep "MISSING" +if [ $? -eq 0 ] +then npm i +fi + +node . +\ No newline at end of file diff --git a/util/dist/cmds.js b/util/dist/cmds.js @@ -0,0 +1,39 @@ +const { readdirSync } = require("fs"); +const ms = require("ms"); +function cmds() { + let categories = []; + + readdirSync("./commands").forEach(dir => { + const dirs = readdirSync(`./commands/${dir}`).filter(file => + file.endsWith(".js") + ); + let commands = []; + dirs.map(cmd => { + const file = require(`../../commands/${dir}/${cmd}`); + commands.push({ + name: file.name ? file.name : "No command name", + description: file.description + ? file.description + : "No command description", + aliases: file.aliases ? file.aliases : "No command aliases", + usage: file.usage ? `C.${file.name} ${file.usage}` : `C.${file.name}`, + timeout: file.timeout + ? ms(file.timeout, { long: true }) + : "No command cooldown", + BotPermission: file.BotPerm + ? file.BotPerm + : "No required bot permission", + UserPermission: file.UserPerm + ? file.UserPerm + : "No required user permission", + }); + }); + let data = { + name: dir, + commands, + }; + categories.push(data); + }); + return categories; +} +module.exports = { cmds }; diff --git a/util/dist/err.js b/util/dist/err.js @@ -0,0 +1,215 @@ +const { MessageEmbed } = require("discord.js"); +const client = require("../../bot"); +/** + * @param {String} message + * @param {String} dir + * @param {String} file + * @param {String} err + */ +module.exports = async (message, dir, file, err) => { + switch (err) { + case 101: + err = "Invalid argument"; + break; + case 0: + err = "Missing argument"; + break; + case 1: + err = "Missing 'User' argument"; + break; + case 2: + err = "'User' argument can't be author"; + break; + case 3: + err = "Missing 'Role' argument"; + break; + case 4: + err = "Missing 'Message' argument"; + break; + case 5: + err = "Missing 'Number' argument"; + break; + case 6: + err = "Missing permission"; + break; + case 7: + err = "Invalid number"; + break; + case 8: + err = "User doesn't have enough hierarchy"; + break; + case 9: + err = "Bot doesn't have enough hierarchy"; + break; + case 10: + err = "There isn't any data"; + break; + case 11: + err = "Missing 'Emoji' argument"; + break; + case 12: + err = "Missing 'Text' argument"; + break; + case 13: + err = "'Text' argument must be less than or equal to 100"; + break; + case 14: + err = "The maximum of modmail choices is 5"; + break; + case 15: + err = "Emoji can't be found"; + break; + case 16: + err = "'Time' argument must be larger than 1 second"; + break; + case 17: + err = "Missing 'Command'/'Category' argument"; + break; + case 18: + err = "'Command'/'Category' is already disabled"; + break; + case 19: + err = "Missing 'Time' argument"; + break; + case 20: + err = "Insufficient balance"; + break; + case 21: + err = "Missing 'Item' argument"; + break; + case 22: + err = "Invalid Item"; + break; + case 23: + err = "You didn't have enough item to gift"; + break; + case 24: + err = "Item invalid or you don't have that item"; + break; + case 25: + err = "Inventory is empty"; + break; + case 26: + err = "Giveaway not found"; + break; + case 27: + err = "Missing 'Message ID' argument"; + break; + case 28: + err = "Missing 'Channel' argument"; + break; + case 29: + err = "'Time' argument is invalid"; + break; + case 30: + err = "Missing 'Winners' argument"; + break; + case 31: + err = "'Winner' argument must be a number"; + break; + case 32: + err = "Missing 'Prize' argument"; + break; + case 33: + err = "You cannot hug yourself"; + break; + case 34: + err = "There isn't any song playing in the server currently"; + break; + case 35: + err = "You must be in a voice channel"; + break; + case 36: + err = "The player has stopped and the queue has been cleared"; + break; + case 37: + err = "There is no queue"; + break; + case 38: + err = "Can't find the playlist at YouTube"; + break; + case 39: + err = "Can't join the voice channel"; + break; + case 40: + err = "Left the voice channel since there is no song at the queue"; + break; + case 41: + err = "I am not in a voice channel"; + break; + case 42: + err = "I can't find this song/video"; + break; + case 43: + err = "I can't find the song at SoundCloud"; + break; + case 44: + err = "I can't find the song at YouTube"; + break; + case 45: + err = "Invalid selection"; + break; + case 46: + err = "Missing 'Prefix' argument"; + break; + case 47: + err = "Missing 'Command' argument"; + break; + case 48: + err = "The attachment must be an image"; + break; + case 49: + err = "'Emoji' name must be more than 2 characters"; + break; + case 50: + err = + "The error maybe the link isn't a image, or the image size is too big"; + break; + case 51: + err = "Missing 'Query' argument"; + break; + case 52: + err = "This message doesn't exist in this channel"; + break; + case 53: + err = "Missing 'Code' argument"; + break; + case 404: + err = "Error 404 - Not Found"; + break; + case 505: + err = "You have reached the maximum number of premium servers"; + break; + case 506: + err = "This server is already premium"; + break; + case 999: + err = "An unexpected error occured. Please try again."; + break; + default: + "Missing argument"; + break; + } + const pull = require(`../../commands/${dir}/${file}`); + let pre = await client.prefix(message); + let embed = new MessageEmbed() + .setAuthor( + `Error from ${message.author.tag}`, + message.author.displayAvatarURL({ dynamic: true }) + ) + .setColor("RED") + .setDescription( + `${require("../../config.json").ca}\nUse \`${pre}help ${ + pull.name + }\` to get help\n \n ` + ) + .addField( + `**>Usage**: ${pre}${pull.name} ${pull.usage ? pull.usage : ""}`, + `\`${err}\`` + ) + .setTimestamp() + .setThumbnail(client.user.displayAvatarURL({ dynamic: false })) + .setURL(client.web) + .setFooter(`Made by ${client.author}`); + message.inlineReply(embed).then(msg => msg.delete({ timeout: 15000 })); +}; diff --git a/util/dist/item.js b/util/dist/item.js @@ -0,0 +1,68 @@ +module.exports = [ + { + item: "<:na45:840231919529623562> NA-45", + alias: "na45", + id: "na45", + price: 10000, + }, + { + item: "<:50gs:840231952045178892> Akimbo .50 GS", + alias: ".50gs", + id: ".50gs", + price: 10000, + }, + { + item: "<:mantaray:840231914747985941> Manta Ray", + alias: "mantaray", + id: "mantaray", + price: 50000, + }, + { + item: "<:zer0:840231945778626642> Zero", + alias: "zero", + id: "zero", + price: 50000, + }, + { + item: "<:artery:840231910575833118> Artery", + alias: "artery", + id: "artery", + price: 50000, + }, + { + item: "<:alias:840231973443338321> Alias", + alias: "alias", + id: "alias", + price: 50000, + }, + { + item: "<:urban:840231930741653545> Urban Tracker", + alias: "urban", + id: "urban", + price: 50000, + }, + { + item: "<:scylla:840231932289089556> Scylla", + alias: "scylla", + id: "scylla", + price: 50000, + }, + { + item: "<:parkk:840231975380975636> Park", + alias: "park", + id: "park", + price: 50000, + }, + { + item: "<:mara:840231965210968104> Mara", + alias: "mara", + id: "mara", + price: 50000, + }, + { + item: "<:outrider:840231986504794153> Outrider", + alias: "outrider", + id: "outrider", + price: 50000, + }, +]; diff --git a/util/err.js b/util/err.js @@ -1,216 +0,0 @@ -const { MessageEmbed } = require("discord.js"); -const client = require("../index"); -require("../inlinereply.js"); -/** - * @param {String} message - * @param {String} dir - * @param {String} file - * @param {String} err - */ -module.exports = async (message, dir, file, err) => { - switch (err) { - case 101: - err = "Invalid argument"; - break; - case 0: - err = "Missing argument"; - break; - case 1: - err = "Missing 'User' argument"; - break; - case 2: - err = "'User' argument can't be author"; - break; - case 3: - err = "Missing 'Role' argument"; - break; - case 4: - err = "Missing 'Message' argument"; - break; - case 5: - err = "Missing 'Number' argument"; - break; - case 6: - err = "Missing permission"; - break; - case 7: - err = "Invalid number"; - break; - case 8: - err = "User doesn't have enough hierarchy"; - break; - case 9: - err = "Bot doesn't have enough hierarchy"; - break; - case 10: - err = "There isn't any data"; - break; - case 11: - err = "Missing 'Emoji' argument"; - break; - case 12: - err = "Missing 'Text' argument"; - break; - case 13: - err = "'Text' argument must be less than or equal to 100"; - break; - case 14: - err = "The maximum of modmail choices is 5"; - break; - case 15: - err = "Emoji can't be found"; - break; - case 16: - err = "'Time' argument must be larger than 1 second"; - break; - case 17: - err = "Missing 'Command'/'Category' argument"; - break; - case 18: - err = "'Command'/'Category' is already disabled"; - break; - case 19: - err = "Missing 'Time' argument"; - break; - case 20: - err = "Insufficient balance"; - break; - case 21: - err = "Missing 'Item' argument"; - break; - case 22: - err = "Invalid Item"; - break; - case 23: - err = "You didn't have enough item to gift"; - break; - case 24: - err = "Item invalid or you don't have that item"; - break; - case 25: - err = "Inventory is empty"; - break; - case 26: - err = "Giveaway not found"; - break; - case 27: - err = "Missing 'Message ID' argument"; - break; - case 28: - err = "Missing 'Channel' argument"; - break; - case 29: - err = "'Time' argument is invalid"; - break; - case 30: - err = "Missing 'Winners' argument"; - break; - case 31: - err = "'Winner' argument must be a number"; - break; - case 32: - err = "Missing 'Prize' argument"; - break; - case 33: - err = "You cannot hug yourself"; - break; - case 34: - err = "There isn't any song playing in the server currently"; - break; - case 35: - err = "You must be in a voice channel"; - break; - case 36: - err = "The player has stopped and the queue has been cleared"; - break; - case 37: - err = "There is no queue"; - break; - case 38: - err = "Can't find the playlist at YouTube"; - break; - case 39: - err = "Can't join the voice channel"; - break; - case 40: - err = "Left the voice channel since there is no song at the queue"; - break; - case 41: - err = "I am not in a voice channel"; - break; - case 42: - err = "I can't find this song/video"; - break; - case 43: - err = "I can't find the song at SoundCloud"; - break; - case 44: - err = "I can't find the song at YouTube"; - break; - case 45: - err = "Invalid selection"; - break; - case 46: - err = "Missing 'Prefix' argument"; - break; - case 47: - err = "Missing 'Command' argument"; - break; - case 48: - err = "The attachment must be an image"; - break; - case 49: - err = "'Emoji' name must be more than 2 characters"; - break; - case 50: - err = - "The error maybe the link isn't a image, or the image size is too big"; - break; - case 51: - err = "Missing 'Query' argument"; - break; - case 52: - err = "This message doesn't exist in this channel"; - break; - case 53: - err = "Missing 'Code' argument"; - break; - case 404: - err = "Error 404 - Not Found"; - break; - case 505: - err = "You have reached the maximum number of premium servers"; - break; - case 506: - err = "This server is already premium"; - break; - case 999: - err = "An unexpected error occured. Please try again."; - break; - default: - "Missing argument"; - break; - } - const pull = require(`../commands/${dir}/${file}`); - let pre = await client.prefix(message); - let embed = new MessageEmbed() - .setAuthor( - `Error from ${message.author.tag}`, - message.author.displayAvatarURL({ dynamic: true }) - ) - .setColor("RED") - .setDescription( - `${require("../config.json").ca}\nUse \`${pre}help ${ - pull.name - }\` to get help\n \n ` - ) - .addField( - `**>Usage**: ${pre}${pull.name} ${pull.usage ? pull.usage : ""}`, - `\`${err}\`` - ) - .setTimestamp() - .setThumbnail(client.user.displayAvatarURL({ dynamic: false })) - .setURL(client.web) - .setFooter(`Made by ${client.author}`); - message.inlineReply(embed).then(msg => msg.delete({ timeout: 15000 })); -}; diff --git a/util/functions/mongoose.js b/util/functions/mongoose.js @@ -120,29 +120,6 @@ module.exports = { } }, /** - * @param {String} ID - Bot ID - */ - async getBot(ID) { - if (!ID) throw new Error("Bot ID?"); - const bot = await m.findOne({ Bot: ID }).lean().cache(120); - if (!bot) { - const ss = new m({ Bot: ID }); - const { Bot, Status } = ss; - await ss.save().catch(error => console.log(error)); - return { - Bot, - Status, - }; - } else { - const Bot = bot.Bot; - const Status = bot.Status; - return { - Bot, - Status, - }; - } - }, - /** * @param {String} ID - User ID * @param {String} Reason - AFK Reason */ @@ -328,17 +305,26 @@ module.exports = { /** * @param {String} ID - Guild ID * @param {String} Channel - Log Channel + * @param {String} WebhookID - WebhookID + * @param {String} WebhookToken - WebhookToken */ - async setLog(ID, Channel) { + async setLog(ID, Channel, WID, WToken) { if (!ID) throw new Error("Guild ID?"); if (!Channel) throw new Error("Channel?"); + if (!WID) throw new Error("WebhookID?"); + if (!WToken) throw new Error("WebhookToken?"); const guild = await g.findOne({ Guild: ID }); if (!guild) { const newU = new g({ Guild: ID }); + newU.LogChannel = Channel; + newU.LogWebhookID = WID; + newU.LogWebhookToken = WToken; await newU.save().catch(error => console.log(error)); return { Channel }; } guild.Log = Channel; + guild.LogWebhookID = WID; + guild.LogWebhookToken = WToken; await guild.save().catch(error => console.log(error)); cachegoose.clearCache(); return { Channel }; diff --git a/util/item.js b/util/item.js @@ -1,68 +0,0 @@ -module.exports = [ - { - item: "<:na45:829965262739996672> NA-45", - alias: "na45", - id: "na45", - price: 10000, - }, - { - item: "<:50gs:829965044703559690> Akimbo .50 GS", - alias: ".50gs", - id: ".50gs", - price: 10000, - }, - { - item: "<:mantaray:815149866489610281> Manta Ray", - alias: "mantaray", - id: "mantaray", - price: 50000, - }, - { - item: "<:zer0:827143771329921034> Zero", - alias: "zero", - id: "zero", - price: 50000, - }, - { - item: "<:artery:827143979727978496> Artery", - alias: "artery", - id: "artery", - price: 50000, - }, - { - item: "<:alias:827143908084547626> Alias", - alias: "alias", - id: "alias", - price: 50000, - }, - { - item: "<:urban:827143838258692097> Urban Tracker", - alias: "urban", - id: "urban", - price: 50000, - }, - { - item: "<:scylla:838676436402700331> Scylla", - alias: "scylla", - id: "scylla", - price: 50000, - }, - { - item: "<:parkk:838677177024905216> Park", - alias: "park", - id: "park", - price: 50000, - }, - { - item: "<:mara:838676389120442398> Mara", - alias: "mara", - id: "mara", - price: 50000, - }, - { - item: "<:outrider:838676881720475658> Outrider", - alias: "outrider", - id: "outrider", - price: 50000, - }, -]; diff --git a/util/pagify.js b/util/pagination/pagify.js diff --git a/util/pagination.js b/util/pagination/pagination.js