commit
a2494b9a4d
3 changed files with 32 additions and 16 deletions
|
@ -1,6 +1,5 @@
|
|||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
import { ChatInputCommandInteraction } from "discord.js";
|
||||
|
||||
import modules from "./modules";
|
||||
|
||||
export const builder = new SlashCommandBuilder()
|
||||
|
@ -20,18 +19,27 @@ export const moduleData = modules;
|
|||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||
switch (interaction.options?.getSubcommand()) {
|
||||
case "cpgg":
|
||||
return modules.cpgg.execute(interaction);
|
||||
await modules.cpgg.execute(interaction);
|
||||
break;
|
||||
case "credits":
|
||||
return modules.credits.execute(interaction);
|
||||
await modules.credits.execute(interaction);
|
||||
break;
|
||||
case "points":
|
||||
return modules.points.execute(interaction);
|
||||
await modules.points.execute(interaction);
|
||||
break;
|
||||
case "welcome":
|
||||
return modules.welcome.execute(interaction);
|
||||
await modules.welcome.execute(interaction);
|
||||
break;
|
||||
case "audits":
|
||||
return modules.audits.execute(interaction);
|
||||
await modules.audits.execute(interaction);
|
||||
break;
|
||||
case "shop":
|
||||
return modules.shop.execute(interaction);
|
||||
await modules.shop.execute(interaction);
|
||||
break;
|
||||
case "embeds":
|
||||
return modules.embeds.execute(interaction);
|
||||
await modules.embeds.execute(interaction);
|
||||
break;
|
||||
default:
|
||||
throw new Error("No module found for that specific command.");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import {
|
||||
ChatInputCommandInteraction,
|
||||
EmbedBuilder,
|
||||
SlashCommandSubcommandBuilder
|
||||
SlashCommandSubcommandBuilder,
|
||||
} from "discord.js";
|
||||
import mongoose from "mongoose";
|
||||
// Configurations
|
||||
|
@ -201,7 +201,9 @@ export default {
|
|||
await session.abortTransaction();
|
||||
session.endSession();
|
||||
|
||||
thorw new Error("An error occurred while trying to gift credits. Please try again later.")
|
||||
throw new Error(
|
||||
"An error occurred while trying to gift credits. Please try again later."
|
||||
);
|
||||
} finally {
|
||||
// ending the session
|
||||
session.endSession();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
||||
import { ChatInputCommandInteraction } from "discord.js";
|
||||
|
||||
import modules from "./modules";
|
||||
|
||||
export const moduleData = modules;
|
||||
|
@ -19,14 +18,21 @@ export const builder = (group: SlashCommandSubcommandGroupBuilder) => {
|
|||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||
switch (interaction.options.getSubcommand()) {
|
||||
case "give":
|
||||
return modules.give.execute(interaction);
|
||||
await modules.give.execute(interaction);
|
||||
break;
|
||||
case "set":
|
||||
return modules.set.execute(interaction);
|
||||
await modules.set.execute(interaction);
|
||||
break;
|
||||
case "take":
|
||||
return modules.take.execute(interaction);
|
||||
await modules.take.execute(interaction);
|
||||
break;
|
||||
case "transfer":
|
||||
return modules.transfer.execute(interaction);
|
||||
await modules.transfer.execute(interaction);
|
||||
break;
|
||||
case "giveaway":
|
||||
return modules.giveaway.execute(interaction);
|
||||
await modules.giveaway.execute(interaction);
|
||||
break;
|
||||
default:
|
||||
throw new Error("No module found for that specific command");
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue