From ce1e26da93fa4bccdc767139c7c79d80b5ecdedf Mon Sep 17 00:00:00 2001 From: William Harrison Date: Tue, 27 Jun 2023 19:57:08 +0800 Subject: [PATCH] feat: new public cmds + renamed cmd folderes --- .../{developer => dev}/resolve-all-errors.js | 0 src/commands/{developer => dev}/admin.js | 104 ------------------ .../{developer => dev}/announcements.js | 0 src/commands/{developer => dev}/database.js | 0 src/commands/{developer => dev}/dev.js | 0 src/commands/{developer => dev}/eval.js | 0 src/commands/{user => info}/bot.js | 0 src/commands/info/developers.js | 43 ++++++++ src/commands/{user => info}/help.js | 0 src/commands/{user => info}/invite.js | 0 src/commands/info/moderators.js | 43 ++++++++ src/commands/{user => info}/ping.js | 0 src/commands/{user => info}/support.js | 0 src/commands/info/supporters.js | 43 ++++++++ src/commands/{user => info}/terms.js | 0 src/commands/{user => info}/vote.js | 0 src/commands/{moderator => mod}/appeal.js | 0 src/commands/{moderator => mod}/appeals.js | 0 src/commands/{moderator => mod}/ban.js | 0 src/commands/{moderator => mod}/filter.js | 0 src/commands/{moderator => mod}/message.js | 0 src/commands/{moderator => mod}/unban.js | 0 src/commands/{moderator => mod}/user.js | 0 23 files changed, 129 insertions(+), 104 deletions(-) rename src/buttons/{developer => dev}/resolve-all-errors.js (100%) rename src/commands/{developer => dev}/admin.js (86%) rename src/commands/{developer => dev}/announcements.js (100%) rename src/commands/{developer => dev}/database.js (100%) rename src/commands/{developer => dev}/dev.js (100%) rename src/commands/{developer => dev}/eval.js (100%) rename src/commands/{user => info}/bot.js (100%) create mode 100644 src/commands/info/developers.js rename src/commands/{user => info}/help.js (100%) rename src/commands/{user => info}/invite.js (100%) create mode 100644 src/commands/info/moderators.js rename src/commands/{user => info}/ping.js (100%) rename src/commands/{user => info}/support.js (100%) create mode 100644 src/commands/info/supporters.js rename src/commands/{user => info}/terms.js (100%) rename src/commands/{user => info}/vote.js (100%) rename src/commands/{moderator => mod}/appeal.js (100%) rename src/commands/{moderator => mod}/appeals.js (100%) rename src/commands/{moderator => mod}/ban.js (100%) rename src/commands/{moderator => mod}/filter.js (100%) rename src/commands/{moderator => mod}/message.js (100%) rename src/commands/{moderator => mod}/unban.js (100%) rename src/commands/{moderator => mod}/user.js (100%) diff --git a/src/buttons/developer/resolve-all-errors.js b/src/buttons/dev/resolve-all-errors.js similarity index 100% rename from src/buttons/developer/resolve-all-errors.js rename to src/buttons/dev/resolve-all-errors.js diff --git a/src/commands/developer/admin.js b/src/commands/dev/admin.js similarity index 86% rename from src/commands/developer/admin.js rename to src/commands/dev/admin.js index 10ce34c..48d3f07 100644 --- a/src/commands/developer/admin.js +++ b/src/commands/dev/admin.js @@ -44,13 +44,6 @@ module.exports = { ] }, - { - type: 1, - name: "developers", - description: "Get a list of all the developers.", - options: [] - }, - { type: 2, name: "mod", @@ -86,13 +79,6 @@ module.exports = { ] }, - { - type: 1, - name: "moderators", - description: "Get a list of all the moderators.", - options: [] - }, - { type: 1, name: "send-appeal-menu", @@ -123,13 +109,6 @@ module.exports = { ] }, - { - type: 1, - name: "supporters", - description: "Get a list of all the supporters.", - options: [] - }, - { type: 1, name: "unverify", @@ -272,33 +251,6 @@ module.exports = { return; } - if(interaction.options.getSubcommand() === "developers") { - const devs = await devSchema.find(); - - const users = []; - - for(const user of devs) { - users.push(user._id); - } - - if(!users.length) { - const error = new Discord.EmbedBuilder() - .setColor(client.config_embeds.error) - .setDescription(`${emoji.error} There are no developers!`) - - await interaction.editReply({ embeds: [error], ephemeral: true }); - return; - } - - const developers = new Discord.EmbedBuilder() - .setColor(client.config_embeds.default) - .setTitle("💻 Developers") - .setDescription(`<@${users.join(">\n<@")}>`) - - await interaction.editReply({ embeds: [developers] }); - return; - } - if(interaction.options.getSubcommandGroup() === "mod") { const user = interaction.options.getUser("user"); @@ -378,33 +330,6 @@ module.exports = { return; } - if(interaction.options.getSubcommand() === "moderators") { - const mods = await modSchema.find(); - - const users = []; - - for(const user of mods) { - users.push(user._id); - } - - if(!users.length) { - const error = new Discord.EmbedBuilder() - .setColor(client.config_embeds.error) - .setDescription(`${emoji.error} There are no moderators!`) - - await interaction.editReply({ embeds: [error], ephemeral: true }); - return; - } - - const moderators = new Discord.EmbedBuilder() - .setColor(client.config_embeds.default) - .setTitle("🔨 Moderators") - .setDescription(`<@${users.join(">\n<@")}>`) - - await interaction.editReply({ embeds: [moderators] }); - return; - } - if(interaction.options.getSubcommand() === "send-appeal-menu") { const channel = interaction.options.getChannel("channel"); const appealChannel = client.channels.cache.get(channel.id); @@ -523,35 +448,6 @@ module.exports = { return; } - if(interaction.options.getSubcommand() === "supporters") { - const guild = await client.guilds.fetch(client.config_default.guild); - const members = await guild.members.fetch(); - const boosters = members.filter(member => member.premiumSinceTimestamp); - - const users = []; - - for(const [userId, guildMember] of boosters) { - users.push(userId); - } - - if(!users.length) { - const error = new Discord.EmbedBuilder() - .setColor(client.config_embeds.error) - .setDescription(`${emoji.error} There are no supporters!`) - - await interaction.editReply({ embeds: [error], ephemeral: true }); - return; - } - - const supporters = new Discord.EmbedBuilder() - .setColor(client.config_embeds.default) - .setTitle("💖 Supporters") - .setDescription(`<@${users.join(">\n<@")}>`) - - await interaction.editReply({ embeds: [supporters] }); - return; - } - if(interaction.options.getSubcommand() === "unverify") { const user = interaction.options.getUser("user"); diff --git a/src/commands/developer/announcements.js b/src/commands/dev/announcements.js similarity index 100% rename from src/commands/developer/announcements.js rename to src/commands/dev/announcements.js diff --git a/src/commands/developer/database.js b/src/commands/dev/database.js similarity index 100% rename from src/commands/developer/database.js rename to src/commands/dev/database.js diff --git a/src/commands/developer/dev.js b/src/commands/dev/dev.js similarity index 100% rename from src/commands/developer/dev.js rename to src/commands/dev/dev.js diff --git a/src/commands/developer/eval.js b/src/commands/dev/eval.js similarity index 100% rename from src/commands/developer/eval.js rename to src/commands/dev/eval.js diff --git a/src/commands/user/bot.js b/src/commands/info/bot.js similarity index 100% rename from src/commands/user/bot.js rename to src/commands/info/bot.js diff --git a/src/commands/info/developers.js b/src/commands/info/developers.js new file mode 100644 index 0000000..64bd828 --- /dev/null +++ b/src/commands/info/developers.js @@ -0,0 +1,43 @@ +const emoji = require("../../config.json").emojis; + +const devSchema = require("../../models/devSchema"); + +module.exports = { + name: "developers", + description: "Get a list of all the developers.", + options: [], + default_member_permissions: null, + botPermissions: [], + cooldown: 0, + enabled: true, + hidden: true, + async execute(interaction, client, Discord) { + try { + const devs = await devSchema.find(); + + const users = []; + + for(const user of devs) { + users.push(user._id); + } + + if(!users.length) { + const error = new Discord.EmbedBuilder() + .setColor(client.config_embeds.error) + .setDescription(`${emoji.error} There are no developers!`) + + await interaction.editReply({ embeds: [error], ephemeral: true }); + return; + } + + const developers = new Discord.EmbedBuilder() + .setColor(client.config_embeds.default) + .setTitle("💻 Developers") + .setDescription(`<@${users.join(">\n<@")}>`) + + await interaction.editReply({ embeds: [developers] }); + } catch(err) { + client.logCommandError(err, interaction, Discord); + } + } +} diff --git a/src/commands/user/help.js b/src/commands/info/help.js similarity index 100% rename from src/commands/user/help.js rename to src/commands/info/help.js diff --git a/src/commands/user/invite.js b/src/commands/info/invite.js similarity index 100% rename from src/commands/user/invite.js rename to src/commands/info/invite.js diff --git a/src/commands/info/moderators.js b/src/commands/info/moderators.js new file mode 100644 index 0000000..ee6ff33 --- /dev/null +++ b/src/commands/info/moderators.js @@ -0,0 +1,43 @@ +const emoji = require("../../config.json").emojis; + +const modSchema = require("../../models/modSchema"); + +module.exports = { + name: "moderators", + description: "Get a list of all the moderators.", + options: [], + default_member_permissions: null, + botPermissions: [], + cooldown: 0, + enabled: true, + hidden: true, + async execute(interaction, client, Discord) { + try { + const mods = await modSchema.find(); + + const users = []; + + for(const user of mods) { + users.push(user._id); + } + + if(!users.length) { + const error = new Discord.EmbedBuilder() + .setColor(client.config_embeds.error) + .setDescription(`${emoji.error} There are no moderators!`) + + await interaction.editReply({ embeds: [error], ephemeral: true }); + return; + } + + const moderators = new Discord.EmbedBuilder() + .setColor(client.config_embeds.default) + .setTitle("🔨 Moderators") + .setDescription(`<@${users.join(">\n<@")}>`) + + await interaction.editReply({ embeds: [moderators] }); + } catch(err) { + client.logCommandError(err, interaction, Discord); + } + } +} diff --git a/src/commands/user/ping.js b/src/commands/info/ping.js similarity index 100% rename from src/commands/user/ping.js rename to src/commands/info/ping.js diff --git a/src/commands/user/support.js b/src/commands/info/support.js similarity index 100% rename from src/commands/user/support.js rename to src/commands/info/support.js diff --git a/src/commands/info/supporters.js b/src/commands/info/supporters.js new file mode 100644 index 0000000..3c26b7b --- /dev/null +++ b/src/commands/info/supporters.js @@ -0,0 +1,43 @@ +const emoji = require("../../config.json").emojis; + +module.exports = { + name: "supporters", + description: "Get a list of all the supporters.", + options: [], + default_member_permissions: null, + botPermissions: [], + cooldown: 0, + enabled: true, + hidden: true, + async execute(interaction, client, Discord) { + try { + const guild = await client.guilds.fetch(client.config_default.guild); + const members = await guild.members.fetch(); + const boosters = members.filter(member => member.premiumSinceTimestamp); + + const users = []; + + for(const [userId, guildMember] of boosters) { + users.push(userId); + } + + if(!users.length) { + const error = new Discord.EmbedBuilder() + .setColor(client.config_embeds.error) + .setDescription(`${emoji.error} There are no supporters!`) + + await interaction.editReply({ embeds: [error], ephemeral: true }); + return; + } + + const supporters = new Discord.EmbedBuilder() + .setColor(client.config_embeds.default) + .setTitle("💖 Supporters") + .setDescription(`<@${users.join(">\n<@")}>`) + + await interaction.editReply({ embeds: [supporters] }); + } catch(err) { + client.logCommandError(err, interaction, Discord); + } + } +} diff --git a/src/commands/user/terms.js b/src/commands/info/terms.js similarity index 100% rename from src/commands/user/terms.js rename to src/commands/info/terms.js diff --git a/src/commands/user/vote.js b/src/commands/info/vote.js similarity index 100% rename from src/commands/user/vote.js rename to src/commands/info/vote.js diff --git a/src/commands/moderator/appeal.js b/src/commands/mod/appeal.js similarity index 100% rename from src/commands/moderator/appeal.js rename to src/commands/mod/appeal.js diff --git a/src/commands/moderator/appeals.js b/src/commands/mod/appeals.js similarity index 100% rename from src/commands/moderator/appeals.js rename to src/commands/mod/appeals.js diff --git a/src/commands/moderator/ban.js b/src/commands/mod/ban.js similarity index 100% rename from src/commands/moderator/ban.js rename to src/commands/mod/ban.js diff --git a/src/commands/moderator/filter.js b/src/commands/mod/filter.js similarity index 100% rename from src/commands/moderator/filter.js rename to src/commands/mod/filter.js diff --git a/src/commands/moderator/message.js b/src/commands/mod/message.js similarity index 100% rename from src/commands/moderator/message.js rename to src/commands/mod/message.js diff --git a/src/commands/moderator/unban.js b/src/commands/mod/unban.js similarity index 100% rename from src/commands/moderator/unban.js rename to src/commands/mod/unban.js diff --git a/src/commands/moderator/user.js b/src/commands/mod/user.js similarity index 100% rename from src/commands/moderator/user.js rename to src/commands/mod/user.js