💡 Add comment to credit modules

This commit is contained in:
Axel Olausson Holtenäs 2022-10-22 16:11:52 +02:00
parent 9abde1c710
commit 364f07dd7c
No known key found for this signature in database
GPG key ID: BEDBB4D61E6C8462
5 changed files with 10 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import { builder as GiftBuilder, execute as GiftExecute } from "./modules/gift";
import { builder as TopBuilder, execute as TopExecute } from "./modules/top"; import { builder as TopBuilder, execute as TopExecute } from "./modules/top";
import { builder as WorkBuilder, execute as WorkExecute } from "./modules/work"; import { builder as WorkBuilder, execute as WorkExecute } from "./modules/work";
// 1. Export a builder function.
export const builder = new SlashCommandBuilder() export const builder = new SlashCommandBuilder()
.setName("credits") .setName("credits")
.setDescription("Manage your credits.") .setDescription("Manage your credits.")
@ -20,7 +21,7 @@ export const builder = new SlashCommandBuilder()
.addSubcommand(TopBuilder) .addSubcommand(TopBuilder)
.addSubcommand(WorkBuilder); .addSubcommand(WorkBuilder);
// Execute function // 2. Export an execute function.
export const execute = async (interaction: ChatInputCommandInteraction) => { export const execute = async (interaction: ChatInputCommandInteraction) => {
switch (interaction.options.getSubcommand()) { switch (interaction.options.getSubcommand()) {
case "balance": case "balance":

View file

@ -5,6 +5,7 @@ import deferReply from "../../../../handlers/deferReply";
import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds"; import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds";
import logger from "../../../../middlewares/logger"; import logger from "../../../../middlewares/logger";
// 1. Export a builder function.
export const builder = (command: SlashCommandSubcommandBuilder) => { export const builder = (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("balance") .setName("balance")
@ -16,6 +17,7 @@ export const builder = (command: SlashCommandSubcommandBuilder) => {
); );
}; };
// 2. Export an execute function.
export const execute = async (interaction: CommandInteraction) => { export const execute = async (interaction: CommandInteraction) => {
// 1. Defer reply as ephemeral. // 1. Defer reply as ephemeral.
await deferReply(interaction, true); await deferReply(interaction, true);

View file

@ -7,6 +7,7 @@ import deferReply from "../../../../handlers/deferReply";
import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds"; import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds";
import transferCredits from "../../../../helpers/transferCredits"; import transferCredits from "../../../../helpers/transferCredits";
// 1. Export a builder function.
export const builder = (command: SlashCommandSubcommandBuilder) => { export const builder = (command: SlashCommandSubcommandBuilder) => {
return command return command
.setName("gift") .setName("gift")
@ -28,6 +29,7 @@ export const builder = (command: SlashCommandSubcommandBuilder) => {
); );
}; };
// 2. Export an execute function.
export const execute = async (interaction: ChatInputCommandInteraction) => { export const execute = async (interaction: ChatInputCommandInteraction) => {
// 1. Defer reply as ephemeral. // 1. Defer reply as ephemeral.
await deferReply(interaction, true); await deferReply(interaction, true);

View file

@ -10,10 +10,12 @@ import deferReply from "../../../../handlers/deferReply";
import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds"; import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds";
import logger from "../../../../middlewares/logger"; import logger from "../../../../middlewares/logger";
// 1. Export a builder function.
export const builder = (command: SlashCommandSubcommandBuilder) => { export const builder = (command: SlashCommandSubcommandBuilder) => {
return command.setName("top").setDescription(`View the top users`); return command.setName("top").setDescription(`View the top users`);
}; };
// 2. Export an execute function.
export const execute = async (interaction: CommandInteraction) => { export const execute = async (interaction: CommandInteraction) => {
// 1. Defer reply as permanent. // 1. Defer reply as permanent.
await deferReply(interaction, false); await deferReply(interaction, false);

View file

@ -8,10 +8,12 @@ import deferReply from "../../../../handlers/deferReply";
import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds"; import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds";
import logger from "../../../../middlewares/logger"; import logger from "../../../../middlewares/logger";
// 1. Export a builder function.
export const builder = (command: SlashCommandSubcommandBuilder) => { export const builder = (command: SlashCommandSubcommandBuilder) => {
return command.setName("work").setDescription(`Work to earn credits`); return command.setName("work").setDescription(`Work to earn credits`);
}; };
// 2. Export an execute function.
export const execute = async (interaction: CommandInteraction) => { export const execute = async (interaction: CommandInteraction) => {
// 1. Defer reply as ephemeral. // 1. Defer reply as ephemeral.
await deferReply(interaction, true); await deferReply(interaction, true);