🧑💻 Fixed some code smells
This commit is contained in:
parent
764c3cff55
commit
ab42b4f91b
5 changed files with 6 additions and 29 deletions
|
@ -23,10 +23,6 @@ export const register = async (client: Client) => {
|
|||
throw new Error(
|
||||
`📦 No command builder found while importing "${commandName}"`
|
||||
);
|
||||
if (!command.execute)
|
||||
throw new Error(
|
||||
`📦 No command execute found while importing "${commandName}"`
|
||||
);
|
||||
if (!command.moduleData)
|
||||
throw new Error(
|
||||
`📦 No command moduleData found while importing "${commandName}"`
|
||||
|
|
|
@ -44,6 +44,8 @@ export const register = async (client: Client) => {
|
|||
case "on":
|
||||
client.on(eventName, eventExecutor);
|
||||
break;
|
||||
default:
|
||||
logger.error(`${eventName} does not have a valid type`);
|
||||
}
|
||||
importedEventAmount += 1;
|
||||
};
|
||||
|
|
|
@ -46,13 +46,6 @@ export default {
|
|||
channelId: discordChannel.id,
|
||||
});
|
||||
|
||||
const counters = await counterSchema.find();
|
||||
|
||||
console.log(counters, {
|
||||
guildId: guild.id,
|
||||
channelId: discordChannel.id,
|
||||
});
|
||||
|
||||
if (!counter) throw new Error("No counter found for channel");
|
||||
|
||||
return interaction.editReply({
|
||||
|
|
|
@ -207,24 +207,13 @@ export default {
|
|||
await toUser.save();
|
||||
|
||||
await session.commitTransaction();
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
await session.abortTransaction();
|
||||
session.endSession();
|
||||
logger.error(`${error}`);
|
||||
|
||||
return interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
||||
.setDescription(
|
||||
"An error occurred while trying to gift credits. Please try again."
|
||||
)
|
||||
.setColor(errorColor)
|
||||
.setTimestamp(new Date())
|
||||
.setColor(successColor)
|
||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
||||
],
|
||||
});
|
||||
throw new Error(
|
||||
"An error occurred while trying to gift credits. Please try again later."
|
||||
);
|
||||
} finally {
|
||||
// ending the session
|
||||
session.endSession();
|
||||
|
|
|
@ -79,9 +79,6 @@ export default {
|
|||
return interaction?.editReply({
|
||||
embeds: [interactionEmbed],
|
||||
});
|
||||
})
|
||||
.catch(async (error: Error) => {
|
||||
return logger?.silly(`Role could not be deleted. ${error}`);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue