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