🧑💻 Fixed some more code smells
This commit is contained in:
parent
586caab107
commit
4c348a6e73
10 changed files with 23 additions and 19 deletions
|
@ -51,11 +51,8 @@ export const execute = async (client: Client, role: IShopRole) => {
|
|||
);
|
||||
});
|
||||
})
|
||||
.catch(async (err) => {
|
||||
throw new Error(
|
||||
`Error removing role ${roleId} from user ${userId}.`,
|
||||
err
|
||||
);
|
||||
.catch(() => {
|
||||
throw new Error(`Failed removing role from user.`);
|
||||
});
|
||||
|
||||
throw new Error("User does not have enough credits.");
|
||||
|
@ -70,16 +67,16 @@ export const execute = async (client: Client, role: IShopRole) => {
|
|||
role.lastPayed = new Date();
|
||||
await role
|
||||
.save()
|
||||
.then(async () => {
|
||||
.then(() => {
|
||||
logger.silly(`Shop role ${roleId} has been updated.`);
|
||||
})
|
||||
.catch(async (err) => {
|
||||
throw new Error(`Error updating shop role ${roleId}.`, err);
|
||||
.catch(() => {
|
||||
throw new Error("Failed updating shop role.");
|
||||
});
|
||||
|
||||
logger.debug(`Shop role ${roleId} has been paid.`);
|
||||
})
|
||||
.catch(async (err) => {
|
||||
throw new Error(`Error updating user ${userId}.`, err);
|
||||
.catch(() => {
|
||||
throw new Error("Failed updating user.");
|
||||
});
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ export const execute = async () => {
|
|||
timeoutId,
|
||||
cooldown,
|
||||
})
|
||||
.then(async () => {
|
||||
.then(() => {
|
||||
logger.debug(
|
||||
`Timeout document ${timeoutId} has been deleted from user ${userId}.`
|
||||
);
|
||||
|
|
|
@ -78,9 +78,10 @@ export default {
|
|||
text: footerText,
|
||||
});
|
||||
|
||||
return interaction.editReply({
|
||||
await interaction.editReply({
|
||||
embeds: [embedSuccess],
|
||||
});
|
||||
return;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -80,9 +80,10 @@ export default {
|
|||
text: footerText,
|
||||
});
|
||||
|
||||
return interaction?.editReply({
|
||||
await interaction?.editReply({
|
||||
embeds: [interactionEmbed],
|
||||
});
|
||||
return;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -126,9 +126,10 @@ export default {
|
|||
text: footerText,
|
||||
});
|
||||
|
||||
return interaction?.editReply({
|
||||
await interaction?.editReply({
|
||||
embeds: [interactionEmbed],
|
||||
});
|
||||
return;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -86,9 +86,10 @@ export default {
|
|||
},
|
||||
]);
|
||||
|
||||
return interaction.editReply({
|
||||
await interaction.editReply({
|
||||
embeds: [embed],
|
||||
});
|
||||
return;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -98,9 +98,10 @@ export default {
|
|||
text: footerText,
|
||||
});
|
||||
|
||||
return interaction?.editReply({
|
||||
await interaction?.editReply({
|
||||
embeds: [interactionEmbed],
|
||||
});
|
||||
return;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -79,9 +79,10 @@ export default {
|
|||
text: footerText,
|
||||
});
|
||||
|
||||
return interaction?.editReply({
|
||||
await interaction?.editReply({
|
||||
embeds: [interactionEmbed],
|
||||
});
|
||||
return;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -171,9 +171,10 @@ export default {
|
|||
text: footerText,
|
||||
});
|
||||
|
||||
return interaction?.editReply({
|
||||
await interaction?.editReply({
|
||||
embeds: [interactionEmbed],
|
||||
});
|
||||
return;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -49,7 +49,7 @@ export default {
|
|||
if (!userObj) throw new Error("User is undefined");
|
||||
|
||||
// Pre-checks
|
||||
await noSelfReputation(optionTarget, user);
|
||||
noSelfReputation(optionTarget, user);
|
||||
|
||||
// Check if user is on cooldown otherwise create one
|
||||
await cooldown.command(interaction, process.env.REPUTATION_TIMEOUT);
|
||||
|
|
Loading…
Add table
Reference in a new issue