🧑💻 Fixed more code smells
This commit is contained in:
parent
6d44db1c2c
commit
8b5dc9d51b
3 changed files with 13 additions and 17 deletions
|
@ -31,15 +31,13 @@ export default {
|
|||
|
||||
await userData
|
||||
.save()
|
||||
.then(async () => {
|
||||
.then(() => {
|
||||
logger.silly(
|
||||
`User ${userId} in guild ${guildId} has ${userData.credits} credits`
|
||||
);
|
||||
})
|
||||
.catch(async (err) => {
|
||||
logger.error(
|
||||
`Error saving credits for user ${userId} in guild ${guildId} - ${err}`
|
||||
);
|
||||
.catch(() => {
|
||||
throw new Error(`Error saving credits to database.`);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -28,16 +28,13 @@ export default {
|
|||
|
||||
await userData
|
||||
.save()
|
||||
.then(async () => {
|
||||
.then(() => {
|
||||
logger.silly(
|
||||
`Successfully saved user ${author.tag} (${author.id}) in guild: ${guild?.name} (${guild?.id})`
|
||||
);
|
||||
})
|
||||
.catch(async (err) => {
|
||||
logger.error(
|
||||
`Error saving points for user ${author.tag} (${author.id}) in guild: ${guild?.name} (${guild?.id})`,
|
||||
err
|
||||
);
|
||||
.catch(() => {
|
||||
throw new Error("Error saving points to database.");
|
||||
});
|
||||
|
||||
logger.silly(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { EmbedBuilder, Message, TextChannel } from "discord.js";
|
||||
import { ChannelType, EmbedBuilder, Message } from "discord.js";
|
||||
import getEmbedConfig from "../../../helpers/getEmbedData";
|
||||
import logger from "../../../middlewares/logger";
|
||||
import guildSchema from "../../../models/guild";
|
||||
|
@ -26,9 +26,10 @@ export default {
|
|||
|
||||
const channel = client.channels.cache.get(`${guildData.audits.channelId}`);
|
||||
|
||||
if (channel === null) return;
|
||||
if (!channel) return;
|
||||
if (channel.type !== ChannelType.GuildText) return;
|
||||
|
||||
(channel as TextChannel)
|
||||
channel
|
||||
.send({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
|
@ -50,13 +51,13 @@ export default {
|
|||
}),
|
||||
],
|
||||
})
|
||||
.then(async () => {
|
||||
.then(() => {
|
||||
logger.info(
|
||||
`Audit log sent for event messageDelete in guild ${message?.guild?.name} (${message?.guild?.id})`
|
||||
);
|
||||
})
|
||||
.catch(async () => {
|
||||
logger.error(
|
||||
.catch(() => {
|
||||
throw new Error(
|
||||
`Audit log failed to send for event messageDelete in guild ${message?.guild?.name} (${message?.guild?.id})`
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue