commit
a2494b9a4d
3 changed files with 32 additions and 16 deletions
|
@ -1,6 +1,5 @@
|
||||||
import { SlashCommandBuilder } from "@discordjs/builders";
|
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||||
import { ChatInputCommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
|
|
||||||
export const builder = new SlashCommandBuilder()
|
export const builder = new SlashCommandBuilder()
|
||||||
|
@ -20,18 +19,27 @@ export const moduleData = modules;
|
||||||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
switch (interaction.options?.getSubcommand()) {
|
switch (interaction.options?.getSubcommand()) {
|
||||||
case "cpgg":
|
case "cpgg":
|
||||||
return modules.cpgg.execute(interaction);
|
await modules.cpgg.execute(interaction);
|
||||||
|
break;
|
||||||
case "credits":
|
case "credits":
|
||||||
return modules.credits.execute(interaction);
|
await modules.credits.execute(interaction);
|
||||||
|
break;
|
||||||
case "points":
|
case "points":
|
||||||
return modules.points.execute(interaction);
|
await modules.points.execute(interaction);
|
||||||
|
break;
|
||||||
case "welcome":
|
case "welcome":
|
||||||
return modules.welcome.execute(interaction);
|
await modules.welcome.execute(interaction);
|
||||||
|
break;
|
||||||
case "audits":
|
case "audits":
|
||||||
return modules.audits.execute(interaction);
|
await modules.audits.execute(interaction);
|
||||||
|
break;
|
||||||
case "shop":
|
case "shop":
|
||||||
return modules.shop.execute(interaction);
|
await modules.shop.execute(interaction);
|
||||||
|
break;
|
||||||
case "embeds":
|
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 {
|
import {
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
SlashCommandSubcommandBuilder
|
SlashCommandSubcommandBuilder,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
// Configurations
|
// Configurations
|
||||||
|
@ -201,7 +201,9 @@ export default {
|
||||||
await session.abortTransaction();
|
await session.abortTransaction();
|
||||||
session.endSession();
|
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 {
|
} finally {
|
||||||
// ending the session
|
// ending the session
|
||||||
session.endSession();
|
session.endSession();
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
import { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
||||||
import { ChatInputCommandInteraction } from "discord.js";
|
import { ChatInputCommandInteraction } from "discord.js";
|
||||||
|
|
||||||
import modules from "./modules";
|
import modules from "./modules";
|
||||||
|
|
||||||
export const moduleData = modules;
|
export const moduleData = modules;
|
||||||
|
@ -19,14 +18,21 @@ export const builder = (group: SlashCommandSubcommandGroupBuilder) => {
|
||||||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
switch (interaction.options.getSubcommand()) {
|
switch (interaction.options.getSubcommand()) {
|
||||||
case "give":
|
case "give":
|
||||||
return modules.give.execute(interaction);
|
await modules.give.execute(interaction);
|
||||||
|
break;
|
||||||
case "set":
|
case "set":
|
||||||
return modules.set.execute(interaction);
|
await modules.set.execute(interaction);
|
||||||
|
break;
|
||||||
case "take":
|
case "take":
|
||||||
return modules.take.execute(interaction);
|
await modules.take.execute(interaction);
|
||||||
|
break;
|
||||||
case "transfer":
|
case "transfer":
|
||||||
return modules.transfer.execute(interaction);
|
await modules.transfer.execute(interaction);
|
||||||
|
break;
|
||||||
case "giveaway":
|
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