Skip to content

Commit

Permalink
fix some null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jvnipers committed Jan 6, 2025
1 parent 3671fe4 commit 2b057d8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/logger/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,17 @@ client.on(Events.MessageUpdate, async (oldMessage, newMessage) => {
const settingsData = await settings.findOne({
Guild: newMessage.guild.id,
});
if (settingsData.Messages === false) return;
if (settingsData.Store === false && settingsData.Post === false) return;
if (
(settingsData.Messages && settingsData.Messages === false) ||
(settingsData.Store && settingsData.Store === false) ||
(settingsData.Post && settingsData.Post === false)
)
return;

try {
if (newMessage.partial === true) await newMessage.fetch();
if (oldMessage.partial === true) await oldMessage.fetch();
} catch (error) {
console.log(error);
}
if (newMessage.partial && newMessage.partial === true)
await newMessage.fetch();
if (oldMessage.partial && oldMessage.partial === true)
await oldMessage.fetch();

if (!newMessage.guild) return;
if (oldMessage.webhookId !== null || newMessage.webhookId !== null) return;
Expand Down

0 comments on commit 2b057d8

Please sign in to comment.