refactoring bot and tests to not use then/catch

This commit is contained in:
Aster Fialla
2026-02-24 14:13:48 -05:00
parent 5ba5435d46
commit b4e4e5a951
2 changed files with 60 additions and 84 deletions

View File

@@ -37,10 +37,7 @@ export const handleMessageCreate = async function(message) {
// If message doesn't start with the bot prefix, it could still be a message with a proxy tag. If it's not, return.
if (!content.startsWith(messageHelper.prefix)) {
await webhookHelper.sendMessageAsMember(client, message).catch((e) => {
throw e
});
return;
return await webhookHelper.sendMessageAsMember(client, message);
}
const commandName = content.slice(messageHelper.prefix.length).split(" ")[0];
@@ -57,9 +54,7 @@ export const handleMessageCreate = async function(message) {
}
if (command) {
await command.execute(message, args).catch(e => {
throw e
});
await command.execute(message, args);
}
else {
await message.reply(enums.err.COMMAND_NOT_RECOGNIZED);
@@ -67,7 +62,6 @@ export const handleMessageCreate = async function(message) {
}
catch(error) {
console.error(error);
// return await message.reply(error.message);
}
}
@@ -90,7 +84,6 @@ export const debounceLogin = utils.debounce(client.login, 60000);
(async () => {
try {
await client.login(token);
// await db.check_connection();
} catch (err) {