🎨 data => builder

This commit is contained in:
Axel Olausson Holtenäs 2022-05-18 18:18:34 +02:00
parent 614d7c80f5
commit 7f0835813c
No known key found for this signature in database
GPG key ID: 7BF6826B76382CBA
46 changed files with 126 additions and 140 deletions

View file

@ -30,14 +30,17 @@
"@crowdin/ota-client": "^0.7.0", "@crowdin/ota-client": "^0.7.0",
"@discordjs/builders": "^0.13.0", "@discordjs/builders": "^0.13.0",
"@discordjs/rest": "^0.4.0", "@discordjs/rest": "^0.4.0",
"@types/i18next-fs-backend": "^1.1.2",
"axios": "^0.27.0", "axios": "^0.27.0",
"chance": "^1.1.8", "chance": "^1.1.8",
"common": "^0.2.5", "common": "^0.2.5",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"discord-api-types": "^0.33.0", "discord-api-types": "^0.33.0",
"discord.js": "^13.6.0", "discord.js": "^13.6.0",
"i18n": "^0.14.2",
"i18next": "^21.6.13", "i18next": "^21.6.13",
"i18next-async-backend": "^2.0.0", "i18next-async-backend": "^2.0.0",
"i18next-fs-backend": "^1.1.4",
"i18next-http-backend": "^1.4.0", "i18next-http-backend": "^1.4.0",
"i18next-resources-to-backend": "^1.0.0", "i18next-resources-to-backend": "^1.0.0",
"mongoose": "^6.2.3", "mongoose": "^6.2.3",

View file

