nyx

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

commit 36fd3341a7090581fa00e4667934353d2b2f9282
parent 6c3223b7f030a3560b9003627335ea83afe43a01
Author: NK <[email protected]>
Date:   Wed, 26 Oct 2022 10:38:28 +0000

fix

Diffstat:
Mclient/NYX.js | 101++++++++++++++++---------------------------------------------------------------
Mcommand/APEX/sens.js | 15+++++++--------
Mcommand/CODM/build.js | 21++++++++++-----------
Mcommand/CODM/class.js | 9++++++---
Mcommand/CODM/loadout.js | 4++--
Mcommand/CODM/perk.js | 17++++++++++-------
Mcommand/CODM/scorestreak.js | 10+++++-----
Mcommand/CODM/stats.js | 4++--
Mcommand/Config/premium.js | 12++++++------
Mcommand/Config/settings.js | 88++++++++++++++++++++++---------------------------------------------------------
Mcommand/Information/avatar.js | 6+++---
Mcommand/Information/botinfo.js | 6+++---
Mcommand/Information/help.js | 6+++---
Mcommand/Information/ping.js | 25++++++++++++++-----------
Mcommand/Information/userinfo.js | 11+++++++----
Mcommand/Owner/accept.js | 4++--
Mcommand/Owner/blacklist.js | 14++++++++++----
Mcommand/Owner/deny.js | 4++--
Mcommand/Owner/eval.js | 6+++---
Mcommand/Owner/guilds.js | 9++++++---
Mcommand/Utilities/invite.js | 11+++++++----
Mcommand/Utilities/poll.js | 4++--
Mcommand/Utilities/report.js | 13++++++++-----
Mcommand/Utilities/suggest.js | 33++++++++++++++++++---------------
Mevents/embed.js | 22+++++++++++-----------
Mevents/guild.js | 22+++++++++++-----------
Mevents/interactionCreate.js | 52++++++++++++++++++++++++++++------------------------
Mevents/messageCreate.js | 23+++++++++++++----------
Mevents/ready.js | 13-------------
Mindex.js | 2+-
Mpackage.json | 4+---
Munused/commands/Config/cmd-list.js | 32++++++++++++++++----------------
Munused/commands/Config/create.js | 848+++++++++++++++++++++++++++++++++++++++----------------------------------------
Munused/commands/Config/migrate.js | 39+++++++++++++++++++--------------------
Munused/commands/Config/modmail-category.js | 57+++++++++++++++++++++++++++++----------------------------
Munused/commands/Economy/bal.js | 11+++++++----
Munused/commands/Economy/bet.js | 16+++++++++++-----
Munused/commands/Economy/blackjack.js | 7+++++--
Munused/commands/Economy/buy.js | 12++++++------
Munused/commands/Economy/daily.js | 16+++++++++++-----
Munused/commands/Economy/gift.js | 4++--
Munused/commands/Economy/gun.js | 25++++++++++++++-----------
Munused/commands/Economy/inv.js | 6+++---
Munused/commands/Economy/multiplier.js | 9++++++---
Munused/commands/Economy/profile.js | 11+++++++----
Munused/commands/Economy/rich.js | 9++++++---
Munused/commands/Economy/shop.js | 8++++----
Munused/commands/Economy/slots.js | 16+++++++++++-----
Munused/commands/Economy/steal.js | 42+++++++++++++++++++++---------------------
Munused/commands/Economy/work.js | 9++++++---
Munused/commands/Moderation/ban.js | 16+++++++++++-----
Munused/commands/Moderation/kick.js | 9++++++---
Munused/commands/Moderation/lock.js | 22+++++++++++-----------
Munused/commands/Moderation/mute.js | 19+++++++++++--------
Munused/commands/Moderation/purge.js | 16++++++++--------
Munused/commands/Moderation/role.js | 16+++++++++++-----
Munused/commands/Moderation/slowmode.js | 29+++++++++++++++++------------
Munused/commands/Moderation/unban.js | 9++++++---
Munused/commands/Moderation/unmute.js | 9++++++---
Munused/commands/Moderation/warn.js | 23+++++++++++++----------
Munused/commands/Music/grab.js | 9++++++---
Munused/commands/Music/loop.js | 4++--
Munused/commands/Music/nowplaying.js | 4++--
Munused/commands/Music/play.js | 10+++++-----
Munused/commands/Music/queue.js | 8++++----
Munused/commands/Utilities/add.js | 4++--
Munused/commands/Utilities/afk.js | 6+++---
Munused/commands/Utilities/draw.js | 11+++++++----
Munused/commands/Utilities/emoji.js | 2+-
Munused/commands/Utilities/esnipe.js | 11+++++++----
Munused/commands/Utilities/giveaway.js | 8++++----
Munused/commands/Utilities/lyrics.js | 6+++---
Munused/commands/Utilities/modmail.js | 306+++++++++++++++++++++++++++++++++++++++----------------------------------------
Munused/commands/Utilities/nsfw.js | 6+++---
Munused/commands/Utilities/snipe.js | 11+++++++----
Munused/err.js | 9++++++---
Munused/events/voiceStateUpdate.js | 6+++---
Mutil/Data/CODM/loadout.js | 6+++---
Mutil/Data/CODM/new-stats.js | 22+++++++++++-----------
Mutil/Data/CODM/stats.js | 4++--
Mutil/functions/function.js | 11+++++++----
81 files changed, 1192 insertions(+), 1188 deletions(-)

