From 7f0835813cb94c9faf6b3deea07dc7169efcd2c0 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Wed, 18 May 2022 18:18:34 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20data=20=3D>=20builder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++ src/database/index.ts | 2 +- .../interactionCreate/components/isCommand.ts | 16 +++++----- src/handlers/commands.ts | 4 +-- src/handlers/deployCommands.ts | 10 +++---- ...etCommandMeta.ts => getCommandMetadata.ts} | 4 +-- src/plugins/counters/index.ts | 10 +++---- src/plugins/counters/modules/view/index.ts | 29 ++++--------------- src/plugins/credits/index.ts | 10 +++---- src/plugins/credits/modules/balance/index.ts | 4 +-- src/plugins/credits/modules/gift/index.ts | 4 +-- src/plugins/credits/modules/top/index.ts | 4 +-- src/plugins/credits/modules/work/index.ts | 4 +-- src/plugins/fun/index.ts | 4 +-- src/plugins/fun/modules/meme.ts | 4 +-- src/plugins/manage/groups/counters/index.ts | 6 ++-- .../groups/counters/modules/add/index.ts | 4 +-- .../groups/counters/modules/remove/index.ts | 4 +-- src/plugins/manage/groups/credits/index.ts | 10 +++---- .../groups/credits/modules/give/index.ts | 4 +-- .../groups/credits/modules/set/index.ts | 4 +-- .../groups/credits/modules/take/index.ts | 4 +-- .../groups/credits/modules/transfer/index.ts | 4 +-- src/plugins/manage/index.ts | 6 ++-- src/plugins/profile/index.ts | 4 +-- src/plugins/profile/modules/view.ts | 4 +-- src/plugins/reputation/index.ts | 4 +-- src/plugins/reputation/modules/give.ts | 4 +-- src/plugins/settings/groups/guild/index.ts | 14 ++++----- .../settings/groups/guild/modules/audits.ts | 4 +-- .../settings/groups/guild/modules/credits.ts | 4 +-- .../settings/groups/guild/modules/points.ts | 4 +-- .../groups/guild/modules/pterodactyl.ts | 4 +-- .../settings/groups/guild/modules/shop.ts | 4 +-- .../settings/groups/guild/modules/welcome.ts | 4 +-- src/plugins/settings/index.ts | 4 +-- src/plugins/shop/groups/roles/index.ts | 6 ++-- src/plugins/shop/groups/roles/modules/buy.ts | 4 +-- .../shop/groups/roles/modules/cancel.ts | 4 +-- src/plugins/shop/index.ts | 6 ++-- src/plugins/shop/modules/pterodactyl.ts | 4 +-- src/plugins/utility/index.ts | 10 +++---- src/plugins/utility/modules/about.ts | 4 +-- src/plugins/utility/modules/avatar.ts | 4 +-- src/plugins/utility/modules/lookup.ts | 4 +-- src/plugins/utility/modules/stats.ts | 4 +-- 46 files changed, 126 insertions(+), 140 deletions(-) rename src/helpers/{getCommandMeta.ts => getCommandMetadata.ts} (83%) diff --git a/package.json b/package.json index 19e6995..438ae9b 100644 --- a/package.json +++ b/package.json @@ -30,14 +30,17 @@ "@crowdin/ota-client": "^0.7.0", "@discordjs/builders": "^0.13.0", "@discordjs/rest": "^0.4.0", + "@types/i18next-fs-backend": "^1.1.2", "axios": "^0.27.0", "chance": "^1.1.8", "common": "^0.2.5", "crypto": "^1.0.1", "discord-api-types": "^0.33.0", "discord.js": "^13.6.0", + "i18n": "^0.14.2", "i18next": "^21.6.13", "i18next-async-backend": "^2.0.0", + "i18next-fs-backend": "^1.1.4", "i18next-http-backend": "^1.4.0", "i18next-resources-to-backend": "^1.0.0", "mongoose": "^6.2.3", diff --git a/src/database/index.ts b/src/database/index.ts index af3b524..b7dd3b6 100644 --- a/src/database/index.ts +++ b/src/database/index.ts @@ -13,7 +13,7 @@ export default async () => { }); mongoose.connection.on("error", async (error) => { - logger.error(error); + logger.error(`${error}`); }); mongoose.connection.on("warn", async (warning) => { diff --git a/src/events/interactionCreate/components/isCommand.ts b/src/events/interactionCreate/components/isCommand.ts index 93902fe..fa6677b 100644 --- a/src/events/interactionCreate/components/isCommand.ts +++ b/src/events/interactionCreate/components/isCommand.ts @@ -6,7 +6,7 @@ import logger from "@logger"; import { errorColor, footerText, footerIcon } from "@config/embed"; import i18next from "i18next"; import deferReply from "@root/helpers/deferReply"; -import getCommandMeta from "@root/helpers/getCommandMeta"; +import getCommandMetadata from "@root/helpers/getCommandMetadata"; export default async (interaction: CommandInteraction) => { if (!interaction.isCommand()) return; @@ -19,14 +19,14 @@ export default async (interaction: CommandInteraction) => { logger.silly(`Command ${commandName} not found`); } - const meta = await getCommandMeta(interaction, currentCommand); + const metadata = await getCommandMetadata(interaction, currentCommand); - await deferReply(interaction, meta.ephemeral || false); + await deferReply(interaction, metadata.ephemeral || false); if ( - meta.permissions && - meta.guildOnly && - !memberPermissions?.has(meta.permissions) + metadata.permissions && + metadata.guildOnly && + !memberPermissions?.has(metadata.permissions) ) { return interaction?.editReply({ embeds: [ @@ -40,7 +40,7 @@ export default async (interaction: CommandInteraction) => { }); } - if (meta.guildOnly) { + if (metadata.guildOnly) { if (!guild) { logger.verbose(`Guild is null`); @@ -61,7 +61,7 @@ export default async (interaction: CommandInteraction) => { } } - if (meta.dmOnly) { + if (metadata.dmOnly) { if (guild) { logger.verbose(`Guild exist`); diff --git a/src/handlers/commands.ts b/src/handlers/commands.ts index f5cfed0..9c109c4 100644 --- a/src/handlers/commands.ts +++ b/src/handlers/commands.ts @@ -16,9 +16,9 @@ export default async (client: Client) => { const plugin = await import(`../plugins/${pluginName}`); await client.commands.set( - plugin.default.data.name, + plugin.default.builder.name, plugin.default, - plugin.default.meta + plugin.default.metadata ); }) ) diff --git a/src/handlers/deployCommands.ts b/src/handlers/deployCommands.ts index d408886..937447a 100644 --- a/src/handlers/deployCommands.ts +++ b/src/handlers/deployCommands.ts @@ -12,9 +12,9 @@ export default async (client: Client) => { await Promise.all( client.commands.map(async (pluginData: any) => { - pluginList.push(pluginData.data.toJSON()); + pluginList.push(pluginData.builder.toJSON()); logger.verbose( - `${pluginData.data.name} successfully pushed to plugin list.` + `${pluginData.builder.name} successfully pushed to plugin list.` ); }) ) @@ -22,7 +22,7 @@ export default async (client: Client) => { logger.debug("Successfully pushed all plugins to plugin list."); }) .catch(async (error) => { - logger.error(error); + logger.error(`${error}`); }); const rest = new REST({ version: "9" }).setToken(token); @@ -35,7 +35,7 @@ export default async (client: Client) => { logger.debug(`Successfully deployed plugins to Discord`); }) .catch(async (error) => { - logger.error(error); + logger.error(`${error}`); }); if (devMode) { @@ -47,7 +47,7 @@ export default async (client: Client) => { logger.debug(`Successfully deployed guild plugins to Discord`) ) .catch(async (error) => { - logger.error(error); + logger.error(`${error}`); }); } }; diff --git a/src/helpers/getCommandMeta.ts b/src/helpers/getCommandMetadata.ts similarity index 83% rename from src/helpers/getCommandMeta.ts rename to src/helpers/getCommandMetadata.ts index cba46e3..c68efec 100644 --- a/src/helpers/getCommandMeta.ts +++ b/src/helpers/getCommandMetadata.ts @@ -5,8 +5,8 @@ export default async (interaction: CommandInteraction, currentCommand: any) => { const subcommandGroup = interaction.options.getSubcommandGroup(false); if (!subcommandGroup) { - return currentCommand.modules[subcommand].meta; + return currentCommand.modules[subcommand].metadata; } - return currentCommand.groups[subcommandGroup].modules[subcommand].meta; + return currentCommand.groups[subcommandGroup].modules[subcommand].metadata; }; diff --git a/src/plugins/counters/index.ts b/src/plugins/counters/index.ts index 1bd7c7b..b0fe5fb 100644 --- a/src/plugins/counters/index.ts +++ b/src/plugins/counters/index.ts @@ -7,20 +7,20 @@ import modules from "@plugins/counters/modules"; export default { modules, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("counters") .setDescription("View guild counters") - .addSubcommand(modules.view.data), + .addSubcommand(modules.view.builder), async execute(interaction: CommandInteraction) { const { options } = interaction; - if (options?.getSubcommand() === "view") { - logger?.verbose(`Executing view subcommand`); + if (options.getSubcommand() === "view") { + logger.verbose(`Executing view subcommand`); return modules.view.execute(interaction); } - logger?.verbose(`Unknown subcommand ${options?.getSubcommand()}`); + logger.verbose(`Unknown subcommand ${options.getSubcommand()}`); }, }; diff --git a/src/plugins/counters/modules/view/index.ts b/src/plugins/counters/modules/view/index.ts index 7f4d1e0..3697aa2 100644 --- a/src/plugins/counters/modules/view/index.ts +++ b/src/plugins/counters/modules/view/index.ts @@ -10,12 +10,11 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; import { ChannelType } from "discord-api-types/v10"; import counterSchema from "@schemas/counter"; -import i18next from "i18next"; export default { - meta: { guildOnly: true, ephemeral: false }, + metadata: { guildOnly: true, ephemeral: false }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("view") .setDescription(`View a guild counter`) @@ -31,17 +30,12 @@ export default { }, execute: async (interaction: CommandInteraction) => { - const { options, guild, locale } = interaction; + const { options, guild } = interaction; const discordChannel = options?.getChannel("channel"); const embed = new MessageEmbed() - .setTitle( - i18next.t("counters:modules:view:general:title", { - lng: locale, - ns: "plugins", - }) - ) + .setTitle("[:1234:] Counters (View)") .setTimestamp(new Date()) .setFooter({ text: footerText, @@ -57,13 +51,7 @@ export default { return interaction?.editReply({ embeds: [ embed - .setDescription( - i18next.t("counters:modules:view:error01:description", { - lng: locale, - ns: "plugins", - channel: discordChannel, - }) - ) + .setDescription(`No counter found for channel ${discordChannel}!`) .setColor(errorColor), ], }); @@ -73,12 +61,7 @@ export default { embeds: [ embed .setDescription( - i18next.t("counters:modules:view:success01:description", { - lng: locale, - ns: "plugins", - channel: discordChannel, - amount: counter.counter, - }) + `Viewing counter for channel ${discordChannel}: ${counter.counter}!` ) .setColor(successColor), ], diff --git a/src/plugins/credits/index.ts b/src/plugins/credits/index.ts index 2ec3c92..ee6e8bd 100644 --- a/src/plugins/credits/index.ts +++ b/src/plugins/credits/index.ts @@ -7,14 +7,14 @@ import modules from "@plugins/credits/modules"; export default { modules, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("credits") .setDescription("Manage your credits.") - .addSubcommand(modules.balance.data) - .addSubcommand(modules.gift.data) - .addSubcommand(modules.top.data) - .addSubcommand(modules.work.data), + .addSubcommand(modules.balance.builder) + .addSubcommand(modules.gift.builder) + .addSubcommand(modules.top.builder) + .addSubcommand(modules.work.builder), async execute(interaction: CommandInteraction) { const { options } = interaction; diff --git a/src/plugins/credits/modules/balance/index.ts b/src/plugins/credits/modules/balance/index.ts index 44ac45a..f0fed23 100644 --- a/src/plugins/credits/modules/balance/index.ts +++ b/src/plugins/credits/modules/balance/index.ts @@ -13,8 +13,8 @@ import logger from "@logger"; import fetchUser from "@helpers/fetchUser"; export default { - meta: { guildOnly: true, ephemeral: true }, - data: (command: SlashCommandSubcommandBuilder) => { + metadata: { guildOnly: true, ephemeral: true }, + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("balance") .setDescription(`View a user's balance`) diff --git a/src/plugins/credits/modules/gift/index.ts b/src/plugins/credits/modules/gift/index.ts index 82b6a28..6e2dbea 100644 --- a/src/plugins/credits/modules/gift/index.ts +++ b/src/plugins/credits/modules/gift/index.ts @@ -22,9 +22,9 @@ import i18next from "i18next"; // Function export default { - meta: { guildOnly: true, ephemeral: true }, + metadata: { guildOnly: true, ephemeral: true }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("gift") .setDescription(`Gift a user credits`) diff --git a/src/plugins/credits/modules/top/index.ts b/src/plugins/credits/modules/top/index.ts index 1656c59..b21eb11 100644 --- a/src/plugins/credits/modules/top/index.ts +++ b/src/plugins/credits/modules/top/index.ts @@ -13,9 +13,9 @@ import logger from "@logger"; import userSchema, { IUser } from "@schemas/user"; export default { - meta: { guildOnly: true, ephemeral: false }, + metadata: { guildOnly: true, ephemeral: false }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command.setName("top").setDescription(`View the top users`); }, execute: async (interaction: CommandInteraction) => { diff --git a/src/plugins/credits/modules/work/index.ts b/src/plugins/credits/modules/work/index.ts index 37d743c..440460a 100644 --- a/src/plugins/credits/modules/work/index.ts +++ b/src/plugins/credits/modules/work/index.ts @@ -23,9 +23,9 @@ import fetchGuild from "@helpers/fetchGuild"; import i18next from "i18next"; export default { - meta: { guildOnly: true, ephemeral: true }, + metadata: { guildOnly: true, ephemeral: true }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command.setName("work").setDescription(`Work to earn credits`); }, execute: async (interaction: CommandInteraction) => { diff --git a/src/plugins/fun/index.ts b/src/plugins/fun/index.ts index 0d727dc..c5c26fd 100644 --- a/src/plugins/fun/index.ts +++ b/src/plugins/fun/index.ts @@ -7,11 +7,11 @@ import modules from "@plugins/fun/modules"; export default { modules, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("fun") .setDescription("Fun commands.") - .addSubcommand(modules.meme.data), + .addSubcommand(modules.meme.builder), async execute(interaction: CommandInteraction) { const { options } = interaction; diff --git a/src/plugins/fun/modules/meme.ts b/src/plugins/fun/modules/meme.ts index 40d5cdb..fb0c3c8 100644 --- a/src/plugins/fun/modules/meme.ts +++ b/src/plugins/fun/modules/meme.ts @@ -6,9 +6,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; import logger from "@logger"; export default { - meta: { guildOnly: false, ephemeral: false }, + metadata: { guildOnly: false, ephemeral: false }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command.setName("meme").setDescription("Get a meme from r/memes)"); }, execute: async (interaction: CommandInteraction) => { diff --git a/src/plugins/manage/groups/counters/index.ts b/src/plugins/manage/groups/counters/index.ts index 2a16b04..6d54522 100644 --- a/src/plugins/manage/groups/counters/index.ts +++ b/src/plugins/manage/groups/counters/index.ts @@ -11,12 +11,12 @@ import modules from "./modules"; export default { modules, - data: (group: SlashCommandSubcommandGroupBuilder) => { + builder: (group: SlashCommandSubcommandGroupBuilder) => { return group .setName("counters") .setDescription("Manage guild counters.") - .addSubcommand(modules.add.data) - .addSubcommand(modules.remove.data); + .addSubcommand(modules.add.builder) + .addSubcommand(modules.remove.builder); }, execute: async (interaction: CommandInteraction) => { diff --git a/src/plugins/manage/groups/counters/modules/add/index.ts b/src/plugins/manage/groups/counters/modules/add/index.ts index 5320937..09e1f56 100644 --- a/src/plugins/manage/groups/counters/modules/add/index.ts +++ b/src/plugins/manage/groups/counters/modules/add/index.ts @@ -20,13 +20,13 @@ import i18next from "i18next"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("add") .setDescription("Add a counter to your guild.") diff --git a/src/plugins/manage/groups/counters/modules/remove/index.ts b/src/plugins/manage/groups/counters/modules/remove/index.ts index b707b45..72f90e8 100644 --- a/src/plugins/manage/groups/counters/modules/remove/index.ts +++ b/src/plugins/manage/groups/counters/modules/remove/index.ts @@ -20,13 +20,13 @@ import i18next from "i18next"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("remove") .setDescription(`Delete a counter from your guild.`) diff --git a/src/plugins/manage/groups/credits/index.ts b/src/plugins/manage/groups/credits/index.ts index fc0839c..c342f7a 100644 --- a/src/plugins/manage/groups/credits/index.ts +++ b/src/plugins/manage/groups/credits/index.ts @@ -7,14 +7,14 @@ import modules from "./modules"; export default { modules, - data: (group: SlashCommandSubcommandGroupBuilder) => { + builder: (group: SlashCommandSubcommandGroupBuilder) => { return group .setName("credits") .setDescription("Manage the credits of a user.") - .addSubcommand(modules.give.data) - .addSubcommand(modules.set.data) - .addSubcommand(modules.take.data) - .addSubcommand(modules.transfer.data); + .addSubcommand(modules.give.builder) + .addSubcommand(modules.set.builder) + .addSubcommand(modules.take.builder) + .addSubcommand(modules.transfer.builder); }, execute: async (interaction: CommandInteraction) => { const { options } = interaction; diff --git a/src/plugins/manage/groups/credits/modules/give/index.ts b/src/plugins/manage/groups/credits/modules/give/index.ts index 38e272c..fd52097 100644 --- a/src/plugins/manage/groups/credits/modules/give/index.ts +++ b/src/plugins/manage/groups/credits/modules/give/index.ts @@ -21,13 +21,13 @@ import fetchUser from "@helpers/fetchUser"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("give") .setDescription("Give credits to a user.") diff --git a/src/plugins/manage/groups/credits/modules/set/index.ts b/src/plugins/manage/groups/credits/modules/set/index.ts index a2b8e18..29bd6ab 100644 --- a/src/plugins/manage/groups/credits/modules/set/index.ts +++ b/src/plugins/manage/groups/credits/modules/set/index.ts @@ -20,13 +20,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("set") .setDescription("Set the amount of credits a user has.") diff --git a/src/plugins/manage/groups/credits/modules/take/index.ts b/src/plugins/manage/groups/credits/modules/take/index.ts index 53b2864..21327b3 100644 --- a/src/plugins/manage/groups/credits/modules/take/index.ts +++ b/src/plugins/manage/groups/credits/modules/take/index.ts @@ -21,13 +21,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("take") .setDescription("Take credits from a user.") diff --git a/src/plugins/manage/groups/credits/modules/transfer/index.ts b/src/plugins/manage/groups/credits/modules/transfer/index.ts index 4423ca5..250c015 100644 --- a/src/plugins/manage/groups/credits/modules/transfer/index.ts +++ b/src/plugins/manage/groups/credits/modules/transfer/index.ts @@ -21,13 +21,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("transfer") .setDescription("Transfer credits from one user to another.") diff --git a/src/plugins/manage/index.ts b/src/plugins/manage/index.ts index 4fb4165..4cd2ff2 100644 --- a/src/plugins/manage/index.ts +++ b/src/plugins/manage/index.ts @@ -10,11 +10,11 @@ import logger from "@logger"; export default { groups, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("manage") .setDescription("Manage the bot.") - .addSubcommandGroup(groups.counters.data) - .addSubcommandGroup(groups.credits.data), + .addSubcommandGroup(groups.counters.builder) + .addSubcommandGroup(groups.credits.builder), async execute(interaction: CommandInteraction) { // Destructure diff --git a/src/plugins/profile/index.ts b/src/plugins/profile/index.ts index 1908543..4766d49 100644 --- a/src/plugins/profile/index.ts +++ b/src/plugins/profile/index.ts @@ -12,10 +12,10 @@ import logger from "@logger"; export default { modules, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("profile") .setDescription("Check a profile.") - .addSubcommand(modules.view.data), + .addSubcommand(modules.view.builder), async execute(interaction: CommandInteraction) { const { options } = interaction; diff --git a/src/plugins/profile/modules/view.ts b/src/plugins/profile/modules/view.ts index 81bfc52..aeb8e62 100644 --- a/src/plugins/profile/modules/view.ts +++ b/src/plugins/profile/modules/view.ts @@ -12,9 +12,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { guildOnly: true, ephemeral: false }, + metadata: { guildOnly: true, ephemeral: false }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("view") .setDescription("View a profile.") diff --git a/src/plugins/reputation/index.ts b/src/plugins/reputation/index.ts index 7fd5218..9ee66d6 100644 --- a/src/plugins/reputation/index.ts +++ b/src/plugins/reputation/index.ts @@ -11,10 +11,10 @@ import logger from "@logger"; // Function export default { modules, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("reputation") .setDescription("Manage reputation.") - .addSubcommand(modules.give.data), + .addSubcommand(modules.give.builder), async execute(interaction: CommandInteraction) { const { options } = interaction; diff --git a/src/plugins/reputation/modules/give.ts b/src/plugins/reputation/modules/give.ts index c3cdf3c..e3d6dff 100644 --- a/src/plugins/reputation/modules/give.ts +++ b/src/plugins/reputation/modules/give.ts @@ -21,9 +21,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { guildOnly: true, ephemeral: true }, + metadata: { guildOnly: true, ephemeral: true }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("give") .setDescription("Give reputation to a user") diff --git a/src/plugins/settings/groups/guild/index.ts b/src/plugins/settings/groups/guild/index.ts index b1344e1..973e678 100644 --- a/src/plugins/settings/groups/guild/index.ts +++ b/src/plugins/settings/groups/guild/index.ts @@ -13,16 +13,16 @@ import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders"; export default { modules, - data: (group: SlashCommandSubcommandGroupBuilder) => { + builder: (group: SlashCommandSubcommandGroupBuilder) => { return group .setName("guild") .setDescription("Guild settings.") - .addSubcommand(modules.pterodactyl.data) - .addSubcommand(modules.credits.data) - .addSubcommand(modules.points.data) - .addSubcommand(modules.welcome.data) - .addSubcommand(modules.audits.data) - .addSubcommand(modules.shop.data); + .addSubcommand(modules.pterodactyl.builder) + .addSubcommand(modules.credits.builder) + .addSubcommand(modules.points.builder) + .addSubcommand(modules.welcome.builder) + .addSubcommand(modules.audits.builder) + .addSubcommand(modules.shop.builder); }, execute: async (interaction: CommandInteraction) => { // Destructure member diff --git a/src/plugins/settings/groups/guild/modules/audits.ts b/src/plugins/settings/groups/guild/modules/audits.ts index c54b4c2..06a325e 100644 --- a/src/plugins/settings/groups/guild/modules/audits.ts +++ b/src/plugins/settings/groups/guild/modules/audits.ts @@ -14,13 +14,13 @@ import { ChannelType } from "discord-api-types/v10"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("audits") .setDescription("Audits") diff --git a/src/plugins/settings/groups/guild/modules/credits.ts b/src/plugins/settings/groups/guild/modules/credits.ts index 11589ab..7c29eda 100644 --- a/src/plugins/settings/groups/guild/modules/credits.ts +++ b/src/plugins/settings/groups/guild/modules/credits.ts @@ -13,13 +13,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("credits") .setDescription(`Credits`) diff --git a/src/plugins/settings/groups/guild/modules/points.ts b/src/plugins/settings/groups/guild/modules/points.ts index 75ea6a7..4379f04 100644 --- a/src/plugins/settings/groups/guild/modules/points.ts +++ b/src/plugins/settings/groups/guild/modules/points.ts @@ -13,13 +13,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("points") .setDescription("Points") diff --git a/src/plugins/settings/groups/guild/modules/pterodactyl.ts b/src/plugins/settings/groups/guild/modules/pterodactyl.ts index b595b80..13345d6 100644 --- a/src/plugins/settings/groups/guild/modules/pterodactyl.ts +++ b/src/plugins/settings/groups/guild/modules/pterodactyl.ts @@ -14,13 +14,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("pterodactyl") .setDescription("Controlpanel.gg") diff --git a/src/plugins/settings/groups/guild/modules/shop.ts b/src/plugins/settings/groups/guild/modules/shop.ts index 785c161..ffa6f4a 100644 --- a/src/plugins/settings/groups/guild/modules/shop.ts +++ b/src/plugins/settings/groups/guild/modules/shop.ts @@ -13,13 +13,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("shop") .setDescription("Shop") diff --git a/src/plugins/settings/groups/guild/modules/welcome.ts b/src/plugins/settings/groups/guild/modules/welcome.ts index ad0c05b..48fdae8 100644 --- a/src/plugins/settings/groups/guild/modules/welcome.ts +++ b/src/plugins/settings/groups/guild/modules/welcome.ts @@ -14,13 +14,13 @@ import { ChannelType } from "discord-api-types/v10"; // Function export default { - meta: { + metadata: { guildOnly: true, ephemeral: true, permissions: [Permissions.FLAGS.MANAGE_GUILD], }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("welcome") .setDescription("Welcome") diff --git a/src/plugins/settings/index.ts b/src/plugins/settings/index.ts index c657e43..c55d10e 100644 --- a/src/plugins/settings/index.ts +++ b/src/plugins/settings/index.ts @@ -12,11 +12,11 @@ import logger from "@logger"; export default { groups, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("settings") .setDescription("Manage settings.") - .addSubcommandGroup(groups.guild.data), + .addSubcommandGroup(groups.guild.builder), async execute(interaction: CommandInteraction) { const { options } = interaction; diff --git a/src/plugins/shop/groups/roles/index.ts b/src/plugins/shop/groups/roles/index.ts index 26135e6..0900764 100644 --- a/src/plugins/shop/groups/roles/index.ts +++ b/src/plugins/shop/groups/roles/index.ts @@ -16,12 +16,12 @@ import guildSchema from "@schemas/guild"; export default { modules, - data: (group: SlashCommandSubcommandGroupBuilder) => { + builder: (group: SlashCommandSubcommandGroupBuilder) => { return group .setName("roles") .setDescription("Shop for custom roles.") - .addSubcommand(modules.buy.data) - .addSubcommand(modules.cancel.data); + .addSubcommand(modules.buy.builder) + .addSubcommand(modules.cancel.builder); }, execute: async (interaction: CommandInteraction) => { const { options, guild } = interaction; diff --git a/src/plugins/shop/groups/roles/modules/buy.ts b/src/plugins/shop/groups/roles/modules/buy.ts index 1f8c54b..ed6a73b 100644 --- a/src/plugins/shop/groups/roles/modules/buy.ts +++ b/src/plugins/shop/groups/roles/modules/buy.ts @@ -25,9 +25,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { guildOnly: true, ephemeral: true }, + metadata: { guildOnly: true, ephemeral: true }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("buy") .setDescription("Buy a custom role.") diff --git a/src/plugins/shop/groups/roles/modules/cancel.ts b/src/plugins/shop/groups/roles/modules/cancel.ts index b35ef16..ee5e705 100644 --- a/src/plugins/shop/groups/roles/modules/cancel.ts +++ b/src/plugins/shop/groups/roles/modules/cancel.ts @@ -20,9 +20,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { guildOnly: true, ephemeral: true }, + metadata: { guildOnly: true, ephemeral: true }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("cancel") .setDescription("Cancel a purchase.") diff --git a/src/plugins/shop/index.ts b/src/plugins/shop/index.ts index f9af6d4..8c46187 100644 --- a/src/plugins/shop/index.ts +++ b/src/plugins/shop/index.ts @@ -16,11 +16,11 @@ export default { modules, groups, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("shop") .setDescription("Shop for credits and custom roles.") - .addSubcommand(modules.pterodactyl.data) - .addSubcommandGroup(groups.roles.data), + .addSubcommand(modules.pterodactyl.builder) + .addSubcommandGroup(groups.roles.builder), async execute(interaction: CommandInteraction) { const { options } = interaction; diff --git a/src/plugins/shop/modules/pterodactyl.ts b/src/plugins/shop/modules/pterodactyl.ts index 6aeed22..3cde4d1 100644 --- a/src/plugins/shop/modules/pterodactyl.ts +++ b/src/plugins/shop/modules/pterodactyl.ts @@ -19,9 +19,9 @@ import fetchUser from "@helpers/fetchUser"; import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; export default { - meta: { guildOnly: true, ephemeral: true }, + metadata: { guildOnly: true, ephemeral: true }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("pterodactyl") .setDescription("Buy pterodactyl power.") diff --git a/src/plugins/utility/index.ts b/src/plugins/utility/index.ts index 69e6268..6dc6fff 100644 --- a/src/plugins/utility/index.ts +++ b/src/plugins/utility/index.ts @@ -12,14 +12,14 @@ import logger from "../../logger"; export default { modules, - data: new SlashCommandBuilder() + builder: new SlashCommandBuilder() .setName("utility") .setDescription("Common utility.") - .addSubcommand(modules.lookup.data) - .addSubcommand(modules.about.data) - .addSubcommand(modules.stats.data) - .addSubcommand(modules.avatar.data), + .addSubcommand(modules.lookup.builder) + .addSubcommand(modules.about.builder) + .addSubcommand(modules.stats.builder) + .addSubcommand(modules.avatar.builder), async execute(interaction: CommandInteraction) { const { options } = interaction; diff --git a/src/plugins/utility/modules/about.ts b/src/plugins/utility/modules/about.ts index cfeb44e..35aa0c0 100644 --- a/src/plugins/utility/modules/about.ts +++ b/src/plugins/utility/modules/about.ts @@ -9,9 +9,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; // Function export default { - meta: { guildOnly: false, ephemeral: false }, + metadata: { guildOnly: false, ephemeral: false }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command.setName("about").setDescription("About this bot!)"); }, execute: async (interaction: CommandInteraction) => { diff --git a/src/plugins/utility/modules/avatar.ts b/src/plugins/utility/modules/avatar.ts index 9f57fb3..86494c1 100644 --- a/src/plugins/utility/modules/avatar.ts +++ b/src/plugins/utility/modules/avatar.ts @@ -5,9 +5,9 @@ import { CommandInteraction, MessageEmbed } from "discord.js"; import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; export default { - meta: { guildOnly: false, ephemeral: false }, + metadata: { guildOnly: false, ephemeral: false }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("avatar") .setDescription("Check someones avatar!)") diff --git a/src/plugins/utility/modules/lookup.ts b/src/plugins/utility/modules/lookup.ts index ac48a4d..c3d2e26 100644 --- a/src/plugins/utility/modules/lookup.ts +++ b/src/plugins/utility/modules/lookup.ts @@ -14,9 +14,9 @@ import logger from "@logger"; import embedBuilder from "@root/helpers/embedBuilder"; export default { - meta: { guildOnly: false, ephemeral: false }, + metadata: { guildOnly: false, ephemeral: false }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command .setName("lookup") .setDescription( diff --git a/src/plugins/utility/modules/stats.ts b/src/plugins/utility/modules/stats.ts index 3b02684..0014915 100644 --- a/src/plugins/utility/modules/stats.ts +++ b/src/plugins/utility/modules/stats.ts @@ -2,9 +2,9 @@ import { successColor, footerText, footerIcon } from "@config/embed"; import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; import { CommandInteraction } from "discord.js"; export default { - meta: { guildOnly: false, ephemeral: false }, + metadata: { guildOnly: false, ephemeral: false }, - data: (command: SlashCommandSubcommandBuilder) => { + builder: (command: SlashCommandSubcommandBuilder) => { return command.setName("stats").setDescription("Check bot statistics!)"); }, execute: async (interaction: CommandInteraction) => {