@ -13,7 +13,7 @@ export default async () => {
}); });
mongoose.connection.on("error", async (error) => { mongoose.connection.on("error", async (error) => {
logger.error(error); logger.error(`${error}`);
}); });
mongoose.connection.on("warn", async (warning) => { mongoose.connection.on("warn", async (warning) => {

View file

@ -6,7 +6,7 @@ import logger from "@logger";
import { errorColor, footerText, footerIcon } from "@config/embed"; import { errorColor, footerText, footerIcon } from "@config/embed";
import i18next from "i18next"; import i18next from "i18next";
import deferReply from "@root/helpers/deferReply"; import deferReply from "@root/helpers/deferReply";
import getCommandMeta from "@root/helpers/getCommandMeta"; import getCommandMetadata from "@root/helpers/getCommandMetadata";
export default async (interaction: CommandInteraction) => { export default async (interaction: CommandInteraction) => {
if (!interaction.isCommand()) return; if (!interaction.isCommand()) return;
@ -19,14 +19,14 @@ export default async (interaction: CommandInteraction) => {
logger.silly(`Command ${commandName} not found`); 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 ( if (
meta.permissions && metadata.permissions &&
meta.guildOnly && metadata.guildOnly &&
!memberPermissions?.has(meta.permissions) !memberPermissions?.has(metadata.permissions)
) { ) {
return interaction?.editReply({ return interaction?.editReply({
embeds: [ embeds: [
@ -40,7 +40,7 @@ export default async (interaction: CommandInteraction) => {
}); });
} }
if (meta.guildOnly) { if (metadata.guildOnly) {
if (!guild) { if (!guild) {
logger.verbose(`Guild is null`); logger.verbose(`Guild is null`);
@ -61,7 +61,7 @@ export default async (interaction: CommandInteraction) => {
} }
} }
if (meta.dmOnly) { if (metadata.dmOnly) {
if (guild) { if (guild) {
logger.verbose(`Guild exist`); logger.verbose(`Guild exist`);

View file

@ -16,9 +16,9 @@ export default async (client: Client) => {
const plugin = await import(`../plugins/${pluginName}`); const plugin = await import(`../plugins/${pluginName}`);
await client.commands.set( await client.commands.set(
plugin.default.data.name, plugin.default.builder.name,
plugin.default, plugin.default,
plugin.default.meta plugin.default.metadata
); );
}) })
) )

View file

@ -12,9 +12,9 @@ export default async (client: Client) => {
await Promise.all( await Promise.all(
client.commands.map(async (pluginData: any) => { client.commands.map(async (pluginData: any) => {
pluginList.push(pluginData.data.toJSON()); pluginList.push(pluginData.builder.toJSON());
logger.verbose( 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."); logger.debug("Successfully pushed all plugins to plugin list.");
}) })
.catch(async (error) => { .catch(async (error) => {
logger.error(error); logger.error(`${error}`);
}); });
const rest = new REST({ version: "9" }).setToken(token); const rest = new REST({ version: "9" }).setToken(token);
@ -35,7 +35,7 @@ export default async (client: Client) => {
logger.debug(`Successfully deployed plugins to Discord`); logger.debug(`Successfully deployed plugins to Discord`);
}) })
.catch(async (error) => { .catch(async (error) => {
logger.error(error); logger.error(`${error}`);
}); });
if (devMode) { if (devMode) {
@ -47,7 +47,7 @@ export default async (client: Client) => {
logger.debug(`Successfully deployed guild plugins to Discord`) logger.debug(`Successfully deployed guild plugins to Discord`)
) )
.catch(async (error) => { .catch(async (error) => {
logger.error(error); logger.error(`${error}`);
}); });
} }
}; };

View file

@ -5,8 +5,8 @@ export default async (interaction: CommandInteraction, currentCommand: any) => {
const subcommandGroup = interaction.options.getSubcommandGroup(false); const subcommandGroup = interaction.options.getSubcommandGroup(false);
if (!subcommandGroup) { 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;
}; };

View file

@ -7,20 +7,20 @@ import modules from "@plugins/counters/modules";
export default { export default {
modules, modules,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("counters") .setName("counters")
.setDescription("View guild counters") .setDescription("View guild counters")
.addSubcommand(modules.view.data), .addSubcommand(modules.view.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
const { options } = interaction; const { options } = interaction;
if (options?.getSubcommand() === "view") { if (options.getSubcommand() === "view") {
logger?.verbose(`Executing view subcommand`); logger.verbose(`Executing view subcommand`);
return modules.view.execute(interaction); return modules.view.execute(interaction);
} }
logger?.verbose(`Unknown subcommand ${options?.getSubcommand()}`); logger.verbose(`Unknown subcommand ${options.getSubcommand()}`);
}, },
}; };

View file

@ -10,12 +10,11 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { ChannelType } from "discord-api-types/v10"; import { ChannelType } from "discord-api-types/v10";
import counterSchema from "@schemas/counter"; import counterSchema from "@schemas/counter";
import i18next from "i18next";
export default { export default {
meta: { guildOnly: true, ephemeral: false }, metadata: { guildOnly: true, ephemeral: false },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("view") .setName("view")
.setDescription(`View a guild counter`) .setDescription(`View a guild counter`)
@ -31,17 +30,12 @@ export default {
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {
const { options, guild, locale } = interaction; const { options, guild } = interaction;
const discordChannel = options?.getChannel("channel"); const discordChannel = options?.getChannel("channel");
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setTitle( .setTitle("[:1234:] Counters (View)")
i18next.t("counters:modules:view:general:title", {
lng: locale,
ns: "plugins",
})
)
.setTimestamp(new Date()) .setTimestamp(new Date())
.setFooter({ .setFooter({
text: footerText, text: footerText,
@ -57,13 +51,7 @@ export default {
return interaction?.editReply({ return interaction?.editReply({
embeds: [ embeds: [
embed embed
.setDescription( .setDescription(`No counter found for channel ${discordChannel}!`)
i18next.t("counters:modules:view:error01:description", {
lng: locale,
ns: "plugins",
channel: discordChannel,
})
)
.setColor(errorColor), .setColor(errorColor),
], ],
}); });
@ -73,12 +61,7 @@ export default {
embeds: [ embeds: [
embed embed
.setDescription( .setDescription(
i18next.t("counters:modules:view:success01:description", { `Viewing counter for channel ${discordChannel}: ${counter.counter}!`
lng: locale,
ns: "plugins",
channel: discordChannel,
amount: counter.counter,
})
) )
.setColor(successColor), .setColor(successColor),
], ],

View file

@ -7,14 +7,14 @@ import modules from "@plugins/credits/modules";
export default { export default {
modules, modules,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("credits") .setName("credits")
.setDescription("Manage your credits.") .setDescription("Manage your credits.")
.addSubcommand(modules.balance.data) .addSubcommand(modules.balance.builder)
.addSubcommand(modules.gift.data) .addSubcommand(modules.gift.builder)
.addSubcommand(modules.top.data) .addSubcommand(modules.top.builder)
.addSubcommand(modules.work.data), .addSubcommand(modules.work.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
const { options } = interaction; const { options } = interaction;

View file

@ -13,8 +13,8 @@ import logger from "@logger";
import fetchUser from "@helpers/fetchUser"; import fetchUser from "@helpers/fetchUser";
export default { export default {
meta: { guildOnly: true, ephemeral: true }, metadata: { guildOnly: true, ephemeral: true },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("balance") .setName("balance")
.setDescription(`View a user's balance`) .setDescription(`View a user's balance`)

View file

@ -22,9 +22,9 @@ import i18next from "i18next";
// Function // Function
export default { export default {
meta: { guildOnly: true, ephemeral: true }, metadata: { guildOnly: true, ephemeral: true },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("gift") .setName("gift")
.setDescription(`Gift a user credits`) .setDescription(`Gift a user credits`)

View file

@ -13,9 +13,9 @@ import logger from "@logger";
import userSchema, { IUser } from "@schemas/user"; import userSchema, { IUser } from "@schemas/user";
export default { 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`); return command.setName("top").setDescription(`View the top users`);
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {

View file

@ -23,9 +23,9 @@ import fetchGuild from "@helpers/fetchGuild";
import i18next from "i18next"; import i18next from "i18next";
export default { 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`); return command.setName("work").setDescription(`Work to earn credits`);
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {

View file

@ -7,11 +7,11 @@ import modules from "@plugins/fun/modules";
export default { export default {
modules, modules,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("fun") .setName("fun")
.setDescription("Fun commands.") .setDescription("Fun commands.")
.addSubcommand(modules.meme.data), .addSubcommand(modules.meme.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
const { options } = interaction; const { options } = interaction;

View file

@ -6,9 +6,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import logger from "@logger"; import logger from "@logger";
export default { 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)"); return command.setName("meme").setDescription("Get a meme from r/memes)");
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {

View file

@ -11,12 +11,12 @@ import modules from "./modules";
export default { export default {
modules, modules,
data: (group: SlashCommandSubcommandGroupBuilder) => { builder: (group: SlashCommandSubcommandGroupBuilder) => {
return group return group
.setName("counters") .setName("counters")
.setDescription("Manage guild counters.") .setDescription("Manage guild counters.")
.addSubcommand(modules.add.data) .addSubcommand(modules.add.builder)
.addSubcommand(modules.remove.data); .addSubcommand(modules.remove.builder);
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {

View file

@ -20,13 +20,13 @@ import i18next from "i18next";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("add") .setName("add")
.setDescription("Add a counter to your guild.") .setDescription("Add a counter to your guild.")

View file

@ -20,13 +20,13 @@ import i18next from "i18next";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("remove") .setName("remove")
.setDescription(`Delete a counter from your guild.`) .setDescription(`Delete a counter from your guild.`)

View file

@ -7,14 +7,14 @@ import modules from "./modules";
export default { export default {
modules, modules,
data: (group: SlashCommandSubcommandGroupBuilder) => { builder: (group: SlashCommandSubcommandGroupBuilder) => {
return group return group
.setName("credits") .setName("credits")
.setDescription("Manage the credits of a user.") .setDescription("Manage the credits of a user.")
.addSubcommand(modules.give.data) .addSubcommand(modules.give.builder)
.addSubcommand(modules.set.data) .addSubcommand(modules.set.builder)
.addSubcommand(modules.take.data) .addSubcommand(modules.take.builder)
.addSubcommand(modules.transfer.data); .addSubcommand(modules.transfer.builder);
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {
const { options } = interaction; const { options } = interaction;

View file

@ -21,13 +21,13 @@ import fetchUser from "@helpers/fetchUser";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("give") .setName("give")
.setDescription("Give credits to a user.") .setDescription("Give credits to a user.")

View file

@ -20,13 +20,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("set") .setName("set")
.setDescription("Set the amount of credits a user has.") .setDescription("Set the amount of credits a user has.")

View file

@ -21,13 +21,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("take") .setName("take")
.setDescription("Take credits from a user.") .setDescription("Take credits from a user.")

View file

@ -21,13 +21,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("transfer") .setName("transfer")
.setDescription("Transfer credits from one user to another.") .setDescription("Transfer credits from one user to another.")

View file

@ -10,11 +10,11 @@ import logger from "@logger";
export default { export default {
groups, groups,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("manage") .setName("manage")
.setDescription("Manage the bot.") .setDescription("Manage the bot.")
.addSubcommandGroup(groups.counters.data) .addSubcommandGroup(groups.counters.builder)
.addSubcommandGroup(groups.credits.data), .addSubcommandGroup(groups.credits.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
// Destructure // Destructure

View file

@ -12,10 +12,10 @@ import logger from "@logger";
export default { export default {
modules, modules,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("profile") .setName("profile")
.setDescription("Check a profile.") .setDescription("Check a profile.")
.addSubcommand(modules.view.data), .addSubcommand(modules.view.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
const { options } = interaction; const { options } = interaction;

View file

@ -12,9 +12,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { guildOnly: true, ephemeral: false }, metadata: { guildOnly: true, ephemeral: false },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("view") .setName("view")
.setDescription("View a profile.") .setDescription("View a profile.")

View file

@ -11,10 +11,10 @@ import logger from "@logger";
// Function // Function
export default { export default {
modules, modules,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("reputation") .setName("reputation")
.setDescription("Manage reputation.") .setDescription("Manage reputation.")
.addSubcommand(modules.give.data), .addSubcommand(modules.give.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
const { options } = interaction; const { options } = interaction;

View file

@ -21,9 +21,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { guildOnly: true, ephemeral: true }, metadata: { guildOnly: true, ephemeral: true },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("give") .setName("give")
.setDescription("Give reputation to a user") .setDescription("Give reputation to a user")

View file

@ -13,16 +13,16 @@ import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
export default { export default {
modules, modules,
data: (group: SlashCommandSubcommandGroupBuilder) => { builder: (group: SlashCommandSubcommandGroupBuilder) => {
return group return group
.setName("guild") .setName("guild")
.setDescription("Guild settings.") .setDescription("Guild settings.")
.addSubcommand(modules.pterodactyl.data) .addSubcommand(modules.pterodactyl.builder)
.addSubcommand(modules.credits.data) .addSubcommand(modules.credits.builder)
.addSubcommand(modules.points.data) .addSubcommand(modules.points.builder)
.addSubcommand(modules.welcome.data) .addSubcommand(modules.welcome.builder)
.addSubcommand(modules.audits.data) .addSubcommand(modules.audits.builder)
.addSubcommand(modules.shop.data); .addSubcommand(modules.shop.builder);
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {
// Destructure member // Destructure member

View file

@ -14,13 +14,13 @@ import { ChannelType } from "discord-api-types/v10";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("audits") .setName("audits")
.setDescription("Audits") .setDescription("Audits")

View file

@ -13,13 +13,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("credits") .setName("credits")
.setDescription(`Credits`) .setDescription(`Credits`)

View file

@ -13,13 +13,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("points") .setName("points")
.setDescription("Points") .setDescription("Points")

View file

@ -14,13 +14,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("pterodactyl") .setName("pterodactyl")
.setDescription("Controlpanel.gg") .setDescription("Controlpanel.gg")

View file

@ -13,13 +13,13 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("shop") .setName("shop")
.setDescription("Shop") .setDescription("Shop")

View file

@ -14,13 +14,13 @@ import { ChannelType } from "discord-api-types/v10";
// Function // Function
export default { export default {
meta: { metadata: {
guildOnly: true, guildOnly: true,
ephemeral: true, ephemeral: true,
permissions: [Permissions.FLAGS.MANAGE_GUILD], permissions: [Permissions.FLAGS.MANAGE_GUILD],
}, },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("welcome") .setName("welcome")
.setDescription("Welcome") .setDescription("Welcome")

View file

@ -12,11 +12,11 @@ import logger from "@logger";
export default { export default {
groups, groups,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("settings") .setName("settings")
.setDescription("Manage settings.") .setDescription("Manage settings.")
.addSubcommandGroup(groups.guild.data), .addSubcommandGroup(groups.guild.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
const { options } = interaction; const { options } = interaction;

View file

@ -16,12 +16,12 @@ import guildSchema from "@schemas/guild";
export default { export default {
modules, modules,
data: (group: SlashCommandSubcommandGroupBuilder) => { builder: (group: SlashCommandSubcommandGroupBuilder) => {
return group return group
.setName("roles") .setName("roles")
.setDescription("Shop for custom roles.") .setDescription("Shop for custom roles.")
.addSubcommand(modules.buy.data) .addSubcommand(modules.buy.builder)
.addSubcommand(modules.cancel.data); .addSubcommand(modules.cancel.builder);
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {
const { options, guild } = interaction; const { options, guild } = interaction;

View file

@ -25,9 +25,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { guildOnly: true, ephemeral: true }, metadata: { guildOnly: true, ephemeral: true },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("buy") .setName("buy")
.setDescription("Buy a custom role.") .setDescription("Buy a custom role.")

View file

@ -20,9 +20,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { export default {
meta: { guildOnly: true, ephemeral: true }, metadata: { guildOnly: true, ephemeral: true },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("cancel") .setName("cancel")
.setDescription("Cancel a purchase.") .setDescription("Cancel a purchase.")

View file

@ -16,11 +16,11 @@ export default {
modules, modules,
groups, groups,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("shop") .setName("shop")
.setDescription("Shop for credits and custom roles.") .setDescription("Shop for credits and custom roles.")
.addSubcommand(modules.pterodactyl.data) .addSubcommand(modules.pterodactyl.builder)
.addSubcommandGroup(groups.roles.data), .addSubcommandGroup(groups.roles.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
const { options } = interaction; const { options } = interaction;

View file

@ -19,9 +19,9 @@ import fetchUser from "@helpers/fetchUser";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
export default { export default {
meta: { guildOnly: true, ephemeral: true }, metadata: { guildOnly: true, ephemeral: true },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("pterodactyl") .setName("pterodactyl")
.setDescription("Buy pterodactyl power.") .setDescription("Buy pterodactyl power.")

View file

@ -12,14 +12,14 @@ import logger from "../../logger";
export default { export default {
modules, modules,
data: new SlashCommandBuilder() builder: new SlashCommandBuilder()
.setName("utility") .setName("utility")
.setDescription("Common utility.") .setDescription("Common utility.")
.addSubcommand(modules.lookup.data) .addSubcommand(modules.lookup.builder)
.addSubcommand(modules.about.data) .addSubcommand(modules.about.builder)
.addSubcommand(modules.stats.data) .addSubcommand(modules.stats.builder)
.addSubcommand(modules.avatar.data), .addSubcommand(modules.avatar.builder),
async execute(interaction: CommandInteraction) { async execute(interaction: CommandInteraction) {
const { options } = interaction; const { options } = interaction;

View file

@ -9,9 +9,9 @@ import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
// Function // Function
export default { 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!)"); return command.setName("about").setDescription("About this bot!)");
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {

View file

@ -5,9 +5,9 @@ import { CommandInteraction, MessageEmbed } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
export default { export default {
meta: { guildOnly: false, ephemeral: false }, metadata: { guildOnly: false, ephemeral: false },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("avatar") .setName("avatar")
.setDescription("Check someones avatar!)") .setDescription("Check someones avatar!)")

View file

@ -14,9 +14,9 @@ import logger from "@logger";
import embedBuilder from "@root/helpers/embedBuilder"; import embedBuilder from "@root/helpers/embedBuilder";
export default { export default {
meta: { guildOnly: false, ephemeral: false }, metadata: { guildOnly: false, ephemeral: false },
data: (command: SlashCommandSubcommandBuilder) => { builder: (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("lookup") .setName("lookup")
.setDescription( .setDescription(

View file

@ -2,9 +2,9 @@ import { successColor, footerText, footerIcon } from "@config/embed";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { CommandInteraction } from "discord.js"; import { CommandInteraction } from "discord.js";
export default { 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!)"); return command.setName("stats").setDescription("Check bot statistics!)");
}, },
execute: async (interaction: CommandInteraction) => { execute: async (interaction: CommandInteraction) => {