hopefully correct error handling for real

This commit is contained in:
Aster Fialla
2026-02-14 21:02:08 -05:00
committed by pieartsy
parent 623d10a17e
commit 3d36e6c9fc
4 changed files with 143 additions and 120 deletions

40
src/commands.js Normal file
View File

@@ -0,0 +1,40 @@
import {messageHelper} from "./helpers/messageHelper.js";
import {enums} from "./enums.js";
import {memberHelper} from "./helpers/memberHelper.js";
import {EmbedBuilder} from "@fluxerjs/core";
const cmds = new Map();
cmds.set('member', {
description: enums.help.SHORT_DESC_MEMBER,
async execute(message, client, args) {
const authorFull = `${message.author.username}#${message.author.discriminator}`
const reply = await memberHelper.parseMemberCommand(message.author.id, authorFull, args, message.attachments[0] = null).catch(e => throw e);
if (typeof reply === 'string') {
return await message.reply(reply);
}
await message.reply({embeds: [reply.toJSON()]})
}
})
cmds.set('help', {
description: enums.help.SHORT_DESC_HELP,
async execute(message) {
const fields = [...cmds.entries()].map(([name, cmd]) => ({
name: `${messageHelper.prefix}${name}`,
value: cmd.description,
inline: true,
}));
const embed = new EmbedBuilder()
.setTitle('Commands')
.setDescription(enums.help.PLURALFLUX)
.addFields(...fields)
.setFooter({ text: `Prefix: ${messageHelper.prefix}` })
.setTimestamp();
await message.reply({ embeds: [embed.toJSON()] });
},
})
export const commands = cmds;