diff --git a/client/NYX.js b/client/NYX.js @@ -1,8 +1,10 @@ -const { Client, Collection, MessageEmbed } = require("discord.js"); -const { Manager } = require("erela.js"); +const { + Client, + Collection, + EmbedBuilder, + GatewayIntentBits, +} = require("discord.js"); const config = require("../config"); -const Spotify = require("erela.js-spotify"); -const utils = require("../util/functions/function"); require("dotenv").config(); class NYX extends Client { @@ -20,18 +22,17 @@ class NYX extends Client { }, ], }, - shard: "auto", - restTimeOffset: 0, - restRequestTimeout: 99999, - partials: ["MESSAGE", "CHANNEL", "REACTION", "GUILD_MEMBER"], - intents: 24207, + intents: [ + GatewayIntentBits.Guilds, + GatewayIntentBits.GuildMembers, + GatewayIntentBits.MessageContent, + GatewayIntentBits.GuildPresences, + ], } ) { super(options); this.slashCommands = new Collection(); this.hide = new Collection(); - // this.esnipes = new Collection(); - // this.snipes = new Collection(); this.config = config; this.data = require("../util/functions/mongoose"); this.color = config.color; @@ -54,92 +55,30 @@ class NYX extends Client { "718762019586572341", // NYX Nation "840225563193114624", // Command Test ]; - const client = this; } - // require("../util/functions/economy")(client); - // this.manager = new Manager({ - // plugins: [ - // new Spotify({ - // clientID: process.env.SPOTIFY_ID, - // clientSecret: process.env.SPOTIFY_SECRET, - // }), - // ], - // nodes: [ - // { - // host: config.Lavalink.Host, - // port: config.Lavalink.Port, - // password: config.Lavalink.Password, - // retryDelay: 5000, - // }, - // ], - // autoPlay: true, - // send: (id, payload) => { - // const guild = client.guilds.cache.get(id); - // if (guild) guild.shard.send(payload); - // }, - // }) - // .on("nodeConnect", node => - // console.log(`Node "${node.options.identifier}" has connected`) - // ) - // .on("nodeError", (node, error) => - // console.log( - // `Node "${node.options.identifier}" encountered an error: ${error.message}` - // ) - // ) - // .on("trackStart", (player, track) => { - // const channel = client.channels.cache.get(player.textChannel); - // const embed = new MessageEmbed() - // .setColor(config.color) - // .setAuthor( - // `Now Playing`, - // "https://cdn.discordapp.com/emojis/897017864085712936.gif" - // ) - // .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) - // .setTimestamp() - // .setThumbnail(player.queue.current.displayThumbnail()) - // .setDescription(`[${track.title}](${track.uri})`) - // .addField( - // "Duration", - // `\`${utils.prettyMs(track.duration, { - // colonNotation: true, - // })}\``, - // true - // ); - // channel.send({ embeds: [embed] }); - // }) - // .on("queueEnd", player => { - // const channel = client.channels.cache.get(player.textChannel); - // const embed2 = new MessageEmbed() - // .setColor(config.color) - // .setAuthor( - // `Queue has ended`, - // "https://cdn.discordapp.com/emojis/897017864085712936.gif" - // ) - // .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) - // .setTimestamp(); - // channel.send({ embeds: [embed2] }); - // // player.destroy(); Remove if 24/7 - // }); - // } + start() { require("../util/dist/handler")(this); + this.login(process.env.TOKEN); this.data .connect(process.env.MONGO) .then(() => console.log("Connected to MongoDB āœ…")) .catch(e => console.log(e)); - this.login(process.env.TOKEN); } err(c, e) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("An Error Occured") .setColor("RED") .setDescription(`āŒ | ${e}`) .setTimestamp() - .setFooter(`Made by ${this.author}`, this.user.displayAvatarURL()); + .setFooter({ + text: `Made by ${this.author}`, + iconURL: this.user.displayAvatarURL(), + }); c.followUp({ embeds: [embed] }); } se(c, e) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(this.color) .setDescription(e) .setTimestamp(); diff --git a/command/APEX/sens.js b/command/APEX/sens.js @@ -1,10 +1,9 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "sensitivity", description: "Get the perfect sensitivity for APEXM", category: "APEX", usage: "[Ironsight Sensitivity]", - type: "CHAT_INPUT", options: [ { type: 3, @@ -15,11 +14,11 @@ module.exports = { ], run: async (client, interaction, args) => { if (args[0] > 0 && args[0] < 301) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`Apex Legends Mobile Sensitivity Calculator`) .setDescription( - `<:nyx_description:897379659665264650> For more info, follow this [Video guide](https://rebrand.ly/apexm-sens) by HawksNest.` - ) + `<:nyx_description:897379659665264650> For more info, follow this [Video guide](https://rebrand.ly/apexm-sens) by HawksNest.` + ) .setColor(13703714) // hex: #d11a22 .setFooter({ text: `Data by Hawksnest`, @@ -39,12 +38,12 @@ module.exports = { { name: "Scope Sensitivity", value: ` - 2x Scope ADS - \`${args[0] * 0.5 }\` + 2x Scope ADS - \`${args[0] * 0.5}\` 3x Scope ADS - \`${args[0] * 0.33}\` 4x Scope ADS - \`${args[0] * 0.25}\` 6x Scope ADS - \`${args[0] * 0.16}\` 8x Scope ADS - \`${args[0] * 0.12}\` - 10x Scope ADS - \`${args[0] * 0.10}\``, + 10x Scope ADS - \`${args[0] * 0.1}\``, inline: false, } ) @@ -53,7 +52,7 @@ module.exports = { embeds: [embed], }); } else { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescription(`āš  **ERROR:** The Sensitivity can be betweeen 0 & 300`) .setColor(client.color); interaction.followUp({ embeds: [embed] }); diff --git a/command/CODM/build.js b/command/CODM/build.js @@ -1,15 +1,14 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const moment = require("moment"); const axios = require("axios"); module.exports = { name: "build", description: "Get gunsmith builds", usage: "[Weapon Name] [Author] [Tag]", - type: "CHAT_INPUT", category: "CODM", options: [ { - type: "SUB_COMMAND", + type: 1, name: "assault_rifle", description: "Get a gunsmith build for a Assault Rifle", options: [ @@ -152,7 +151,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "sub_machine_gun", description: "Get a gunsmith build for a Sub Machine Gun", options: [ @@ -275,7 +274,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "sniper_rifle", description: "Get a gunsmith build for a Sniper Rifle", options: [ @@ -362,7 +361,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "light_machine_gun", description: "Get a gunsmith build for a Light Machine Gun", options: [ @@ -445,7 +444,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "shotgun", description: "Get a gunsmith build for a Shotgun", options: [ @@ -524,7 +523,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "marksman_rifle", description: "Get a gunsmith build for a Marksman Rifle", options: [ @@ -591,7 +590,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "pistol", description: "Get a gunsmith build for a Pistol", options: [ @@ -674,7 +673,7 @@ module.exports = { .then(res => res.data) .catch(e => null); if (!data?.cwts) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescription( `<:nyx_not_available:897378400031879188> We don't have a **${tag}** gunsmith build for the gun with **CWTS šŸ†” ${cwts}** by **${cc}**, Please try another tag or a differnt content creator` ) @@ -685,7 +684,7 @@ module.exports = { data.attachments.map((e, i) => { return arr.push(`**${i + 1}:** ${e}`); }); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`${tag} build for ${data.weaponName} from ${data.author}`) .setDescription( `<:nyx_description:897379659665264650> **Description** \`\`\`\n${data.notes}\n \`\`\`` diff --git a/command/CODM/class.js b/command/CODM/class.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const model = require("../../models/weapons"); const Attachments = require("../../util/Data/attachments.json"); module.exports = { @@ -22,7 +22,7 @@ module.exports = { slot_3 = slots.next().value, slot_4 = slots.next().value, slot_5 = slots.next().value; - const result = new MessageEmbed() + const result = new EmbedBuilder() .setColor(client.color) .setTitle(`šŸŽ² A Randomly Generated Class for ${primary_weapon} šŸŽ²`) .setDescription( @@ -38,7 +38,10 @@ module.exports = { )}**` ) .setURL(client.web) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(); interaction.followUp({ embeds: [result] }); function* shuffle(array) { diff --git a/command/CODM/loadout.js b/command/CODM/loadout.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); //@night0721 You need to make this +const { EmbedBuilder } = require("discord.js"); //@night0721 You need to make this const items = require("../../util/Data/loadout.json"); module.exports = { name: "loadout", @@ -18,7 +18,7 @@ module.exports = { const slot_1 = slots.next().value, slot_2 = slots.next().value, slot_3 = slots.next().value; - const result = new MessageEmbed() + const result = new EmbedBuilder() .setColor(client.color) .setFooter({ text: `Made by ${client.author}`, diff --git a/command/CODM/perk.js b/command/CODM/perk.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const c = require("../../client/CODMClient"); module.exports = { name: "perk", description: "Get perk stats", - type: "CHAT_INPUT", + usage: "{Perk}", category: "CODM", options: [ { - type: "SUB_COMMAND", + type: 1, name: "red", description: "Red Perk", options: [ @@ -67,7 +67,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "green", description: "Green Perk", options: [ @@ -122,7 +122,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "blue", description: "Blue Perk", options: [ @@ -176,7 +176,7 @@ module.exports = { run: async (client, interaction, args) => { const val = args[1]; const d = await c.getperk(val); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor( d.type == "green" ? "09654a" @@ -186,7 +186,10 @@ module.exports = { ? "1047a4" : client.color ) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setTitle(d.perk) .addField("Effects", d.effects); diff --git a/command/CODM/scorestreak.js b/command/CODM/scorestreak.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const c = require("../../client/CODMClient"); module.exports = { name: "scorestreak", description: "Get Scorestreak stats", - type: "CHAT_INPUT", + usage: "{Scorestreak}", category: "CODM", options: [ { - type: "SUB_COMMAND", + type: 1, name: "lethal", description: "Lethal Scorestreak", options: [ @@ -83,7 +83,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "support", description: "Support Scorestreak", options: [ @@ -129,7 +129,7 @@ module.exports = { run: async (client, interaction, args) => { const val = args[1]; const d = await c.getscorestreak(val); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(d.name) .setURL(d.preview_video) .setDescription( diff --git a/command/CODM/stats.js b/command/CODM/stats.js @@ -1,6 +1,6 @@ const common = require("../../util/functions/common"); const data = require("../../util/Data/data.json"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); let currGun, currStats, @@ -71,7 +71,7 @@ module.exports = { const recoilImageLink = await chart.getShortUrl(); repEmb.image = { url: recoilImageLink }; } - interaction.followUp({ embeds: [new MessageEmbed(repEmb)] }); + interaction.followUp({ embeds: [new EmbedBuilder(repEmb)] }); } }, }; diff --git a/command/Config/premium.js b/command/Config/premium.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "premiumserver", category: "Config", @@ -38,12 +38,12 @@ module.exports = { ); interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("Success!") .setDescription( `Premium added to **${interaction.guild.name}**! \n` ) - .setFooter("Thank you for supporting Cath!") + .setFooter({ text: "Thank you for supporting Cath!" }) .setColor("GREEN") .setTimestamp() .setAuthor( @@ -54,7 +54,7 @@ module.exports = { }); client.channels.cache.get(client.config.ServerLog).send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("New Premium Server") .addField( "Server Info", @@ -86,7 +86,7 @@ module.exports = { ); interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("Removed!") .setDescription( `Premium removed from **${interaction.guild.name}**! \n` @@ -101,7 +101,7 @@ module.exports = { }); client.channels.cache.get(client.config.ServerLog).send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("Premium Server Removed") .addField( "Server Info", diff --git a/command/Config/settings.js b/command/Config/settings.js @@ -1,5 +1,4 @@ -const starboardClient = require("../../client/StarboardClient"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const fs = require("fs"); module.exports = { name: "settings", @@ -8,7 +7,7 @@ module.exports = { category: "Config", options: [ { - type: "SUB_COMMAND", + type: 1, name: "muterole", description: "Configure mute role settings for the server", options: [ @@ -21,7 +20,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "prefix", description: "Configure prefix settings for the server", options: [ @@ -35,7 +34,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "welcome", description: "Configure welcome channel settings for the server", options: [ @@ -44,12 +43,12 @@ module.exports = { name: "channel", description: "The channel for welcome messages", required: true, - channelTypes: ["GUILD_TEXT"], + channelTypes: [0], }, ], }, { - type: "SUB_COMMAND", + type: 1, name: "goodbye", description: "Configure goodbye channel settings for the server", options: [ @@ -58,32 +57,12 @@ module.exports = { name: "channel", description: "The channel for goodbye messages", required: true, - channelTypes: ["GUILD_TEXT"], + channelTypes: [0], }, ], }, { - type: "SUB_COMMAND", - name: "starboard", - description: "Configure starboard channel settings for the server", - options: [ - { - type: 7, - name: "channel", - description: "The channel for starboard messages", - required: true, - channelTypes: ["GUILD_TEXT"], - }, - { - type: 4, - name: "starcount", - description: "The required amount of star to trigger the starboard", - required: true, - }, - ], - }, - { - type: "SUB_COMMAND", + type: 1, name: "chatbot", description: "Configure chatbot channel settings for the server", options: [ @@ -92,12 +71,12 @@ module.exports = { name: "channel", description: "The channel for chatbotmessages", required: true, - channelTypes: ["GUILD_TEXT"], + channelTypes: [0], }, ], }, { - type: "SUB_COMMAND", + type: 1, name: "log", description: "Configure log channel settings for the server", options: [ @@ -106,7 +85,7 @@ module.exports = { name: "channel", description: "The channel for log messages", required: true, - channelTypes: ["GUILD_TEXT"], + channelTypes: [0], }, ], }, @@ -116,7 +95,7 @@ module.exports = { description: "Enable commands/category for the server", options: [ { - type: "SUB_COMMAND", + type: 1, name: "command", description: "To enable commands", options: [ @@ -129,7 +108,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "category", description: "To enable categories", options: [ @@ -179,7 +158,7 @@ module.exports = { description: "Disable commands/category for the server", options: [ { - type: "SUB_COMMAND", + type: 1, name: "command", description: "To disable commands", options: [ @@ -192,7 +171,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "category", description: "To disable categories", options: [ @@ -237,7 +216,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "level", description: "Configure level settings for the server", options: [ @@ -250,7 +229,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "nsfw", description: "Configure nsfw settings for the server", options: [ @@ -263,7 +242,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "tips", description: "Configure tips settings for the server", options: [ @@ -276,7 +255,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "overall", description: "See overall settings for the server", options: [], @@ -316,23 +295,6 @@ module.exports = { content: `Saved **${channel}** as the goodbye channel`, }); } - } else if (args[0].toLowerCase() === "starboard") { - const channel = interaction.guild.channels.cache.get(args[1]); - if (channel.type !== "GUILD_TEXT") { - interaction.followUp({ content: "Please provide a text channel" }); - } else { - starboardClient.config.guilds.add({ - id: interaction.guild.id, - options: { - starCount: args[2], - starboardChannel: args[1], - }, - }); - await client.data.setStarboard(interaction.guild.id, args[1], args[2]); - interaction.followUp({ - content: `Saved **${channel}** as the starboard channel`, - }); - } } else if (args[0].toLowerCase() === "chatbot") { const channel = interaction.guild.channels.cache.get(args[1]); if (channel.type !== "GUILD_TEXT") { @@ -500,11 +462,6 @@ module.exports = { ? interaction.guild.channels.cache.get(data.Guild.Goodbye) : "None" } - **Starboard Channel**: ${ - interaction.guild.channels.cache.get(data.Guild.Starboard) - ? interaction.guild.channels.cache.get(data.Guild.Starboard) - : "None" - } **Chatbot Channel**: ${ interaction.guild.channels.cache.get(data.Guild.Chatbot) ? interaction.guild.channels.cache.get(data.Guild.Chatbot) @@ -525,10 +482,13 @@ module.exports = { data.Guild.Category.length ? data.Guilds.Category.join(",") : "None" } `; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`**${interaction.guild.name}** Settings`) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setDescription(d); interaction.followUp({ embeds: [embed] }); diff --git a/command/Information/avatar.js b/command/Information/avatar.js @@ -1,8 +1,8 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "avatar", description: "Show user's avatar in different formats", - type: "CHAT_INPUT", + usage: "{User}", category: "Information", options: [ @@ -16,7 +16,7 @@ module.exports = { run: async (client, interaction, args) => { const member = interaction.guild.members.cache.get(args[0]) || interaction.member; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setAuthor({ name: member.user.tag, iconURL: member.user.displayAvatarURL({ dynamic: true, size: 1024 }), diff --git a/command/Information/botinfo.js b/command/Information/botinfo.js @@ -1,13 +1,13 @@ -const { MessageEmbed, version: djsversion } = require("discord.js"); +const { EmbedBuilder, version: djsversion } = require("discord.js"); const version = require("../../package.json").version; const { utc } = require("moment"); module.exports = { name: "botinfo", description: "Check the info of the bot", category: "Information", - type: "CHAT_INPUT", + run: async (client, interaction) => { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`NYX - CODM Gunsmith Bot`) .setURL( `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=4231314550&scope=bot%20applications.commands` diff --git a/command/Information/help.js b/command/Information/help.js @@ -44,7 +44,7 @@ module.exports = { commands: getCmds, }; }); - const embed = new Discord.MessageEmbed() + const embed = new Discord.EmbedBuilder() .setTitle(`**NYX's Commands**`) .setDescription(`Please choose a category in the dropdown menu`) .setColor(client.color) @@ -116,7 +116,7 @@ module.exports = { collector.on("collect", async interaction => { const [directory] = interaction.values; const category = categories.find(u => u.directory === directory); - const newembed = new Discord.MessageEmbed() + const newembed = new Discord.EmbedBuilder() .setTitle( `${emoji[directory]} ${directory} Commands ${emoji[directory]}` ) @@ -164,7 +164,7 @@ module.exports = { .map(y => y[0] + y.substring(1, y.length).toLowerCase()) .join(" ") ).join(", "); - const embed = new Discord.MessageEmbed() + const embed = new Discord.EmbedBuilder() .setTitle(`"${command.name}" command details`) .addField( "**Command**:", diff --git a/command/Information/ping.js b/command/Information/ping.js @@ -1,31 +1,34 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "ping", description: "Check bot latency to Discord API", - type: "CHAT_INPUT", + category: "Information", run: async (client, interaction, args) => { const msg = await interaction.channel.send(`Pinging...`); const messageping = msg.createdTimestamp - interaction.createdTimestamp; await msg.delete(); - const Embed = new MessageEmbed() + const Embed = new EmbedBuilder() .setTitle("<a:pong:897383314405605436> Pong!") - .setAuthor( - `${interaction.user.username}`, - interaction.user.displayAvatarURL() - ) + .setAuthor({ + name: `${interaction.user.username}`, + iconURL: interaction.user.displayAvatarURL(), + }) .setDescription( `\n šŸ“Ø ā€¢ **Message Latency** \`${Math.floor(messageping)}ms\` \nšŸ›°ļø ā€¢ **Bot Latency** \`${Math.round(client.ws.ping)}ms\`` ) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setColor( messageping < 350 - ? "GREEN" + ? "#008000" : messageping < 500 && messageping > 350 - ? "YELLOW" - : "RED" + ? "#ffff31" + : "#ff0000" ); interaction.followUp({ embeds: [Embed] }); }, diff --git a/command/Information/userinfo.js b/command/Information/userinfo.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const moment = require("moment"); module.exports = { @@ -14,7 +14,7 @@ module.exports = { required: false, }, ], - type: "CHAT_INPUT", + run: async (client, interaction, args, utils) => { const member = interaction.guild.members.cache.get(args[0]) || interaction.member; @@ -81,7 +81,7 @@ module.exports = { // ) { // activities = "None"; // } else activities = "None"; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setAuthor( member.user.tag, member.user.displayAvatarURL({ dynamic: true, size: 2048 }) @@ -89,7 +89,10 @@ module.exports = { .setTimestamp() .setColor(member.displayHexColor || client.color) .setURL(client.web) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setThumbnail(member.user.displayAvatarURL({ dynamic: true, size: 512 })) .setColor(member.displayHexColor || client.color) .addField( diff --git a/command/Owner/accept.js b/command/Owner/accept.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "accept", category: "Owner", @@ -29,7 +29,7 @@ module.exports = { ); const suggestEmbed = await suggestionChannel.messages.fetch(MessageID); const data = suggestEmbed.embeds[0]; - const acceptEmbed = new MessageEmbed() + const acceptEmbed = new EmbedBuilder() .setAuthor(data.author.name, data.author.iconURL) .setDescription(data.description) .setColor("GREEN") diff --git a/command/Owner/blacklist.js b/command/Owner/blacklist.js @@ -30,7 +30,7 @@ module.exports = { const reason = interaction.options.getString("reason"); if (toggle === true) { await client.data.BK(user.id, toggle, reason); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle( "<a:nyx_checkmark:897240322411724841> Successfully Blacklisted" ) @@ -39,19 +39,25 @@ module.exports = { ) .setURL(client.web) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(); interaction.followUp({ embeds: [embed] }); } else { await client.data.BK(user.id, toggle, reason); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("<a:nyx_checkmark:897240322411724841> Removed From Blacklist") .setDescription( `**User:** ${user.user.tag} \`(${user.id})\`\n**Reason:** ${reason} \n**Whitelisted by:** ${interaction.member}` ) .setURL(client.web) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(); interaction.followUp({ embeds: [embed] }); } diff --git a/command/Owner/deny.js b/command/Owner/deny.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "deny", category: "Owner", @@ -28,7 +28,7 @@ module.exports = { ); const suggestEmbed = await suggestionChannel.messages.fetch(MessageID); const data = suggestEmbed.embeds[0]; - const denyEmbed = new MessageEmbed() + const denyEmbed = new EmbedBuilder() .setAuthor(data.author.name, data.author.iconURL) .setDescription(data.description) .setColor("RED") diff --git a/command/Owner/eval.js b/command/Owner/eval.js @@ -5,7 +5,7 @@ module.exports = { usage: "(Code)", Owner: true, description: "Eval something", - type: "CHAT_INPUT", + options: [ { type: 3, @@ -52,7 +52,7 @@ module.exports = { console.log(evaled); let reactions = ["āŒ", "āŖ", "ā—€ļø", "ā¹ļø", "ā–¶ļø", "ā©"], page = 0, - evaledEmbed = new Discord.MessageEmbed() + evaledEmbed = new Discord.EmbedBuilder() .setColor(client.color) .setDescription(`\`\`\`js\n${evaled[0]}\n\`\`\``) .setTimestamp() @@ -113,7 +113,7 @@ module.exports = { page = evaled.length - 1; break; } - evaledEmbed = new Discord.MessageEmbed() + evaledEmbed = new Discord.EmbedBuilder() .setColor(interaction.guild.me.displayColor) .setDescription(`\`\`\`js\n${evaled[page]}\n\`\`\``); await mainMessage.edit({ diff --git a/command/Owner/guilds.js b/command/Owner/guilds.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "guilds", category: "Owner", @@ -15,7 +15,7 @@ module.exports = { } members`; }) .join("\n"); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("Guilds") .setDescription(description) .setColor(client.color) @@ -31,7 +31,10 @@ module.exports = { inline: true, } ) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(); interaction.followUp({ embeds: [embed] }); }, diff --git a/command/Utilities/invite.js b/command/Utilities/invite.js @@ -1,13 +1,16 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "invite", description: "Get bot invite link or get support", category: "Utilities", - type: "CHAT_INPUT", + run: async (client, interaction, args, utils) => { - const embed = new MessageEmbed() - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + const embed = new EmbedBuilder() + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setColor(client.color) .setTimestamp() .setAuthor({ diff --git a/command/Utilities/poll.js b/command/Utilities/poll.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "poll", category: "Utilities", @@ -48,7 +48,7 @@ module.exports = { }, ], run: async (client, interaction, args) => { - const pollCreateEmbed = new MessageEmbed() + const pollCreateEmbed = new EmbedBuilder() .setTitle(`šŸ“£ **${args[0]}**`) .setColor("RED") .setFooter({ diff --git a/command/Utilities/report.js b/command/Utilities/report.js @@ -1,10 +1,10 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "report", description: "Report a bug of the bot", category: "Utilities", - type: "CHAT_INPUT", + options: [ { type: 3, @@ -17,12 +17,15 @@ module.exports = { const bug = args[0]; interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("SUCCESS!") .setDescription( "You have reported a bug.\nPlease wait for us to solve it" ) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setColor("GREEN"), ], @@ -30,7 +33,7 @@ module.exports = { const ch = client.channels.cache.get(client.config.Report); ch.send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setAuthor( interaction.user.tag, interaction.user.displayAvatarURL({ dynamic: true }) diff --git a/command/Utilities/suggest.js b/command/Utilities/suggest.js @@ -1,9 +1,9 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "suggest", description: "Make a suggestion of the bot", category: "Utilities", - type: "CHAT_INPUT", + run: async (client, interaction, args) => { const questions = [ "Describe the suggestion", @@ -15,13 +15,16 @@ module.exports = { interaction.followUp("Check your dm."); const appStart = await interaction.user.send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setAuthor( interaction.user.username, interaction.user.displayAvatarURL() ) .setDescription(questions[collectCounter++]) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(), ], }); @@ -31,32 +34,32 @@ module.exports = { if (collectCounter < questions.length) { channel.send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setAuthor( interaction.user.username, interaction.user.displayAvatarURL() ) .setDescription(questions[collectCounter++]) - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(), ], }); } else { channel.send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("SUCCESS!") .setDescription( "You have sent a suggestion.\nPlease wait for us to review it" ) .setColor("GREEN") - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(), ], }); @@ -74,7 +77,7 @@ module.exports = { appsChannel.send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setAuthor( interaction.user.tag, interaction.user.displayAvatarURL({ dynamic: true }) diff --git a/events/embed.js b/events/embed.js @@ -1,12 +1,12 @@ const client = require("../"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { Welcome } = require("../config.js"); client.on("guildMemberAdd", async member => { const channel = member.guild.channels.cache.find( channel => channel.id === Welcome ); if (!channel) return; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle( `<:join:897246825122254848> Hello ${member}, Welcome to NYX's Support Server!` ) @@ -38,10 +38,10 @@ client.on("guildMemberAdd", async member => { inline: true, } ) - .setFooter( - `${member.user.tag} joined the server!`, - member.user.displayAvatarURL({ dynamic: true }) - ) + .setFooter({ + text: `${member.user.tag} joined the server!`, + iconURL: member.user.displayAvatarURL({ dynamic: true }), + }) .setColor(client.color) .setTimestamp(); @@ -52,16 +52,16 @@ client.on("guildMemberRemove", async member => { channel => channel.id === Welcome ); if (!channel) return; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle( `<:leave:897246828045680640> ${member.user.username} can't handle being cool! ` ) .setThumbnail(member.guild.iconURL({ dynamic: true })) .setDescription(`We now only have ${member.guild.memberCount} members`) - .setFooter( - `${member.user.tag} left the server!`, - member.user.displayAvatarURL({ dynamic: true }) - ) + .setFooter({ + text: `${member.user.tag} left the server!`, + iconURL: member.user.displayAvatarURL({ dynamic: true }), + }) .setColor(client.color) .setTimestamp(); diff --git a/events/guild.js b/events/guild.js @@ -1,10 +1,10 @@ const client = require("../"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const db = require("../models/guilds"); client.on("guildCreate", guild => { client.channels.cache.get(client.config.ServerLog).send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("New Server") .addField( "Server Info", @@ -12,10 +12,10 @@ client.on("guildCreate", guild => { **>Server ID**: \n${guild.id} **>Server Member Count**: \n${guild.memberCount}` ) - .setFooter( - `${client.user.username} Currently in ${client.guilds.cache.size} servers`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `${client.user.username} Currently in ${client.guilds.cache.size} servers`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(guild.iconURL({ dynamic: true })) .setColor("GREEN"), @@ -32,7 +32,7 @@ client.on("guildDelete", async guild => { client.data.DelGuild(guild.id); client.channels.cache.get(client.config.ServerLog).send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("Deleted Server") .addField( "Server Info", @@ -40,10 +40,10 @@ client.on("guildDelete", async guild => { **>Server ID**: \n${guild.id} **>Server Member Count**: \n${guild.memberCount}` ) - .setFooter( - `${client.user.username} Currently in ${client.guilds.cache.size} servers`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `${client.user.username} Currently in ${client.guilds.cache.size} servers`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(guild.iconURL({ dynamic: true })) .setColor("RED"), diff --git a/events/interactionCreate.js b/events/interactionCreate.js @@ -1,7 +1,7 @@ const client = require("../"); const cooldown = require("../models/cooldown"); const utils = require("../util/functions/function"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); client.on("interactionCreate", async interaction => { if (interaction.isCommand()) { await interaction.deferReply({ ephemeral: false }).catch(() => {}); @@ -61,7 +61,7 @@ client.on("interactionCreate", async interaction => { if (!data.User.Premium) { return interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setURL(client.web) .setAuthor({ name: interaction.user.tag, @@ -84,16 +84,16 @@ client.on("interactionCreate", async interaction => { if (!data.Guild.Level) return; } - if (!interaction.guild.me.permissions.has(cmd.BotPerms || [])) { - return interaction.followUp({ - content: `You can't use this command. I need to have ${cmd.BotPerms} permission to use this command.`, - }); - } - if (!interaction.member.permissions.has(cmd.UserPerms || [])) { - return interaction.followUp({ - content: `You can't use this command. I need to have ${cmd.UserPerms} permission to use this command.`, - }); - } + // if (!interaction.guild.me.permissions.has(cmd.BotPerms || [])) { + // return interaction.followUp({ + // content: `You can't use this command. I need to have ${cmd.BotPerms} permission to use this command.`, + // }); + // } + // if (!interaction.member.permissions.has(cmd.UserPerms || [])) { + // return interaction.followUp({ + // content: `You can't use this command. I need to have ${cmd.UserPerms} permission to use this command.`, + // }); + // } if (data.Guild) { if (data.Guild.Category) { if (data.Guild.Category.includes(cmd.directory)) { @@ -136,8 +136,8 @@ client.on("interactionCreate", async interaction => { ); cmd .run(client, interaction, args, utils, data) - .catch(e => sendE(e)); - client.addcmdsused(interaction.user.id); + .catch(e => sendE(e, interaction)); + // client.addcmdsused(interaction.user.id); client.channels.cache.get(client.config.CMDLog).send({ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``, }); @@ -147,11 +147,11 @@ client.on("interactionCreate", async interaction => { if (data.Guild.Tips) utils.tips(interaction, client); cmd .run(client, interaction, args, utils, data) - .catch(e => sendE(e)); + .catch(e => sendE(e, interaction)); client.channels.cache.get(client.config.CMDLog).send({ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``, }); - client.addcmdsused(interaction.user.id); + // client.addcmdsused(interaction.user.id); // await client.addXP(interaction.user.id, random, interaction); new cooldown({ User: interaction.user.id, @@ -164,15 +164,17 @@ client.on("interactionCreate", async interaction => { ); } else { if (data.Guild.Tips) utils.tips(interaction, client); - cmd.run(client, interaction, args, utils, data).catch(e => sendE(e)); + cmd + .run(client, interaction, args, utils, data) + .catch(e => sendE(e, interaction)); client.channels.cache.get(client.config.CMDLog).send({ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``, }); - client.addcmdsused(interaction.user.id); + // client.addcmdsused(interaction.user.id); // await client.addXP(interaction.user.id, random, interaction); } } - if (interaction.isContextMenu()) { + if (interaction.isContextMenuCommand()) { await interaction.deferReply({ ephemeral: false }); const command = client.slashCommands.get(interaction.commandName); if (command) command.run(client, interaction); @@ -197,20 +199,22 @@ client.on("interactionCreate", async interaction => { interaction.member = interaction.guild.members.cache.get( interaction.user.id ); - ownercmd.run(client, interaction, args, utils).catch(e => sendE(e)); + ownercmd + .run(client, interaction, args, utils) + .catch(e => sendE(e, interaction)); client.channels.cache.get(client.config.CMDLog).send({ content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${ownercmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``, }); - client.addcmdsused(interaction.user.id); + //client.addcmdsused(interaction.user.id); } }); -function sendE(e) { - const embed = new MessageEmbed() +function sendE(e, i) { + const embed = new EmbedBuilder() .setTitle("Command Error") .setDescription(`\`\`\`yaml\n${e.stack}\`\`\``) .setTimestamp() .setColor(client.color) .setFooter({ text: client.user.username }); - interaction.channel.send({ embeds: [embed] }); + i.channel.send({ embeds: [embed] }); client.channels.cache.get(client.config.ErrorLog).send({ embeds: [embed] }); } diff --git a/events/messageCreate.js b/events/messageCreate.js @@ -1,5 +1,5 @@ const client = require(".."); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const utils = require("../util/functions/function"); const domains = require("../util/Data/domains.json"); client.on("messageCreate", async message => { @@ -13,7 +13,7 @@ client.on("messageCreate", async message => { data.User = userDB; if (!guildDB) await client.data.CreateGuild(message.guild.id); if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) { - const _ = new MessageEmbed() + const _ = new EmbedBuilder() .addFields( { name: "Prefix/Usage", @@ -55,7 +55,10 @@ client.on("messageCreate", async message => { .setThumbnail(client.user.displayAvatarURL()) .setURL(client.web) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setColor(client.color); const m = await message.reply({ @@ -97,7 +100,7 @@ client.on("messageCreate", async message => { .slice(0, -1) ) ) { - const _ = new MessageEmbed() + const _ = new EmbedBuilder() .setTitle(`Scam/IP Grabber detected`) .setTimestamp() .setColor(client.color) @@ -151,7 +154,7 @@ client.on("messageCreate", async message => { message?.content.startsWith("C.") || message?.content.startsWith("c.") ) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`Message commands are now disabled`) .setDescription( `Please enable **Use Application Commands** in the channel settings to get access to slash commands, we have discontinued message commands\n\nUse \`/help\` to see more info` @@ -191,10 +194,10 @@ client.on("messageCreate", async message => { } ) .setURL(client.web) - .setFooter( - `Requested by ${message.author.tag}`, - message.author.displayAvatarURL({ dynamic: true }) - ) + .setFooter({ + text: `Requested by ${message.author.tag}`, + iconURL: message.author.displayAvatarURL({ dynamic: true }), + }) // .setThumbnail("../../util/assets/images/nyx_logo_transparent.webp") .setTimestamp(); message.reply({ @@ -223,7 +226,7 @@ client.on("messageCreate", async message => { if (message.content) { client.channels.cache.get(client.config.DMLog).send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setDescription(message.content) .setColor(client.color) .setAuthor({ diff --git a/events/ready.js b/events/ready.js @@ -1,17 +1,4 @@ const client = require(".."); -const version = require("../package.json").version; -const starboardClient = require("../client/StarboardClient"); -const g = require("../models/guilds"); client.on("ready", async () => { - client.manager.init(client.user.id); - const data = await g.find(); - starboardClient.config.guilds.set( - data.map(x => { - return { - id: x.Guild, - options: { starCount: x.StarCount, starboardChannel: x.Starboard }, - }; - }) - ); console.log(`${client.user.username} āœ…`); }); diff --git a/index.js b/index.js @@ -1,5 +1,5 @@ const NYX = require("./client/NYX"); const client = new NYX(); module.exports = client; -process.on("unhandledRejection", () => {}); // add // when need to debug +//process.on("unhandledRejection", () => {}); // add // when need to debug client.start(); diff --git a/package.json b/package.json @@ -42,10 +42,8 @@ "dependencies": { "axios": "^0.27.2", "cath": "^1.4.7", - "discord.js": "^13.6.0", + "discord.js": "^14.6.0", "dotenv": "^16.0.0", - "erela.js": "^2.3.3", - "erela.js-spotify": "^1.2.0", "goosecache": "^9.0.14", "moment": "^2.29.1", "mongoose": "^5.13.14", diff --git a/unused/commands/Config/cmd-list.js b/unused/commands/Config/cmd-list.js @@ -1,20 +1,20 @@ const schema = require("../../models/custom-commands"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { - name: "cc-list", - UserPerm: "ADMINISTRATOR", - description: "Check the custom commands in a server", - category: "Config", - 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); - message.channel.send( - new MessageEmbed() - .setColor(client.color) - .setDescription( - data.map((cmd, i) => `${i + 1}: ${cmd.Command}`).join("\n"), - ), - ); - }, + name: "cc-list", + UserPerm: "ADMINISTRATOR", + description: "Check the custom commands in a server", + category: "Config", + 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); + message.channel.send( + new EmbedBuilder() + .setColor(client.color) + .setDescription( + data.map((cmd, i) => `${i + 1}: ${cmd.Command}`).join("\n") + ) + ); + }, }; diff --git a/unused/commands/Config/create.js b/unused/commands/Config/create.js @@ -2,430 +2,428 @@ const Discord = require("discord.js"); const db = require("../../models/custom-commands"); module.exports = { - name: "cc-create", - UserPerm: "ADMINISTRATOR", - description: "Crate custom commands for a server", - category: "Config", - run: async (client, message, args) => { - message.delete(); - message.channel.send( - new Discord.MessageEmbed() - .setTitle(`Setup | 1/3`) - .setDescription( - "What is the name of the command?\nYou can cancel the setup at any time by sending `cancel`.", - ) - .setColor(client.color), - ); - await startMessageCollectors(client, message, args); - function startMessageCollectors(client, message, args) { - const nameFilter = m => m.author.id === message.author.id; - const nameCollector = new Discord.MessageCollector( - message.channel, - nameFilter, - { max: 999 }, - ); - nameCollector.on("collect", async msg => { - const name = msg.content.toLowerCase(); - const data = await db.findOne({ - Guild: message.guild.id, - Command: name, - }); - if (data) { - nameCollector.stop(); - return message.reply("This command has already exist."); - } - if (name === "cancel") { - msg.channel.send("The setup has been cancelled."); - db.findOneAndDelete({ Guild: message.guild.id, Command: name }); - nameCollector.stop(); - return; - } - if (!name) { - await msg.channel.send("You don't specify a name. Cancelled setup."); - nameCollector.stop(); - return; - } - else { - const newDB = new db({ - Guild: message.guild.id, - Command: name, - }); - await newDB.save(); - console.log(newDB); - msg.channel.send( - new Discord.MessageEmbed() - .setTitle(`Setup | 2/3`) - .setDescription( - `The command name will be **${name}**.\nWhat is the response for the command? You can have mutliple response by joning them with differnt lines.`, - ) - .setColor(client.color), - ); - nameCollector.stop(); - } - const responseFilter = m => m.author.id === message.author.id; - const responseCollector = new Discord.MessageCollector( - message.channel, - responseFilter, - { max: 999 }, - ); - responseCollector.on("collect", async msg => { - const response = msg.content.split("\n"); - console.log(`Response: ${response}`); + name: "cc-create", + UserPerm: "ADMINISTRATOR", + description: "Crate custom commands for a server", + category: "Config", + run: async (client, message, args) => { + message.delete(); + message.channel.send( + new Discord.EmbedBuilder() + .setTitle(`Setup | 1/3`) + .setDescription( + "What is the name of the command?\nYou can cancel the setup at any time by sending `cancel`." + ) + .setColor(client.color) + ); + await startMessageCollectors(client, message, args); + function startMessageCollectors(client, message, args) { + const nameFilter = m => m.author.id === message.author.id; + const nameCollector = new Discord.MessageCollector( + message.channel, + nameFilter, + { max: 999 } + ); + nameCollector.on("collect", async msg => { + const name = msg.content.toLowerCase(); + const data = await db.findOne({ + Guild: message.guild.id, + Command: name, + }); + if (data) { + nameCollector.stop(); + return message.reply("This command has already exist."); + } + if (name === "cancel") { + msg.channel.send("The setup has been cancelled."); + db.findOneAndDelete({ Guild: message.guild.id, Command: name }); + nameCollector.stop(); + return; + } + if (!name) { + await msg.channel.send("You don't specify a name. Cancelled setup."); + nameCollector.stop(); + return; + } else { + const newDB = new db({ + Guild: message.guild.id, + Command: name, + }); + await newDB.save(); + console.log(newDB); + msg.channel.send( + new Discord.EmbedBuilder() + .setTitle(`Setup | 2/3`) + .setDescription( + `The command name will be **${name}**.\nWhat is the response for the command? You can have mutliple response by joning them with differnt lines.` + ) + .setColor(client.color) + ); + nameCollector.stop(); + } + const responseFilter = m => m.author.id === message.author.id; + const responseCollector = new Discord.MessageCollector( + message.channel, + responseFilter, + { max: 999 } + ); + responseCollector.on("collect", async msg => { + const response = msg.content.split("\n"); + console.log(`Response: ${response}`); - if (msg.content.toLowerCase() === "cancel") { - msg.channel.send("The setup has been cancelled."); - responseCollector.stop(); - return; - } - if (!response) { - msg.channel.send(`You didn't specify a response. Setup cancelled.`); - responseCollector.stop(); - } - if (response.length > 1) { - responseCollector.stop(); - await db.findOne( - { Guild: message.guild.id, Command: name }, - async (err, data) => { - if (data) { - data.Response = response; - await db.findOneAndUpdate( - { Guild: message.guild.id, Command: name }, - data, - ); - console.log(data); - } - }, - ); - msg.channel.send( - new Discord.MessageEmbed() - .setTitle(`Setup | 3/4`) - .setColor(client.color) - .setDescription( - `Ok so there will be ${response.length} responses. Do you want the response be randomized?\n\`Type yes or no\` \nIf you choose no, accumlative responses may let the command can\'t be sent out.`, - ), - ); - const randomFilter = m => m.author.id === message.author.id; - const randomCollector = new Discord.MessageCollector( - message.channel, - randomFilter, - { max: 999 }, - ); - randomCollector.on("collect", async msg => { - let maybe; - if (msg.content.toLowerCase() === "yes") { - msg.channel.send( - new Discord.MessageEmbed() - .setColor(client.color) - .setTitle(`Setup | 4/4`) - .setDescription( - `The responses will be randomized. Do you want to have delete command usage? \`Type yes or no\``, - ), - ); - randomCollector.stop(); - maybe = true; - await db.findOne( - { - Guild: message.guild.id, - Response: response, - Command: name, - }, - async (err, data) => { - if (data) { - data.Random = maybe; - await db.findOneAndUpdate( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - data, - ); - console.log(data); - } - }, - ); - console.log(`Random: ${maybe}`); - const deleteeeFilter = m => m.author.id === message.author.id; - const deleteeeCollector = new Discord.MessageCollector( - message.channel, - deleteeeFilter, - { max: 999 }, - ); - deleteeeCollector.on("collect", async msg => { - let idkwor; - if (msg.content.toLowerCase() === "yes") { - deleteeeCollector.stop(); - idkwor = true; - await db.findOne( - { - Guild: message.guild.id, - Command: name, - Response: response, - Random: maybe, - }, - async (err, data) => { - if (data) { - data.Delete = idkwor; - await db.findOneAndUpdate( - { - Guild: message.guild.id, - Command: name, - Response: response, - Random: maybe, - }, - data, - ); - console.log(data); - msg.reply( - `Saved **${data.Command}** as a custom command`, - ); - } - }, - ); - console.log(`Usage Delete: ${idkwor}`); - } - if (msg.content.toLowerCase() === "no") { - deleteeeCollector.stop(); - idkwor = false; - await db.findOne( - { - Guild: message.guild.id, - Command: name, - Response: response, - Random: maybe, - }, - async (err, data) => { - if (data) { - data.Delete = idkwor; - await db.findOneAndUpdate( - { - Guild: message.guild.id, - Command: name, - Response: response, - Random: maybe, - }, - data, - ); - console.log(data); - msg.reply( - `Saved **${data.Command}** as a custom command`, - ); - } - }, - ); - } - if (msg.content.toLowerCase() === "cancel") { - msg.channel.send("The setup has been cancelled."); - deleteeeCollector.stop(); - return; - } - }); - } - if (msg.content.toLowerCase() === "no") { - msg.channel.send( - new Discord.MessageEmbed() - .setColor(client.color) - .setTitle(`Setup | 4/4`) - .setDescription( - `The responses won't be randomized. Do you want to have delete command usage? \`Type yes or no\``, - ), - ); - randomCollector.stop(); - maybe = false; - await db.findOne( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - async (err, data) => { - if (data) { - data.Random = maybe; - await db.findOneAndUpdate( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - data, - ); - console.log(data); - } - }, - ); - const deleteeFilter = m => m.author.id === message.author.id; - const deleteeCollector = new Discord.MessageCollector( - message.channel, - deleteeFilter, - { max: 999 }, - ); - deleteeCollector.on("collect", async msg => { - let idkwor; - if (msg.content.toLowerCase() === "yes") { - deleteeCollector.stop(); - idkwor = true; - await db.findOne( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - async (err, data) => { - if (data) { - data.Delete = idkwor; - await db.findOneAndUpdate( - { - Guild: message.guild.id, - Command: name, - Response: response, - Random: maybe, - }, - data, - ); - msg.reply( - `Saved **${data.Command}** as a custom command`, - ); - } - }, - ); - console.log(`Usage Delete: ${idkwor}`); - } - if (msg.content.toLowerCase() === "no") { - deleteeCollector.stop(); - idkwor = false; - await db.findOne( - { - Guild: message.guild.id, - Command: name, - Response: response, - Random: maybe, - }, - async (err, data) => { - if (data) { - data.Delete = idkwor; - await db.findOneAndUpdate( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - data, - ); - msg.reply( - `Saved **${data.Command}** as a custom command`, - ); - } - }, - ); - } - if (msg.content.toLowerCase() === "cancel") { - msg.channel.send("The setup has been cancelled."); - deleteeCollector.stop(); - return; - } - }); - } - if (msg.content.toLowerCase() === "cancel") { - msg.channel.send("The setup has been cancelled."); - randomCollector.stop(); - return; - } - }); - } - else { - await db.findOne( - { Guild: message.guild.id, Command: name }, - async (err, data) => { - if (data) { - data.Response = response; - await db.findOneAndUpdate( - { Guild: message.guild.id, Command: name }, - data, - ); - console.log(data); - } - }, - ); - msg.channel.send( - new Discord.MessageEmbed() - .setTitle(`Setup | 3/3`) - .setColor(client.color) - .setDescription( - `The response is \n**${response}**\nDo you to want have delete command usage?`, - ), - ); - responseCollector.stop(); - const deleteFilter = m => m.author.id === message.author.id; - const deleteCollector = new Discord.MessageCollector( - message.channel, - deleteFilter, - { max: 999 }, - ); - deleteCollector.on("collect", async msg => { - let idkwor; - if (msg.content.toLowerCase() === "yes") { - deleteCollector.stop(); - idkwor = true; - await db.findOne( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - async (err, data) => { - if (data) { - data.Delete = idkwor; - await db.findOneAndUpdate( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - data, - ); - msg.reply( - `Saved **${data.Command}** as a custom command`, - ); - } - }, - ); - } - if (msg.content.toLowerCase() === "no") { - deleteCollector.stop(); - idkwor = false; - await db.findOne( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - async (err, data) => { - if (data) { - data.Delete = idkwor; - await db.findOneAndUpdate( - { - Guild: message.guild.id, - Command: name, - Response: response, - }, - data, - ); - msg.reply( - `Saved **${data.Command}** as a custom command`, - ); - } - }, - ); - } - if (msg.content.toLowerCase() === "cancel") { - msg.channel.send("The setup has been cancelled."); - deleteCollector.stop(); - return; - } - }); - } - }); - }); - } - }, + if (msg.content.toLowerCase() === "cancel") { + msg.channel.send("The setup has been cancelled."); + responseCollector.stop(); + return; + } + if (!response) { + msg.channel.send(`You didn't specify a response. Setup cancelled.`); + responseCollector.stop(); + } + if (response.length > 1) { + responseCollector.stop(); + await db.findOne( + { Guild: message.guild.id, Command: name }, + async (err, data) => { + if (data) { + data.Response = response; + await db.findOneAndUpdate( + { Guild: message.guild.id, Command: name }, + data + ); + console.log(data); + } + } + ); + msg.channel.send( + new Discord.EmbedBuilder() + .setTitle(`Setup | 3/4`) + .setColor(client.color) + .setDescription( + `Ok so there will be ${response.length} responses. Do you want the response be randomized?\n\`Type yes or no\` \nIf you choose no, accumlative responses may let the command can\'t be sent out.` + ) + ); + const randomFilter = m => m.author.id === message.author.id; + const randomCollector = new Discord.MessageCollector( + message.channel, + randomFilter, + { max: 999 } + ); + randomCollector.on("collect", async msg => { + let maybe; + if (msg.content.toLowerCase() === "yes") { + msg.channel.send( + new Discord.EmbedBuilder() + .setColor(client.color) + .setTitle(`Setup | 4/4`) + .setDescription( + `The responses will be randomized. Do you want to have delete command usage? \`Type yes or no\`` + ) + ); + randomCollector.stop(); + maybe = true; + await db.findOne( + { + Guild: message.guild.id, + Response: response, + Command: name, + }, + async (err, data) => { + if (data) { + data.Random = maybe; + await db.findOneAndUpdate( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + data + ); + console.log(data); + } + } + ); + console.log(`Random: ${maybe}`); + const deleteeeFilter = m => m.author.id === message.author.id; + const deleteeeCollector = new Discord.MessageCollector( + message.channel, + deleteeeFilter, + { max: 999 } + ); + deleteeeCollector.on("collect", async msg => { + let idkwor; + if (msg.content.toLowerCase() === "yes") { + deleteeeCollector.stop(); + idkwor = true; + await db.findOne( + { + Guild: message.guild.id, + Command: name, + Response: response, + Random: maybe, + }, + async (err, data) => { + if (data) { + data.Delete = idkwor; + await db.findOneAndUpdate( + { + Guild: message.guild.id, + Command: name, + Response: response, + Random: maybe, + }, + data + ); + console.log(data); + msg.reply( + `Saved **${data.Command}** as a custom command` + ); + } + } + ); + console.log(`Usage Delete: ${idkwor}`); + } + if (msg.content.toLowerCase() === "no") { + deleteeeCollector.stop(); + idkwor = false; + await db.findOne( + { + Guild: message.guild.id, + Command: name, + Response: response, + Random: maybe, + }, + async (err, data) => { + if (data) { + data.Delete = idkwor; + await db.findOneAndUpdate( + { + Guild: message.guild.id, + Command: name, + Response: response, + Random: maybe, + }, + data + ); + console.log(data); + msg.reply( + `Saved **${data.Command}** as a custom command` + ); + } + } + ); + } + if (msg.content.toLowerCase() === "cancel") { + msg.channel.send("The setup has been cancelled."); + deleteeeCollector.stop(); + return; + } + }); + } + if (msg.content.toLowerCase() === "no") { + msg.channel.send( + new Discord.EmbedBuilder() + .setColor(client.color) + .setTitle(`Setup | 4/4`) + .setDescription( + `The responses won't be randomized. Do you want to have delete command usage? \`Type yes or no\`` + ) + ); + randomCollector.stop(); + maybe = false; + await db.findOne( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + async (err, data) => { + if (data) { + data.Random = maybe; + await db.findOneAndUpdate( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + data + ); + console.log(data); + } + } + ); + const deleteeFilter = m => m.author.id === message.author.id; + const deleteeCollector = new Discord.MessageCollector( + message.channel, + deleteeFilter, + { max: 999 } + ); + deleteeCollector.on("collect", async msg => { + let idkwor; + if (msg.content.toLowerCase() === "yes") { + deleteeCollector.stop(); + idkwor = true; + await db.findOne( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + async (err, data) => { + if (data) { + data.Delete = idkwor; + await db.findOneAndUpdate( + { + Guild: message.guild.id, + Command: name, + Response: response, + Random: maybe, + }, + data + ); + msg.reply( + `Saved **${data.Command}** as a custom command` + ); + } + } + ); + console.log(`Usage Delete: ${idkwor}`); + } + if (msg.content.toLowerCase() === "no") { + deleteeCollector.stop(); + idkwor = false; + await db.findOne( + { + Guild: message.guild.id, + Command: name, + Response: response, + Random: maybe, + }, + async (err, data) => { + if (data) { + data.Delete = idkwor; + await db.findOneAndUpdate( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + data + ); + msg.reply( + `Saved **${data.Command}** as a custom command` + ); + } + } + ); + } + if (msg.content.toLowerCase() === "cancel") { + msg.channel.send("The setup has been cancelled."); + deleteeCollector.stop(); + return; + } + }); + } + if (msg.content.toLowerCase() === "cancel") { + msg.channel.send("The setup has been cancelled."); + randomCollector.stop(); + return; + } + }); + } else { + await db.findOne( + { Guild: message.guild.id, Command: name }, + async (err, data) => { + if (data) { + data.Response = response; + await db.findOneAndUpdate( + { Guild: message.guild.id, Command: name }, + data + ); + console.log(data); + } + } + ); + msg.channel.send( + new Discord.EmbedBuilder() + .setTitle(`Setup | 3/3`) + .setColor(client.color) + .setDescription( + `The response is \n**${response}**\nDo you to want have delete command usage?` + ) + ); + responseCollector.stop(); + const deleteFilter = m => m.author.id === message.author.id; + const deleteCollector = new Discord.MessageCollector( + message.channel, + deleteFilter, + { max: 999 } + ); + deleteCollector.on("collect", async msg => { + let idkwor; + if (msg.content.toLowerCase() === "yes") { + deleteCollector.stop(); + idkwor = true; + await db.findOne( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + async (err, data) => { + if (data) { + data.Delete = idkwor; + await db.findOneAndUpdate( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + data + ); + msg.reply( + `Saved **${data.Command}** as a custom command` + ); + } + } + ); + } + if (msg.content.toLowerCase() === "no") { + deleteCollector.stop(); + idkwor = false; + await db.findOne( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + async (err, data) => { + if (data) { + data.Delete = idkwor; + await db.findOneAndUpdate( + { + Guild: message.guild.id, + Command: name, + Response: response, + }, + data + ); + msg.reply( + `Saved **${data.Command}** as a custom command` + ); + } + } + ); + } + if (msg.content.toLowerCase() === "cancel") { + msg.channel.send("The setup has been cancelled."); + deleteCollector.stop(); + return; + } + }); + } + }); + }); + } + }, }; diff --git a/unused/commands/Config/migrate.js b/unused/commands/Config/migrate.js @@ -1,22 +1,21 @@ -const { Client, Message, MessageEmbed } = require("discord.js"); +const { Client, Message, EmbedBuilder } = require("discord.js"); module.exports = { - name: "migrate", - usage: "(Server ID)", - description: "Migrate all emojis from a server", - category: "Config", - run: async (client, message, args) => { - try { - const oldGuild = args[0]; - if (!oldGuild) return; - old = client.guilds.cache.get(oldGuild); - if (!old) return client.err(message, "Config", "migrate", 404); - await old.emojis.cache.map(async e => { - await message.guild.emojis.create(e.url, e.name); - }); - return message.channel.send(`Created Emotes.`); - } - catch (e) { - console.log(e); - } - }, + name: "migrate", + usage: "(Server ID)", + description: "Migrate all emojis from a server", + category: "Config", + run: async (client, message, args) => { + try { + const oldGuild = args[0]; + if (!oldGuild) return; + old = client.guilds.cache.get(oldGuild); + if (!old) return client.err(message, "Config", "migrate", 404); + await old.emojis.cache.map(async e => { + await message.guild.emojis.create(e.url, e.name); + }); + return message.channel.send(`Created Emotes.`); + } catch (e) { + console.log(e); + } + }, }; diff --git a/unused/commands/Config/modmail-category.js b/unused/commands/Config/modmail-category.js @@ -1,32 +1,33 @@ const schema = require("../../models/modmail"); -const { Client, Message, MessageEmbed } = require("discord.js"); +const { Client, Message, EmbedBuilder } = require("discord.js"); module.exports = { - name: "modmail-category", - UserPerm: "ADMINISTRATOR", - description: "Setup modmail category in a server", - usage: "(Category ID)", - category: "Config", - run: async (client, message, args) => { - if (!args.length) {return client.err(message, "Config", "modmail-category", 0);} - const category = message.guild.channels.cache.find( - ch => (ch.type = "GUILD_CATEGORY" && ch.id == args[0]), - ); - if (!category) return client.err(message, "Config", "modmail-category", 1); - schema.findOne({ Guild: message.guild.id }, async (err, data) => { - if (data) { - data.Category = category.id; - await schema.findOneAndUpdate({ Guild: message.guild.id }, data); - } - else { - new schema({ - Guild: message.guild.id, - Category: category.id, - }).save(); - } - }); - return message.channel.send({ - content: `**Saved category to ${category.name}**`, - }); - }, + name: "modmail-category", + UserPerm: "ADMINISTRATOR", + description: "Setup modmail category in a server", + usage: "(Category ID)", + category: "Config", + run: async (client, message, args) => { + if (!args.length) { + return client.err(message, "Config", "modmail-category", 0); + } + const category = message.guild.channels.cache.find( + ch => (ch.type = "GUILD_CATEGORY" && ch.id == args[0]) + ); + if (!category) return client.err(message, "Config", "modmail-category", 1); + schema.findOne({ Guild: message.guild.id }, async (err, data) => { + if (data) { + data.Category = category.id; + await schema.findOneAndUpdate({ Guild: message.guild.id }, data); + } else { + new schema({ + Guild: message.guild.id, + Category: category.id, + }).save(); + } + }); + return message.channel.send({ + content: `**Saved category to ${category.name}**`, + }); + }, }; diff --git a/unused/commands/Economy/bal.js b/unused/commands/Economy/bal.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "balance", description: "Show an user's balance", @@ -12,18 +12,21 @@ module.exports = { required: false, }, ], - type: "CHAT_INPUT", + run: async (client, interaction, args) => { const user = interaction.guild.members.cache.get(args[0]) || interaction.member; const bal = await client.bal(user.id); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`${user.displayName}'s Balance`) .setDescription(`**${bal}** ${client.currency}`) .setColor(client.color) .setURL(client.web) .setTimestamp() - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()); + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }); interaction.followUp({ embeds: [embed] }); }, }; diff --git a/unused/commands/Economy/bet.js b/unused/commands/Economy/bet.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { bool } = require("cath"); module.exports = { name: "bet", @@ -29,10 +29,13 @@ module.exports = { const multi = (await client.multi(interaction)) / 10 + 1; await client.add(interaction.user.id, winamt, interaction); await client.ADDBWin(interaction.user.id); - const abc = new MessageEmbed() + const abc = new EmbedBuilder() .setColor("GREEN") .setTimestamp() - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTitle(`${interaction.user.username} wins a gamble game`) .addFields( { @@ -56,10 +59,13 @@ module.exports = { interaction.followUp({ embeds: [abc] }); } else { await client.rmv(interaction.user.id, amt); - const cba = new MessageEmbed() + const cba = new EmbedBuilder() .setColor("RED") .setTimestamp() - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTitle(`${interaction.user.username} loses a gamble game`) .addFields( { diff --git a/unused/commands/Economy/blackjack.js b/unused/commands/Economy/blackjack.js @@ -144,10 +144,13 @@ module.exports = { dealerMsg += " > " + dealer.score.toString(); } - const gambleEmbed = new Discord.MessageEmbed() + const gambleEmbed = new Discord.EmbedBuilder() .setColor(cl || client.color) .setTimestamp() - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTitle(interaction.user.username + `'s Blackjack game`) .addField("You", cardsMsg, true) .addField("NYX", dealerMsg, true) diff --git a/unused/commands/Economy/buy.js b/unused/commands/Economy/buy.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const inventory = require("../../models/econ"); const items = require("../../util/Data/item.json"); module.exports = { @@ -75,7 +75,7 @@ module.exports = { }); interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTimestamp() .setDescription( `**${ @@ -90,10 +90,10 @@ module.exports = { interaction.user.tag, interaction.user.displayAvatarURL({ dynamic: true }) ) - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ), + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }), ], }); await client.rmv(interaction.user.id, itemPrice * num); diff --git a/unused/commands/Economy/daily.js b/unused/commands/Economy/daily.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "daily", description: "Earns daily money", @@ -10,20 +10,23 @@ module.exports = { if (user) { if (user.Premium == true) { money = 20000; - const pre_embed = new MessageEmbed() + const pre_embed = new EmbedBuilder() .setTitle(`${user.username}'s profile`) .setDescription( `Here is your daily **${money}** ${client.currency}\nYou can use this again in 24hrs` ) .setURL(client.web) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(); await client.add(interaction.user.id, money, interaction); return interaction.followUp({ embeds: [pre_embed] }); } else { money = 10000; - const norm_embed = new MessageEmbed() + const norm_embed = new EmbedBuilder() .setAuthor( interaction.user.tag, interaction.user.displayAvatarURL({ dyanmic: true }) @@ -33,7 +36,10 @@ module.exports = { ) .setURL(client.web) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(); await client.add(interaction.user.id, money, interaction); return interaction.followUp({ embeds: [norm_embed] }); diff --git a/unused/commands/Economy/gift.js b/unused/commands/Economy/gift.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const inventory = require("../../models/econ"); const items = require("../../util/Data/item.json"); module.exports = { @@ -72,7 +72,7 @@ module.exports = { data.Inventory[dbName] -= number; interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setColor(client.color) .setAuthor( interaction.user.tag, diff --git a/unused/commands/Economy/gun.js b/unused/commands/Economy/gun.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const e = require("../../models/econ"); const list = require("../../util/Data/gun.json"); module.exports = { @@ -6,7 +6,7 @@ module.exports = { description: "Configure Weapon Master System settings", options: [ { - type: "SUB_COMMAND", + type: 1, name: "select", description: "Select the gun for the game", options: [ @@ -29,13 +29,13 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "list", description: "See the information for the guns", options: [], }, { - type: "SUB_COMMAND", + type: 1, name: "info", description: "See the stats of your gun", }, @@ -45,9 +45,12 @@ module.exports = { const lists = list.map(value => { return `**${value.emoji} ${value.name}**\n**Description**: ${value.description}`; }); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setDescription(lists.join("\n\n")); interaction.followUp({ embeds: [embed] }); @@ -101,14 +104,14 @@ module.exports = { }); } else { const link = list.find(a => a.name === data.Gun.Name).link; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setThumbnail(link) .setTimestamp() .setColor(client.color) - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .addField("Name", data.Gun.Name, true) .addField("Rank", data.Gun.Rank, true) .addField("XP", data.Gun.XP.toString(), true); diff --git a/unused/commands/Economy/inv.js b/unused/commands/Economy/inv.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const inv = require("../../models/econ"); const { Pagination } = require("cath"); const items = require("../../util/Data/item.json"); @@ -45,12 +45,12 @@ module.exports = { }); } const c = util.chunk(mappedData, 5).map(x => x.join("\n")); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTimestamp() .setTitle(`${user.displayName}'s inventory`) .setColor(client.color) .setDescription(c[0]) - .setFooter(`Page 1 of ${c.length}`); + .setFooter({ text: `Page 1 of ${c.length}` }); try { const msg = await interaction.followUp({ embeds: [embed] }); if (mappedData.length > 5) { diff --git a/unused/commands/Economy/multiplier.js b/unused/commands/Economy/multiplier.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "multiplier", @@ -32,13 +32,16 @@ module.exports = { i += "Channel Name includes NYX - 10%\n"; e += 10; } - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .addField(`**Total Multiplier: ${e}%** (Maximum: 50%)`, i) .setColor(client.color) .setURL(client.web) .setTitle(`${user.displayName}'s Multiplier`) .setTimestamp() - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()); + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }); interaction.followUp({ embeds: [embed] }); }, }; diff --git a/unused/commands/Economy/profile.js b/unused/commands/Economy/profile.js @@ -1,9 +1,9 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "profile", usage: "(User)", description: "Check an user economy profile", - type: "CHAT_INPUT", + options: [ { type: 6, @@ -21,8 +21,11 @@ module.exports = { const cmdused = await client.cmdsUSED(user.user.id); const bal = await client.bal(user.user.id); const multi = await client.multi(interaction); - const game = new MessageEmbed() - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + const game = new EmbedBuilder() + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setColor("7196ef") .setTitle(`${user.displayName}'s profile`) .setDescription(`Current Balance ${bal} ${client.currency}`) diff --git a/unused/commands/Economy/rich.js b/unused/commands/Economy/rich.js @@ -1,4 +1,4 @@ -const { Collection, MessageEmbed } = require("discord.js"); +const { Collection, EmbedBuilder } = require("discord.js"); module.exports = { name: "rich", description: "Displaying top 10 richest users.", @@ -27,7 +27,7 @@ module.exports = { const ata = collection.sort((a, b) => b.bal - a.bal).first(10); interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle(`Richest users in ${interaction.guild.name}`) .setDescription( ata @@ -38,7 +38,10 @@ module.exports = { }) .join("\n") ) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setColor(client.color), ], diff --git a/unused/commands/Economy/shop.js b/unused/commands/Economy/shop.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { Pagination } = require("cath"); const items = require("../../util/Data/item.json"); module.exports = { @@ -26,12 +26,12 @@ module.exports = { )}**\n\`Type:\` **${value.type}**`; }); const c = util.chunk(list, 5).map(x => x.join("\n\n")); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("**NYX Shop**") .setTimestamp() .setDescription(c[0]) .setColor(client.color) - .setFooter(`Page 1 of ${c.length}`); + .setFooter({ text: `Page 1 of ${c.length}` }); try { const msg = await interaction.followUp({ embeds: [embed] }); if (list.length > 5) await util.pagination(msg, interaction.user, c); @@ -50,7 +50,7 @@ module.exports = { }); } else { const theitem = items.find(i => i.aliases.includes(itemToSearch)); - const all = new MessageEmbed() + const all = new EmbedBuilder() .setTitle(`${theitem.emoji} ${theitem.name}`) .setDescription( ` diff --git a/unused/commands/Economy/slots.js b/unused/commands/Economy/slots.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "slots", usage: "(Number)", @@ -48,9 +48,12 @@ module.exports = { const multi = (await client.multi(interaction)) / 10 + 1; await client.add(interaction.user.id, winamt, interaction); await client.ADDSWin(interaction.user.id); - const won = new MessageEmbed() + const won = new EmbedBuilder() .setColor("GREEN") - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .addField( "|-----|-----|----|", @@ -87,9 +90,12 @@ module.exports = { interaction.followUp({ embeds: [won] }); } else { await client.rmv(interaction.user.id, amt); - const lost = new MessageEmbed() + const lost = new EmbedBuilder() .setColor("RED") - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .addField( "|-----|-----|----|", diff --git a/unused/commands/Economy/steal.js b/unused/commands/Economy/steal.js @@ -1,5 +1,5 @@ const db = require("../../models/econ"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { bool } = require("cath"); module.exports = { name: "rob", @@ -40,11 +40,11 @@ module.exports = { client.createProfile(tryrob.id); interaction.followUp({ embeds: [ - new MessageEmbed() - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + new EmbedBuilder() + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setAuthor( interaction.user.tag, @@ -60,11 +60,11 @@ module.exports = { if (data1.CP <= 0 || !data1.CP) { interaction.followUp({ embeds: [ - new MessageEmbed() - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + new EmbedBuilder() + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setAuthor( interaction.user.tag, @@ -97,11 +97,11 @@ module.exports = { .catch(e => {}); interaction.followUp({ embeds: [ - new MessageEmbed() - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + new EmbedBuilder() + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setAuthor( interaction.user.tag, @@ -120,11 +120,11 @@ module.exports = { data1.save(); interaction.followUp({ embeds: [ - new MessageEmbed() - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + new EmbedBuilder() + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setAuthor( interaction.user.tag, diff --git a/unused/commands/Economy/work.js b/unused/commands/Economy/work.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "work", description: "Work to earn money", @@ -20,7 +20,7 @@ module.exports = { await client.add(interaction.user.id, earning, interaction); interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setAuthor( interaction.user.tag, interaction.user.displayAvatarURL({ dynamic: true }) @@ -29,7 +29,10 @@ module.exports = { `Good Job! You worked as a **${job}** and earned **${earning}${client.currency}**` ) .setTimestamp() - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setColor(client.color), ], }); diff --git a/unused/commands/Moderation/ban.js b/unused/commands/Moderation/ban.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "ban", description: "Ban an user", @@ -43,12 +43,15 @@ module.exports = { interaction.followUp({ content: "You can't ban yourself" }); } if (reason.length > 1024) reason = reason.slice(0, 1021) + "..."; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("User Banned") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", one.tag, true) .addField("**Reason**", reason, true) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); @@ -78,7 +81,7 @@ module.exports = { } if (reason.length > 1024) reason = reason.slice(0, 1021) + "..."; try { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("User Banned") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", target.user.tag, true) @@ -88,7 +91,10 @@ module.exports = { days.toString(), true ) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); diff --git a/unused/commands/Moderation/kick.js b/unused/commands/Moderation/kick.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "kick", description: "Kick an user", @@ -39,12 +39,15 @@ module.exports = { } if (reason.length > 1024) reason = reason.slice(0, 1021) + "..."; try { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("User Kicked") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", target.user.tag, true) .addField("**Reason**", reason, true) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); diff --git a/unused/commands/Moderation/lock.js b/unused/commands/Moderation/lock.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "lockdown", description: "Lock a channel", @@ -18,14 +18,14 @@ module.exports = { interaction.channel.permissionOverwrites .create(interaction.guild.id, { SEND_MESSAGES: false }) .then(() => { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("Channel Locked") .addField("**Moderator**", interaction.user.tag, true) .addField("**Channel**", `<#${interaction.channel.id}>`, true) - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); @@ -35,14 +35,14 @@ module.exports = { interaction.channel.permissionOverwrites .create(interaction.guild.id, { SEND_MESSAGES: true }) .then(() => { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("Channel Unlocked") .addField("**Moderator**", interaction.user.tag, true) .addField("**Channel**", `<#${interaction.channel.id}>`, true) - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); diff --git a/unused/commands/Moderation/mute.js b/unused/commands/Moderation/mute.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "mute", description: "Mute an user.", @@ -65,15 +65,15 @@ module.exports = { }); } else { await user.roles.add(mutedrole.id); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("User Muted") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", user.user.tag, true) .addField("**Reason**", reason, true) - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); @@ -96,13 +96,16 @@ module.exports = { }); } else { await user.roles.add(mutedrole.id); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("User Muted") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", user.user.tag, true) .addField("**Time**", utils.ms(utils.ms(time), { long: true }), true) .addField("**Reason**", reason, true) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); diff --git a/unused/commands/Moderation/purge.js b/unused/commands/Moderation/purge.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "clear", @@ -9,7 +9,7 @@ module.exports = { description: "Channel where the messages to be deleted", type: 7, required: true, - channelTypes: ["GUILD_TEXT"], + channelTypes: [0], }, { name: "amount", @@ -18,7 +18,7 @@ module.exports = { required: true, }, ], - type: "CHAT_INPUT", + run: async (client, interaction, args) => { try { const query = args[1]; @@ -46,7 +46,7 @@ module.exports = { const userMessageMap = Object.entries(results); channel.send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle(`Message Cleared`) .addField( "**Moderator**", @@ -65,10 +65,10 @@ module.exports = { .join("\n")}`, false ) - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail( interaction.user.displayAvatarURL({ dynamic: true }) diff --git a/unused/commands/Moderation/role.js b/unused/commands/Moderation/role.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "role", UserPerms: ["MANAGE_ROLES"], @@ -27,11 +27,14 @@ module.exports = { if (role.managed) { interaction.followUp({ content: "You must provide a non bot role" }); } else if (target.roles.cache.has(role.id)) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("Role Removed") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", target.user.tag, true) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); @@ -39,11 +42,14 @@ module.exports = { .followUp({ embeds: [embed] }) .then(await target.roles.remove(role.id)); } else { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("Role Added") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", target.user.tag, true) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); diff --git a/unused/commands/Moderation/slowmode.js b/unused/commands/Moderation/slowmode.js @@ -28,10 +28,13 @@ module.exports = { { label: "6h", value: "6h" }, ]); let row = new Discord.MessageActionRow().addComponents(menu); - const slowmoEmbed = new Discord.MessageEmbed() + const slowmoEmbed = new Discord.EmbedBuilder() .setColor(client.color) .setTitle("Slowmode") - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setAuthor( `Requested by ${interaction.user.tag}`, @@ -56,7 +59,7 @@ module.exports = { menu.setPlaceholder(`Set to: ${collected.values[0]}`); row = new Discord.MessageActionRow().addComponents(menu); if (collected.values[0] !== "OFF") { - const embed = new Discord.MessageEmbed() + const embed = new Discord.EmbedBuilder() .setColor("GREEN") .setTitle("Slowmode Added") .addField("**Moderator**", interaction.user.tag, true) @@ -66,25 +69,27 @@ module.exports = { `${utils.ms(utils.ms(collected.values[0]), { long: true })}`, true ) - .setFooter( - interaction.member.displayName || interaction.user.username, - interaction.user.displayAvatarURL({ dynamic: true }) - ) + .setFooter({ + text: + interaction.member.displayName || interaction.user.username, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }), + }) .setThumbnail(client.user.displayAvatarURL()); interaction.channel.setRateLimitPerUser( utils.ms(collected.values[0]) / 1e3 ); return sent.edit({ embeds: [embed], components: [row] }); } else { - const embed = new Discord.MessageEmbed() + const embed = new Discord.EmbedBuilder() .setColor("RED") .setTitle("Slowmode Removed") .addField("**Moderator**", interaction.user.tag, true) .addField("**Channel**", `<#${interaction.channel.id}>`, true) - .setFooter( - interaction.member.displayName || interaction.user.username, - interaction.user.displayAvatarURL({ dynamic: true }) - ) + .setFooter({ + text: + interaction.member.displayName || interaction.user.username, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }), + }) .setThumbnail(client.user.displayAvatarURL()) .setColor("RED"); interaction.channel.setRateLimitPerUser(0); diff --git a/unused/commands/Moderation/unban.js b/unused/commands/Moderation/unban.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "unban", description: "Unban an user", @@ -17,11 +17,14 @@ module.exports = { run: async (client, interaction, args) => { try { const user = await interaction.guild.members.unban(args[0]); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("User Unbanned") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", user.tag, true) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); diff --git a/unused/commands/Moderation/unmute.js b/unused/commands/Moderation/unmute.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "unmute", UserPerms: ["MANAGE_MESSAGES"], @@ -22,11 +22,14 @@ module.exports = { interaction.followUp({ content: "Mute role not found in database" }); } await user.roles.remove(mutedrole); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("User Unmuted") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", user.user.tag, true) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); diff --git a/unused/commands/Moderation/warn.js b/unused/commands/Moderation/warn.js @@ -1,6 +1,6 @@ const db = require("../../../models/warns"); const moment = require("moment"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "warn", UserPerms: ["MANAGE_MESSAGES"], @@ -8,7 +8,7 @@ module.exports = { category: "Moderation", options: [ { - type: "SUB_COMMAND", + type: 1, name: "add", description: "Warn a user", options: [ @@ -27,7 +27,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "list", description: "Show a list of warnings of an user", options: [ @@ -40,7 +40,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "remove", description: "Remove a latest warn for an user", options: [ @@ -59,7 +59,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "clear", description: "Clear an user's warns", options: [ @@ -125,12 +125,15 @@ module.exports = { content: `You have been warned in **${interaction.guild.name}** for **${reason}**`, }) .catch(e => {}); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("User Warned") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", user.user.tag, true) .addField("**Reason**", reason, true) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true })) .setColor(client.color); @@ -143,7 +146,7 @@ module.exports = { if (data.Warns.map(e => e).length > 0) { interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle(`${user.user.tag}'s warns`) .setDescription( data.Warns.map( @@ -194,7 +197,7 @@ module.exports = { if (data) { const number = args[2] - 1; data.Warns.splice(number, 1); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("Warn Removed") .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", user.user.tag, true) @@ -242,7 +245,7 @@ module.exports = { }); interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle(`Warns Cleared`) .addField("**Moderator**", interaction.user.tag, true) .addField("**User**", user.user.tag, true) diff --git a/unused/commands/Music/grab.js b/unused/commands/Music/grab.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "grab", description: "Saves the current song to your Direct Messages", @@ -19,7 +19,7 @@ module.exports = { } if (!player) client.err(interaction, "**Nothing is playing right now**"); try { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setAuthor( `Song saved: `, "https://cdn.discordapp.com/emojis/897017864085712936.gif" @@ -41,7 +41,10 @@ module.exports = { .addField(`šŸŽµ Author: `, `\`${player.queue.current.author}\``, true) .addField(`ā–¶ Play it:`, `\`${player.queue.current.uri}\``) .addField(`šŸ”Ž Saved in:`, `<#${interaction.channel.id}>`) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()); + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }); interaction.user.send({ embeds: [embed] }); } catch (e) { console.log(e); diff --git a/unused/commands/Music/loop.js b/unused/commands/Music/loop.js @@ -4,13 +4,13 @@ module.exports = { category: "Music", options: [ { - type: "SUB_COMMAND", + type: 1, name: "track", description: "Loop the track", options: [], }, { - type: "SUB_COMMAND", + type: 1, name: "queue", description: "Loop the whole queue", options: [], diff --git a/unused/commands/Music/nowplaying.js b/unused/commands/Music/nowplaying.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "nowplaying", description: "Show now playing music info", @@ -21,7 +21,7 @@ module.exports = { if (!player) client.err(interaction, "**Nothing is playing right now**"); interaction.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setAuthor( `Current song playing:`, client.user.displayAvatarURL({ diff --git a/unused/commands/Music/play.js b/unused/commands/Music/play.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "play", description: "Plays your favourite music from YouTube or Spotify", @@ -49,7 +49,7 @@ module.exports = { if (!player.playing && !player.paused && !player.queue.length) { player.play(); } - const SongAddedEmbed = new MessageEmbed() + const SongAddedEmbed = new EmbedBuilder() .setAuthor(`Added to queue`, client.user.displayAvatarURL()) .setThumbnail(res.tracks[0].displayThumbnail()) .setColor(client.color) @@ -73,7 +73,7 @@ module.exports = { case "PLAYLIST_LOADED": player.queue.add(res.tracks); await player.play(); - const SongAdded = new MessageEmbed() + const SongAdded = new EmbedBuilder() .setAuthor( `Playlist added to queue`, client.user.displayAvatarURL() @@ -95,7 +95,7 @@ module.exports = { const track = res.tracks[0]; player.queue.add(track); if (!player.playing && !player.paused && !player.queue.length) { - const SongAddedEmbed = new MessageEmbed() + const SongAddedEmbed = new EmbedBuilder() .setAuthor(`Added to queue`, client.user.displayAvatarURL()) .setThumbnail(track.displayThumbnail()) .setColor(client.color) @@ -117,7 +117,7 @@ module.exports = { player.play(); interaction.followUp({ embeds: [SongAddedEmbed] }); } else { - const SongAddedEmbed = new MessageEmbed() + const SongAddedEmbed = new EmbedBuilder() .setAuthor(`Added to queue`, client.user.displayAvatarURL()) .setThumbnail(track.displayThumbnail()) .setColor(client.color) diff --git a/unused/commands/Music/queue.js b/unused/commands/Music/queue.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const { Pagination } = require("cath"); module.exports = { name: "queue", @@ -22,7 +22,7 @@ module.exports = { } if (!player) client.err(interaction, "**Nothing is playing right now**"); if (!player.queue || !player.queue.length || player.queue === 0) { - const QueueEmbed = new MessageEmbed() + const QueueEmbed = new EmbedBuilder() .setAuthor( "Currently playing", interaction.user.displayAvatarURL({ dynamic: true }) @@ -71,7 +71,7 @@ module.exports = { }); const c = pagination.chunk(mapped, 10).map(x => x.join("\n")); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setAuthor( `Queue for ${interaction.guild.name}`, interaction.user.displayAvatarURL({ dynamic: true }) @@ -104,7 +104,7 @@ module.exports = { true ) .setTimestamp() - .setFooter(`Page 1 of ${c.length}`) + .setFooter({ text: `Page 1 of ${c.length}` }) .setThumbnail(player.queue.current.displayThumbnail()); const msg = await interaction.followUp({ embeds: [embed], diff --git a/unused/commands/Utilities/add.js b/unused/commands/Utilities/add.js @@ -5,7 +5,7 @@ module.exports = { Owner: true, options: [ { - type: "SUB_COMMAND", + type: 1, name: "add", description: "Remove coins from someone", options: [ @@ -24,7 +24,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "rmv", description: "Remove coins from someone", options: [ diff --git a/unused/commands/Utilities/afk.js b/unused/commands/Utilities/afk.js @@ -1,10 +1,10 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); module.exports = { name: "afk", description: "Tell someone you are AFK.", usage: "{Status}", category: "Utilities", - type: "CHAT_INPUT", + options: [ { type: 3, @@ -18,7 +18,7 @@ module.exports = { const content = args[0] || "No status provided."; uuser.setNickname(`[AFK] ${interaction.user.username}`).catch(); await client.data.AFK(interaction.user.id, content); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescription( `${interaction.user.username} is set into AFK.\nStatus : ${content}` ) diff --git a/unused/commands/Utilities/draw.js b/unused/commands/Utilities/draw.js @@ -1,13 +1,16 @@ -const { MessageEmbed, MessageActionRow, MessageButton } = require("discord.js"); +const { EmbedBuilder, MessageActionRow, MessageButton } = require("discord.js"); const draws = require("../../../util/Data/draws.json"); module.exports = { name: "draw", description: "Buy a lucky draw", run: async (client, message, args, utils) => { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle("**__Daily Lucky Draw__**") .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setDescription( "Welcome to the Lucky Draw,\nclick `Spin`, so that the draw spins and hits a random item.\nClick `Info` to find out how high the probability is\n that a particular item will be unlocked" @@ -60,7 +63,7 @@ module.exports = { if (i.customId === "spininfo") { i.reply({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("**__Information Table__**") .addFields( draws[0].map(c => { diff --git a/unused/commands/Utilities/emoji.js b/unused/commands/Utilities/emoji.js @@ -4,7 +4,7 @@ module.exports = { usage: "(Emoji)", description: "Show an emoji URL", category: "Utilities", - type: "CHAT_INPUT", + options: [ { type: 3, diff --git a/unused/commands/Utilities/esnipe.js b/unused/commands/Utilities/esnipe.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const moment = require("moment"); module.exports = { name: "editsnipe", @@ -10,7 +10,7 @@ module.exports = { name: "channel", description: "The sniped channel", required: true, - channelTypes: ["GUILD_TEXT"], + channelTypes: [0], }, { type: 4, @@ -22,13 +22,16 @@ module.exports = { run: async (client, interaction, args) => { var i = 0; let description = ""; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setAuthor( `Sniped by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ dynamic: true }) ) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setURL(client.web); const snipes = client.esnipes.get(args[0]) || []; diff --git a/unused/commands/Utilities/giveaway.js b/unused/commands/Utilities/giveaway.js @@ -5,7 +5,7 @@ module.exports = { UserPerms: ["MANAGE_MESSAGES"], options: [ { - type: "SUB_COMMAND", + type: 1, name: "start", description: "Start a giveaway", options: [ @@ -33,7 +33,7 @@ module.exports = { name: "channel", description: "The channel of the giveaway", required: true, - channelTypes: ["GUILD_TEXT"], + channelTypes: [0], }, { type: 8, @@ -53,7 +53,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "reroll", description: "Reroll a giveaway", options: [ @@ -67,7 +67,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "end", description: "End a giveaway", options: [ diff --git a/unused/commands/Utilities/lyrics.js b/unused/commands/Utilities/lyrics.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const axios = require("axios"); const { Pagination } = require("cath"); module.exports = { @@ -27,7 +27,7 @@ module.exports = { }); } else { const splittedLyrics = splitlyrics.chunk(lyricsdata.lyrics, 1024); - const lyricsEmbed = new MessageEmbed() + const lyricsEmbed = new EmbedBuilder() .setAuthor(`Lyrics`) .setColor("YELLOW") .addFields( @@ -42,7 +42,7 @@ module.exports = { } ) .setDescription(splittedLyrics[0]) - .setFooter(`Page 1 of ${splittedLyrics.length}`) + .setFooter({ text: `Page 1 of ${splittedLyrics.length}` }) .setThumbnail(lyricsdata.image) .setTimestamp(); const lyricsMsg = await interaction.followUp({ embeds: [lyricsEmbed] }); diff --git a/unused/commands/Utilities/modmail.js b/unused/commands/Utilities/modmail.js @@ -1,168 +1,166 @@ const schema = require("../../models/modmail"); -const { MessageEmbed, MessageAttachment } = require("discord.js"); +const { EmbedBuilder, MessageAttachment } = require("discord.js"); const fs = require("fs"); module.exports = { - name: "modmail", - BotPerm: "MANAGE_CHANNELS", - description: "Create a modmail thread with moderators in a server", - usage: "(Emoji) (Text)", - category: "Utilities", - run: async (client, interaction, args) => { - try { - const data = await schema.findOne({ Guild: interaction.guild.id }); - if ( - !data || + name: "modmail", + BotPerm: "MANAGE_CHANNELS", + description: "Create a modmail thread with moderators in a server", + usage: "(Emoji) (Text)", + category: "Utilities", + run: async (client, interaction, args) => { + try { + const data = await schema.findOne({ Guild: interaction.guild.id }); + if ( + !data || !data.Role || !data.Category || !data.Choices || !Object.entries(data.Choices).length || !interaction.guild.roles.cache.has(data.Role) || !interaction.guild.channels.cache.find( - value => value.type == "GUILD_CATEGORY" && value.id === data.Category, + value => value.type == "GUILD_CATEGORY" && value.id === data.Category ) - ) { - return interaction.followUp({ - content: `This server isn't setup properly. Please find an administrator or a moderator to specify a category, role and choices for users to create thread. The issue may be caused by invalid role/category.`, - }); - } - interaction.deleteReply(); - const choices = Object.entries(data.Choices); - const embed = new MessageEmbed() - .setDescription( - `Choices of topic:\n${choices - .map(value => `${value[1].emoji} - ${value[1].text}`) - .join("\n")}`, - ) - .setAuthor( - interaction.guild.name, - interaction.guild.iconURL({ dynamic: true }), - ) - .setColor(client.color) - .setTimestamp() - .setTitle(`${interaction.user.tag}'s modmail`); - const msg = await interaction.user.send({ - content: "Please react below", - embeds: [embed], - }); - choices.map(async value => { - await msg.react(value[1].emoji); - }); - const filter = (reaction, user) => { - return ( - choices.map(value => value[1].emoji).includes(reaction.emoji.name) && + ) { + return interaction.followUp({ + content: `This server isn't setup properly. Please find an administrator or a moderator to specify a category, role and choices for users to create thread. The issue may be caused by invalid role/category.`, + }); + } + interaction.deleteReply(); + const choices = Object.entries(data.Choices); + const embed = new EmbedBuilder() + .setDescription( + `Choices of topic:\n${choices + .map(value => `${value[1].emoji} - ${value[1].text}`) + .join("\n")}` + ) + .setAuthor( + interaction.guild.name, + interaction.guild.iconURL({ dynamic: true }) + ) + .setColor(client.color) + .setTimestamp() + .setTitle(`${interaction.user.tag}'s modmail`); + const msg = await interaction.user.send({ + content: "Please react below", + embeds: [embed], + }); + choices.map(async value => { + await msg.react(value[1].emoji); + }); + const filter = (reaction, user) => { + return ( + choices.map(value => value[1].emoji).includes(reaction.emoji.name) && user.id !== interaction.user.id - ); - }; - const reactionCollector = msg.createReactionCollector({ - filter, - }); - let type; - reactionCollector - .on("collect", async (reaction, user) => { - type = choices.find(value => value[1].emoji == reaction.emoji.name); - await msg.delete(); - reactionCollector.stop("done"); - }) - .on("end", async (collected, reason) => { - if (reason.toLowerCase() == "time") { - return interaction.user.send({ - content: "You didn't provide a reaction in-time. Cancelled", - }); - } - else { - const channel = await interaction.guild.channels.create( - `${interaction.user.username}-${interaction.user.discriminator}`, - { - reason: "Modmail thread", - parent: data.Category, - topic: `${type[1].text}`, - type: "text", - }, - ); - const transcript = []; - channel.permissionOverwrites.create(data.Role, { - VIEW_CHANNEL: true, - SEND_MESSAGES: true, - }); - channel.permissionOverwrites.create(interaction.guild.id, { - VIEW_CHANNEL: false, - }); - channel.send({ - content: `A modmail thread has been started by **${interaction.user.tag}** with type: **${type[1].text}**\nUse \`close\` to close the thread`, - }); - interaction.user.send({ - content: "Thread created. Use `close` to close the thread.", - }); - const filter = m => !m.author.bot; - const channelCollector = channel.createMessageCollector({ filter }); - const dmCollector = + ); + }; + const reactionCollector = msg.createReactionCollector({ + filter, + }); + let type; + reactionCollector + .on("collect", async (reaction, user) => { + type = choices.find(value => value[1].emoji == reaction.emoji.name); + await msg.delete(); + reactionCollector.stop("done"); + }) + .on("end", async (collected, reason) => { + if (reason.toLowerCase() == "time") { + return interaction.user.send({ + content: "You didn't provide a reaction in-time. Cancelled", + }); + } else { + const channel = await interaction.guild.channels.create( + `${interaction.user.username}-${interaction.user.discriminator}`, + { + reason: "Modmail thread", + parent: data.Category, + topic: `${type[1].text}`, + type: "text", + } + ); + const transcript = []; + channel.permissionOverwrites.create(data.Role, { + VIEW_CHANNEL: true, + SEND_MESSAGES: true, + }); + channel.permissionOverwrites.create(interaction.guild.id, { + VIEW_CHANNEL: false, + }); + channel.send({ + content: `A modmail thread has been started by **${interaction.user.tag}** with type: **${type[1].text}**\nUse \`close\` to close the thread`, + }); + interaction.user.send({ + content: "Thread created. Use `close` to close the thread.", + }); + const filter = m => !m.author.bot; + const channelCollector = channel.createMessageCollector({ filter }); + const dmCollector = interaction.user.dmChannel.createMessageCollector({ - filter, + filter, + }); + channelCollector.on("collect", async m => { + if (m.content.toLowerCase().startsWith("close")) { + interaction.user.send({ + content: `Admin has closed the thread`, + }); + channel.send({ content: "Closing.." }); + dmCollector.stop("done"); + channelCollector.stop("done"); + fs.writeFileSync( + `./${interaction.user.id}.txt`, + transcript.join("\n") + ); + const attachment = new MessageAttachment( + fs.createReadStream(`./${interaction.user.id}.txt`), + `Transcript-${interaction.user.id}` + ); + await channel.send({ + content: "Transcript:", + files: [attachment], + }); + fs.unlinkSync(`./transcript-${interaction.user.id}.txt`); + setTimeout(() => { + channel.delete(); + }, 1000 * 10); + } + interaction.user.send({ content: `**Admin**: ${m.content}` }); + transcript.push(`**Admin**: ${m.content}`); + }); + dmCollector.on("collect", async m => { + if (m.content.toLowerCase().startsWith("close")) { + interaction.user.send({ content: "Closed" }); + channel.send({ + content: `${interaction.user.tag} has closed the thread`, + }); + dmCollector.stop("done"); + channelCollector.stop("done"); + fs.writeFileSync( + `./${interaction.user.id}.txt`, + transcript.join("\n") + ); + const attachment = new MessageAttachment( + fs.createReadStream(`./${interaction.user.id}.txt`), + `Transcript-${interaction.user.id}` + ); + await channel.send({ + content: "Transcript:", + files: [attachment], + }); + fs.unlinkSync(`./${interaction.user.id}.txt`); + setTimeout(() => { + channel.delete(); + }, 1000 * 60 * 12); + } + channel.send({ + content: `**${interaction.user.tag}**: ${m.content}`, }); - channelCollector.on("collect", async m => { - if (m.content.toLowerCase().startsWith("close")) { - interaction.user.send({ - content: `Admin has closed the thread`, - }); - channel.send({ content: "Closing.." }); - dmCollector.stop("done"); - channelCollector.stop("done"); - fs.writeFileSync( - `./${interaction.user.id}.txt`, - transcript.join("\n"), - ); - const attachment = new MessageAttachment( - fs.createReadStream(`./${interaction.user.id}.txt`), - `Transcript-${interaction.user.id}`, - ); - await channel.send({ - content: "Transcript:", - files: [attachment], - }); - fs.unlinkSync(`./transcript-${interaction.user.id}.txt`); - setTimeout(() => { - channel.delete(); - }, 1000 * 10); - } - interaction.user.send({ content: `**Admin**: ${m.content}` }); - transcript.push(`**Admin**: ${m.content}`); - }); - dmCollector.on("collect", async m => { - if (m.content.toLowerCase().startsWith("close")) { - interaction.user.send({ content: "Closed" }); - channel.send({ - content: `${interaction.user.tag} has closed the thread`, - }); - dmCollector.stop("done"); - channelCollector.stop("done"); - fs.writeFileSync( - `./${interaction.user.id}.txt`, - transcript.join("\n"), - ); - const attachment = new MessageAttachment( - fs.createReadStream(`./${interaction.user.id}.txt`), - `Transcript-${interaction.user.id}`, - ); - await channel.send({ - content: "Transcript:", - files: [attachment], - }); - fs.unlinkSync(`./${interaction.user.id}.txt`); - setTimeout(() => { - channel.delete(); - }, 1000 * 60 * 12); - } - channel.send({ - content: `**${interaction.user.tag}**: ${m.content}`, - }); - transcript.push(`**${interaction.user.tag}**: ${m.content}`); - }); - } - }); - } - catch (e) { - console.log(e); - return interaction.followUp({ content: "An error occured" }); - } - }, + transcript.push(`**${interaction.user.tag}**: ${m.content}`); + }); + } + }); + } catch (e) { + console.log(e); + return interaction.followUp({ content: "An error occured" }); + } + }, }; diff --git a/unused/commands/Utilities/nsfw.js b/unused/commands/Utilities/nsfw.js @@ -1,5 +1,5 @@ const { getreddit } = require("cath"); -const { MessageActionRow, MessageButton, MessageEmbed } = require("discord.js"); +const { MessageActionRow, MessageButton, EmbedBuilder } = require("discord.js"); module.exports = { name: "nsfw", description: "NSFW command", @@ -7,7 +7,7 @@ module.exports = { const msg = await interaction.channel.send({ content: "Getting images" }); async function embed() { if (!interaction.channel.nsfw) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`AYO Calm Yo Cheeks`) .setDescription("This command only works in NSFW Channels!") .setImage( @@ -59,7 +59,7 @@ module.exports = { } } let embed1 = null; - embed1 = new MessageEmbed({ + embed1 = new EmbedBuilder({ title: data.title, url: data.url, image: { url: data.image }, diff --git a/unused/commands/Utilities/snipe.js b/unused/commands/Utilities/snipe.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const moment = require("moment"); module.exports = { name: "snipe", @@ -10,7 +10,7 @@ module.exports = { name: "channel", description: "The sniped channel", required: true, - channelTypes: ["GUILD_TEXT"], + channelTypes: [0], }, { type: 4, @@ -22,13 +22,16 @@ module.exports = { run: async (client, interaction, args) => { var i = 0; let description = ""; - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setAuthor( `Sniped by ${interaction.user.tag}`, interaction.user.displayAvatarURL({ dynamic: true }) ) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setURL(client.web); const snipes = client.snipes.get(args[0]) || []; diff --git a/unused/err.js b/unused/err.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const client = require(".."); /** * @param {String} message @@ -198,7 +198,7 @@ module.exports = async (message, dir, file, err) => { } const pull = require(`../../commands/${dir}/${file}`); const pre = await client.prefix(message); - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setAuthor( `Error from ${message.author.tag}`, message.author.displayAvatarURL({ dynamic: true }) @@ -216,7 +216,10 @@ module.exports = async (message, dir, file, err) => { .setTimestamp() .setThumbnail(client.user.displayAvatarURL({ dynamic: false })) .setURL(client.web) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()); + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }); const msg = await message.reply({ embeds: [embed] }); setTimeout(function () { msg.delete(); diff --git a/unused/events/voiceStateUpdate.js b/unused/events/voiceStateUpdate.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const client = require("../.."); client.on("voiceStateUpdate", async (oldState, newState) => { const guildId = newState.guild.id; @@ -37,7 +37,7 @@ client.on("voiceStateUpdate", async (oldState, newState) => { switch (stateChange.type) { case "JOIN": if (stateChange.members.size === 1 && player.paused) { - const emb = new MessageEmbed() + const emb = new EmbedBuilder() .setAuthor(`Resumed`, client.user.displayAvatarURL()) .setColor(client.config.color) .setDescription( @@ -50,7 +50,7 @@ client.on("voiceStateUpdate", async (oldState, newState) => { case "LEAVE": if (stateChange.members.size === 0 && !player.paused && player.playing) { player.pause(true); - const emb = new MessageEmbed() + const emb = new EmbedBuilder() .setAuthor(`Paused`, client.user.displayAvatarURL()) .setColor(client.config.color) .setDescription( diff --git a/util/Data/CODM/loadout.js b/util/Data/CODM/loadout.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); //@night0721 You need to make this +const { EmbedBuilder } = require("discord.js"); //@night0721 You need to make this const items = require("../../util/Data/loadout.json"); module.exports = { name: "class", @@ -21,9 +21,9 @@ module.exports = { // slot_3 = slots.next().value, // slot_4 = slots.next().value, // slot_5 = slots.next().value; - const result = new MessageEmbed() + const result = new EmbedBuilder() .setColor(client.color) - .setFooter(`Made by ${client.author}`) + .setFooter({ text: `Made by ${client.author}` }) .setURL(client.web) .setTitle(`šŸŽ² A Randomly Generated Loadout šŸŽ²`) .setDescription( diff --git a/util/Data/CODM/new-stats.js b/util/Data/CODM/new-stats.js @@ -1,4 +1,4 @@ -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); const moment = require("moment"); const axios = require("axios"); module.exports = { @@ -8,7 +8,7 @@ module.exports = { category: "CODM", options: [ { - type: "SUB_COMMAND", + type: 1, name: "assault_rifle", description: "Get a Stats for Assault Rifle", options: [ @@ -107,7 +107,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "sub_machine_gun", description: "Get a Stats for Sub Machine Gun", options: [ @@ -190,7 +190,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "sniper_rifle", description: "Get a Stats for Sniper Rifle", options: [ @@ -241,7 +241,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "light_machine_gun", description: "Get a Stats for Light Machine Gun", options: [ @@ -288,7 +288,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "shotgun", description: "Get a Stats for Shotgun", options: [ @@ -335,7 +335,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "marksman_rifle", description: "Get a Stats for Marksman Rifle", options: [ @@ -366,7 +366,7 @@ module.exports = { ], }, { - type: "SUB_COMMAND", + type: 1, name: "pistol", description: "Get a Stats for Pistol", options: [ @@ -418,18 +418,18 @@ module.exports = { .catch(e => null); if (!data?.ID) { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setDescription( `<:nyx_not_available:897378400031879188> Sorry, We currently don't have Stats for this Weapon` ) .setColor(client.color); interaction.followUp({ embeds: [embed] }); } else { - const embed = new MessageEmbed() + const embed = new EmbedBuilder() .setTitle(`${data.author} Statistical Breakdown`) .setColor(16580400) .setImage(data.imageUrl) - .setFooter(`Stats Curtosy of Round Table`) + .setFooter({ text: `Stats Curtosy of Round Table` }) // .setFooter( // `Stats Curtosy of Stats on Duty`, // ) diff --git a/util/Data/CODM/stats.js b/util/Data/CODM/stats.js @@ -1,6 +1,6 @@ const common = require("../../util/functions/common"); const data = require("../../util/Data/data.json"); -const { MessageEmbed } = require("discord.js"); +const { EmbedBuilder } = require("discord.js"); let currGun, currStats, @@ -71,7 +71,7 @@ module.exports = { const recoilImageLink = await chart.getShortUrl(); repEmb.image = { url: recoilImageLink }; } - interaction.followUp({ embeds: [new MessageEmbed(repEmb)] }); + interaction.followUp({ embeds: [new EmbedBuilder(repEmb)] }); } }, }; diff --git a/util/functions/function.js b/util/functions/function.js @@ -1,4 +1,4 @@ -const { MessageEmbed, MessageActionRow, MessageButton } = require("discord.js"); +const { EmbedBuilder, MessageActionRow, MessageButton } = require("discord.js"); function rndint(max, min) { return Math.floor(Math.random() * (max - (min ? min : 0))) + (min ? min : 0); } @@ -156,7 +156,7 @@ function cooldown(dbtime, defaults, msg) { const slowed = slow[Math.floor(Math.random() * slow.length)]; return msg.followUp({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setColor("RANDOM") .setTimestamp() .setTitle(slowed) @@ -415,11 +415,14 @@ function tips(interaction, client) { if (ran <= 11) { interaction.channel.send({ embeds: [ - new MessageEmbed() + new EmbedBuilder() .setTitle("Tips") .setColor(client.color) .setDescription(`**šŸ’” Did you know**\n${rTip}`) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp() .setURL(client.web), ],