🚑 plugins now loading
This commit is contained in:
parent
2d3d7fe7aa
commit
880ad789c9
18 changed files with 267 additions and 331 deletions
|
@ -6,7 +6,7 @@ import { ICommand } from "../interfaces/Command";
|
|||
export default async (client: Client) => {
|
||||
client.commands = new Collection();
|
||||
|
||||
fs.readdir("./src/plugins", async (error, plugins) => {
|
||||
fs.readdir("plugins", async (error, plugins) => {
|
||||
if (error) {
|
||||
return logger.error(`Error reading plugins: ${error}`);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ export default async (
|
|||
const subcommandGroup = interaction.options.getSubcommandGroup(false);
|
||||
|
||||
return subcommandGroup
|
||||
? currentCommand.modules[subcommandGroup].modules[subcommand].metadata
|
||||
: currentCommand.modules[subcommand].metadata;
|
||||
? currentCommand.moduleData[subcommandGroup].moduleData[subcommand].metadata
|
||||
: currentCommand.moduleData[subcommand].metadata;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
|
||||
export interface ICommand {
|
||||
modules: any;
|
||||
builder: SlashCommandBuilder;
|
||||
moduleData: any;
|
||||
execute: Promise<void>;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Client } from "discord.js";
|
|||
import listDir from "../../helpers/listDir";
|
||||
|
||||
export const register = async (client: Client) => {
|
||||
const eventNames = await listDir("src/events");
|
||||
const eventNames = await listDir("events");
|
||||
if (!eventNames) return;
|
||||
|
||||
for await (const eventName of eventNames) {
|
||||
|
|
|
@ -8,57 +8,36 @@ import modules from "./modules";
|
|||
// Handlers
|
||||
import logger from "../../logger";
|
||||
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("config")
|
||||
.setDescription("Manage guild configurations.")
|
||||
|
||||
.addSubcommand(modules.pterodactyl.builder)
|
||||
.addSubcommand(modules.credits.builder)
|
||||
.addSubcommand(modules.points.builder)
|
||||
.addSubcommand(modules.welcome.builder)
|
||||
.addSubcommand(modules.audits.builder)
|
||||
.addSubcommand(modules.shop.builder)
|
||||
.addSubcommand(modules.embeds.builder);
|
||||
|
||||
export const moduleData = modules;
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("config")
|
||||
.setDescription("Manage guild configurations.")
|
||||
|
||||
.addSubcommand(modules.pterodactyl.builder)
|
||||
.addSubcommand(modules.credits.builder)
|
||||
.addSubcommand(modules.points.builder)
|
||||
.addSubcommand(modules.welcome.builder)
|
||||
.addSubcommand(modules.audits.builder)
|
||||
.addSubcommand(modules.shop.builder)
|
||||
.addSubcommand(modules.embeds.builder),
|
||||
|
||||
async execute(interaction: CommandInteraction) {
|
||||
// Destructure member
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options?.getSubcommand()) {
|
||||
case "pterodactyl":
|
||||
logger?.silly(`Subcommand is pterodactyl`);
|
||||
|
||||
return modules.pterodactyl.execute(interaction);
|
||||
case "credits":
|
||||
logger?.silly(`Subcommand is credits`);
|
||||
|
||||
return modules.credits.execute(interaction);
|
||||
case "points":
|
||||
logger?.silly(`Subcommand is points`);
|
||||
|
||||
return modules.points.execute(interaction);
|
||||
case "welcome":
|
||||
logger?.silly(`Subcommand is welcome`);
|
||||
|
||||
return modules.welcome.execute(interaction);
|
||||
case "audits":
|
||||
logger?.silly(`Subcommand is audits`);
|
||||
|
||||
return modules.audits.execute(interaction);
|
||||
case "shop":
|
||||
logger?.silly(`Subcommand is shop`);
|
||||
|
||||
return modules.shop.execute(interaction);
|
||||
case "embeds":
|
||||
logger?.silly(`Subcommand is shop`);
|
||||
|
||||
return modules.embeds.execute(interaction);
|
||||
default:
|
||||
logger?.silly(`Subcommand is not found`);
|
||||
}
|
||||
},
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
switch (interaction.options?.getSubcommand()) {
|
||||
case "pterodactyl":
|
||||
return modules.pterodactyl.execute(interaction);
|
||||
case "credits":
|
||||
return modules.credits.execute(interaction);
|
||||
case "points":
|
||||
return modules.points.execute(interaction);
|
||||
case "welcome":
|
||||
return modules.welcome.execute(interaction);
|
||||
case "audits":
|
||||
return modules.audits.execute(interaction);
|
||||
case "shop":
|
||||
return modules.shop.execute(interaction);
|
||||
case "embeds":
|
||||
return modules.embeds.execute(interaction);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,23 +4,16 @@ import logger from "../../logger";
|
|||
|
||||
import modules from "../../plugins/counters/modules";
|
||||
|
||||
export default {
|
||||
modules,
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("counters")
|
||||
.setDescription("View guild counters")
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("counters")
|
||||
.setDescription("View guild counters")
|
||||
.addSubcommand(modules.view.builder);
|
||||
|
||||
.addSubcommand(modules.view.builder),
|
||||
export const moduleData = modules;
|
||||
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const { options } = interaction;
|
||||
|
||||
if (options.getSubcommand() === "view") {
|
||||
logger.silly(`Executing view subcommand`);
|
||||
return modules.view.execute(interaction);
|
||||
}
|
||||
|
||||
logger.silly(`Unknown subcommand ${options.getSubcommand()}`);
|
||||
},
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
if (interaction.options.getSubcommand() === "view") {
|
||||
await modules.view.execute(interaction);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2,38 +2,36 @@ import { SlashCommandBuilder } from "@discordjs/builders";
|
|||
import { CommandInteraction } from "discord.js";
|
||||
import logger from "../../logger";
|
||||
|
||||
import modules from "../../plugins/credits/modules";
|
||||
import modules from "./modules";
|
||||
|
||||
export default {
|
||||
modules,
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("credits")
|
||||
.setDescription("Manage your credits.")
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("credits")
|
||||
.setDescription("Manage your credits.")
|
||||
.addSubcommand(modules.balance.builder)
|
||||
.addSubcommand(modules.gift.builder)
|
||||
.addSubcommand(modules.top.builder)
|
||||
.addSubcommand(modules.work.builder);
|
||||
|
||||
.addSubcommand(modules.balance.builder)
|
||||
.addSubcommand(modules.gift.builder)
|
||||
.addSubcommand(modules.top.builder)
|
||||
.addSubcommand(modules.work.builder),
|
||||
export const moduleData = modules;
|
||||
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const { options } = interaction;
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options.getSubcommand()) {
|
||||
case "balance":
|
||||
await modules.balance.execute(interaction);
|
||||
break;
|
||||
case "gift":
|
||||
await modules.gift.execute(interaction);
|
||||
break;
|
||||
case "top":
|
||||
await modules.top.execute(interaction);
|
||||
break;
|
||||
case "work":
|
||||
await modules.work.execute(interaction);
|
||||
break;
|
||||
default:
|
||||
logger.silly(`Unknown subcommand ${options.getSubcommand()}`);
|
||||
}
|
||||
},
|
||||
switch (options.getSubcommand()) {
|
||||
case "balance":
|
||||
await modules.balance.execute(interaction);
|
||||
break;
|
||||
case "gift":
|
||||
await modules.gift.execute(interaction);
|
||||
break;
|
||||
case "top":
|
||||
await modules.top.execute(interaction);
|
||||
break;
|
||||
case "work":
|
||||
await modules.work.execute(interaction);
|
||||
break;
|
||||
default:
|
||||
logger.silly(`Unknown subcommand ${options.getSubcommand()}`);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,22 +4,20 @@ import logger from "../../logger";
|
|||
|
||||
import modules from "../../plugins/fun/modules";
|
||||
|
||||
export default {
|
||||
modules,
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("fun")
|
||||
.setDescription("Fun commands.")
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("fun")
|
||||
.setDescription("Fun commands.")
|
||||
.addSubcommand(modules.meme.builder);
|
||||
|
||||
.addSubcommand(modules.meme.builder),
|
||||
export const moduleData = modules;
|
||||
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const { options } = interaction;
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
if (options.getSubcommand() === "meme") {
|
||||
await modules.meme.execute(interaction);
|
||||
} else {
|
||||
logger.silly(`Unknown subcommand ${options.getSubcommand()}`);
|
||||
}
|
||||
},
|
||||
if (options.getSubcommand() === "meme") {
|
||||
await modules.meme.execute(interaction);
|
||||
} else {
|
||||
logger.silly(`Unknown subcommand ${options.getSubcommand()}`);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,32 +6,24 @@ import { CommandInteraction } from "discord.js";
|
|||
import modules from "../../plugins/manage/modules";
|
||||
import logger from "../../logger";
|
||||
|
||||
export const moduleData = modules;
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("manage")
|
||||
.setDescription("Manage the bot.")
|
||||
.addSubcommandGroup(modules.counters.builder)
|
||||
.addSubcommandGroup(modules.credits.builder);
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("manage")
|
||||
.setDescription("Manage the bot.")
|
||||
.addSubcommandGroup(modules.counters.builder)
|
||||
.addSubcommandGroup(modules.credits.builder),
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
// Destructure
|
||||
const { options } = interaction;
|
||||
|
||||
async execute(interaction: CommandInteraction) {
|
||||
// Destructure
|
||||
const { options } = interaction;
|
||||
if (options?.getSubcommandGroup() === "credits") {
|
||||
return modules.credits.execute(interaction);
|
||||
}
|
||||
|
||||
if (options?.getSubcommandGroup() === "credits") {
|
||||
logger?.silly(`Subcommand group is credits`);
|
||||
|
||||
return modules.credits.execute(interaction);
|
||||
}
|
||||
|
||||
if (options?.getSubcommandGroup() === "counters") {
|
||||
logger?.silly(`Subcommand group is counters`);
|
||||
|
||||
return modules.counters.execute(interaction);
|
||||
}
|
||||
|
||||
logger?.silly(`Subcommand group is not credits or counters`);
|
||||
},
|
||||
if (options?.getSubcommandGroup() === "counters") {
|
||||
return modules.counters.execute(interaction);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,32 +8,30 @@ import logger from "../../../../logger";
|
|||
import modules from "./modules";
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
export const moduleData = modules;
|
||||
|
||||
builder: (group: SlashCommandSubcommandGroupBuilder) => {
|
||||
return group
|
||||
.setName("counters")
|
||||
.setDescription("Manage guild counters.")
|
||||
.addSubcommand(modules.add.builder)
|
||||
.addSubcommand(modules.remove.builder);
|
||||
},
|
||||
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
if (options?.getSubcommand() === "add") {
|
||||
logger?.silly(`Executing create subcommand`);
|
||||
|
||||
return modules.add.execute(interaction);
|
||||
}
|
||||
|
||||
if (options?.getSubcommand() === "remove") {
|
||||
logger?.silly(`Executing delete subcommand`);
|
||||
|
||||
return modules.remove.execute(interaction);
|
||||
}
|
||||
|
||||
logger?.silly(`Unknown subcommand ${options?.getSubcommand()}`);
|
||||
},
|
||||
export const builder = (group: SlashCommandSubcommandGroupBuilder) => {
|
||||
return group
|
||||
.setName("counters")
|
||||
.setDescription("Manage guild counters.")
|
||||
.addSubcommand(modules.add.builder)
|
||||
.addSubcommand(modules.remove.builder);
|
||||
};
|
||||
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
if (options?.getSubcommand() === "add") {
|
||||
logger?.silly(`Executing create subcommand`);
|
||||
|
||||
return modules.add.execute(interaction);
|
||||
}
|
||||
|
||||
if (options?.getSubcommand() === "remove") {
|
||||
logger?.silly(`Executing delete subcommand`);
|
||||
|
||||
return modules.remove.execute(interaction);
|
||||
}
|
||||
|
||||
logger?.silly(`Unknown subcommand ${options?.getSubcommand()}`);
|
||||
};
|
||||
|
|
|
@ -4,40 +4,27 @@ import logger from "../../../../logger";
|
|||
|
||||
import modules from "./modules";
|
||||
|
||||
export default {
|
||||
modules,
|
||||
export const moduleData = modules;
|
||||
|
||||
builder: (group: SlashCommandSubcommandGroupBuilder) => {
|
||||
return group
|
||||
.setName("credits")
|
||||
.setDescription("Manage the credits of a user.")
|
||||
.addSubcommand(modules.give.builder)
|
||||
.addSubcommand(modules.set.builder)
|
||||
.addSubcommand(modules.take.builder)
|
||||
.addSubcommand(modules.transfer.builder);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options.getSubcommand()) {
|
||||
case "give":
|
||||
logger.silly(`Executing give subcommand`);
|
||||
|
||||
return modules.give.execute(interaction);
|
||||
case "set":
|
||||
logger.silly(`Executing set subcommand`);
|
||||
|
||||
return modules.set.execute(interaction);
|
||||
case "take":
|
||||
logger.silly(`Executing take subcommand`);
|
||||
|
||||
return modules.take.execute(interaction);
|
||||
case "transfer":
|
||||
logger.silly(`Executing transfer subcommand`);
|
||||
|
||||
return modules.transfer.execute(interaction);
|
||||
default:
|
||||
logger.silly(`Unknown subcommand ${options.getSubcommand()}`);
|
||||
}
|
||||
},
|
||||
export const builder = (group: SlashCommandSubcommandGroupBuilder) => {
|
||||
return group
|
||||
.setName("credits")
|
||||
.setDescription("Manage the credits of a user.")
|
||||
.addSubcommand(modules.give.builder)
|
||||
.addSubcommand(modules.set.builder)
|
||||
.addSubcommand(modules.take.builder)
|
||||
.addSubcommand(modules.transfer.builder);
|
||||
};
|
||||
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
switch (interaction.options.getSubcommand()) {
|
||||
case "give":
|
||||
return modules.give.execute(interaction);
|
||||
case "set":
|
||||
return modules.set.execute(interaction);
|
||||
case "take":
|
||||
return modules.take.execute(interaction);
|
||||
case "transfer":
|
||||
return modules.transfer.execute(interaction);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import counters from "./counters";
|
||||
import credits from "./credits";
|
||||
import * as counters from "./counters";
|
||||
import * as credits from "./credits";
|
||||
|
||||
export default { counters, credits };
|
||||
|
|
|
@ -8,23 +8,22 @@ import modules from "../../plugins/profile/modules";
|
|||
// Handlers
|
||||
import logger from "../../logger";
|
||||
|
||||
export const moduleData = modules;
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("profile")
|
||||
.setDescription("Check a profile.")
|
||||
.addSubcommand(modules.view.builder);
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("profile")
|
||||
.setDescription("Check a profile.")
|
||||
.addSubcommand(modules.view.builder),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const { options } = interaction;
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
if (options?.getSubcommand() === "view") {
|
||||
logger?.silly(`Executing view subcommand`);
|
||||
if (options?.getSubcommand() === "view") {
|
||||
logger?.silly(`Executing view subcommand`);
|
||||
|
||||
return modules.view.execute(interaction);
|
||||
}
|
||||
return modules.view.execute(interaction);
|
||||
}
|
||||
|
||||
logger?.silly(`No subcommand found`);
|
||||
},
|
||||
logger?.silly(`No subcommand found`);
|
||||
};
|
||||
|
|
|
@ -8,22 +8,22 @@ import modules from "./modules";
|
|||
// Handlers
|
||||
import logger from "../../logger";
|
||||
|
||||
export const moduleData = modules;
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("reputation")
|
||||
.setDescription("Manage reputation.")
|
||||
.addSubcommand(modules.give.builder),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const { options } = interaction;
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("reputation")
|
||||
.setDescription("Manage reputation.")
|
||||
.addSubcommand(modules.give.builder);
|
||||
|
||||
if (options?.getSubcommand() === "give") {
|
||||
logger?.silly(`Executing give subcommand`);
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
await modules.give.execute(interaction);
|
||||
}
|
||||
if (options?.getSubcommand() === "give") {
|
||||
logger?.silly(`Executing give subcommand`);
|
||||
|
||||
logger?.silly(`No subcommand found`);
|
||||
},
|
||||
await modules.give.execute(interaction);
|
||||
}
|
||||
|
||||
logger?.silly(`No subcommand found`);
|
||||
};
|
||||
|
|
|
@ -8,30 +8,29 @@ import modules from "./modules";
|
|||
// Handlers
|
||||
import logger from "../../logger";
|
||||
|
||||
export const moduleData = modules;
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("shop")
|
||||
.setDescription("Shop for credits and custom roles.")
|
||||
.addSubcommand(modules.pterodactyl.builder)
|
||||
.addSubcommandGroup(modules.roles.builder);
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("shop")
|
||||
.setDescription("Shop for credits and custom roles.")
|
||||
.addSubcommand(modules.pterodactyl.builder)
|
||||
.addSubcommandGroup(modules.roles.builder),
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const { options } = interaction;
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
if (options?.getSubcommand() === "pterodactyl") {
|
||||
logger.silly(`Executing pterodactyl subcommand`);
|
||||
if (options?.getSubcommand() === "pterodactyl") {
|
||||
logger.silly(`Executing pterodactyl subcommand`);
|
||||
|
||||
return modules.pterodactyl.execute(interaction);
|
||||
}
|
||||
return modules.pterodactyl.execute(interaction);
|
||||
}
|
||||
|
||||
if (options?.getSubcommandGroup() === "roles") {
|
||||
logger?.silly(`Subcommand group is roles`);
|
||||
if (options?.getSubcommandGroup() === "roles") {
|
||||
logger?.silly(`Subcommand group is roles`);
|
||||
|
||||
return modules.roles.execute(interaction);
|
||||
}
|
||||
return modules.roles.execute(interaction);
|
||||
}
|
||||
|
||||
logger?.silly(`No subcommand found.`);
|
||||
},
|
||||
logger?.silly(`No subcommand found.`);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import pterodactyl from "./pterodactyl";
|
||||
import roles from "./roles";
|
||||
import * as roles from "./roles";
|
||||
|
||||
export default { pterodactyl, roles };
|
||||
|
|
|
@ -12,59 +12,54 @@ import modules from "./modules";
|
|||
|
||||
import guildSchema from "../../../../database/schemas/guild";
|
||||
|
||||
export const moduleData = modules;
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
|
||||
builder: (group: SlashCommandSubcommandGroupBuilder) => {
|
||||
return group
|
||||
.setName("roles")
|
||||
.setDescription("Shop for custom roles.")
|
||||
.addSubcommand(modules.buy.builder)
|
||||
.addSubcommand(modules.cancel.builder);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
||||
interaction.guild
|
||||
);
|
||||
const { options, guild } = interaction;
|
||||
|
||||
const guildDB = await guildSchema?.findOne({
|
||||
guildId: guild?.id,
|
||||
});
|
||||
|
||||
if (guildDB === null) return;
|
||||
|
||||
if (!guildDB.shop.roles.status) {
|
||||
logger.silly(`Shop roles disabled.`);
|
||||
|
||||
return interaction?.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: ":dollar: Shop - Roles",
|
||||
description: "This server has disabled shop roles.",
|
||||
color: errorColor,
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
iconURL: footerIcon,
|
||||
text: footerText,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
if (options?.getSubcommand() === "buy") {
|
||||
logger.silly(`Executing buy subcommand`);
|
||||
|
||||
await modules.buy.execute(interaction);
|
||||
}
|
||||
|
||||
if (options?.getSubcommand() === "cancel") {
|
||||
logger.silly(`Executing cancel subcommand`);
|
||||
|
||||
await modules.cancel.execute(interaction);
|
||||
}
|
||||
},
|
||||
export const builder = (group: SlashCommandSubcommandGroupBuilder) => {
|
||||
return group
|
||||
.setName("roles")
|
||||
.setDescription("Shop for custom roles.")
|
||||
.addSubcommand(modules.buy.builder)
|
||||
.addSubcommand(modules.cancel.builder);
|
||||
};
|
||||
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
if (interaction.guild == null) return;
|
||||
const { errorColor, footerText, footerIcon } = await getEmbedConfig(
|
||||
interaction.guild
|
||||
);
|
||||
const { options, guild } = interaction;
|
||||
|
||||
const guildDB = await guildSchema?.findOne({
|
||||
guildId: guild?.id,
|
||||
});
|
||||
|
||||
if (guildDB === null) return;
|
||||
|
||||
if (!guildDB.shop.roles.status) {
|
||||
logger.silly(`Shop roles disabled.`);
|
||||
|
||||
return interaction?.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: ":dollar: Shop - Roles",
|
||||
description: "This server has disabled shop roles.",
|
||||
color: errorColor,
|
||||
timestamp: new Date(),
|
||||
footer: {
|
||||
iconURL: footerIcon,
|
||||
text: footerText,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
if (options?.getSubcommand() === "buy") {
|
||||
await modules.buy.execute(interaction);
|
||||
}
|
||||
|
||||
if (options?.getSubcommand() === "cancel") {
|
||||
await modules.cancel.execute(interaction);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,33 +8,31 @@ import modules from "../../plugins/utility/modules";
|
|||
// Handlers
|
||||
import logger from "../../logger";
|
||||
|
||||
export const moduleData = modules;
|
||||
|
||||
// Function
|
||||
export default {
|
||||
modules,
|
||||
export const builder = new SlashCommandBuilder()
|
||||
.setName("utility")
|
||||
.setDescription("Common utility.")
|
||||
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName("utility")
|
||||
.setDescription("Common utility.")
|
||||
.addSubcommand(modules.lookup.builder)
|
||||
.addSubcommand(modules.about.builder)
|
||||
.addSubcommand(modules.stats.builder)
|
||||
.addSubcommand(modules.avatar.builder);
|
||||
|
||||
.addSubcommand(modules.lookup.builder)
|
||||
.addSubcommand(modules.about.builder)
|
||||
.addSubcommand(modules.stats.builder)
|
||||
.addSubcommand(modules.avatar.builder),
|
||||
export const execute = async (interaction: CommandInteraction) => {
|
||||
const { options } = interaction;
|
||||
|
||||
async execute(interaction: CommandInteraction) {
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options.getSubcommand()) {
|
||||
case "lookup":
|
||||
return modules.lookup.execute(interaction);
|
||||
case "about":
|
||||
return modules.about.execute(interaction);
|
||||
case "stats":
|
||||
return modules.stats.execute(interaction);
|
||||
case "avatar":
|
||||
return modules.avatar.execute(interaction);
|
||||
default:
|
||||
logger.error(`Unknown subcommand ${options.getSubcommand()}`);
|
||||
}
|
||||
},
|
||||
switch (options.getSubcommand()) {
|
||||
case "lookup":
|
||||
return modules.lookup.execute(interaction);
|
||||
case "about":
|
||||
return modules.about.execute(interaction);
|
||||
case "stats":
|
||||
return modules.stats.execute(interaction);
|
||||
case "avatar":
|
||||
return modules.avatar.execute(interaction);
|
||||
default:
|
||||
logger.error(`Unknown subcommand ${options.getSubcommand()}`);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue