diff --git a/events/messageCreate.js b/events/messageCreate.js index 3afe899..0a8e42f 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -11,11 +11,11 @@ const Monitors = require('../models/monitor'); const channelTypes = ["GUILD_MESSAGE", "DM", "GUILD_NEWS_THREAD", "GUILD_PRIVATE_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_NEWS", "GROUP_DM", "GUILD_STORE", "GUILD_TEXT"]; module.exports = async (client, message) => { - if (message.author.bot) {return undefined;} - if (message.partial) {await message.fetch();} if (message.channel.partial) {await message.channel.fetch();} + if (!message.author || message.author.bot) {return undefined;} + if (!channelTypes.includes(message.channel.type)) {return undefined;} //if (message.channel.type == "text") {if (settings[message.guild.id]) {prefix = settings[message.guild.id].prefix;};}; diff --git a/events/messageDelete.js b/events/messageDelete.js index 5a146e5..aed19d0 100644 --- a/events/messageDelete.js +++ b/events/messageDelete.js @@ -3,6 +3,10 @@ const Discord = require('discord.js'); const channelTypes = ["GUILD_MESSAGE", "DM", "GUILD_NEWS_THREAD", "GUILD_PRIVATE_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_NEWS", "GROUP_DM", "GUILD_STORE"]; module.exports = async (client, message) => { + if (message.partial) {await message.fetch().catch(() => {});} + if (message.channel.partial) {await message.channel.fetch().catch(() => {});} + if (!message.author) {return;} + if (!channelTypes.includes(message.channel.type)) {return;} if (!message.guild) {return;} //if (!Object.keys(snipe.delete).includes(message.guild.id)) {snipe.delete[message.guild.id] = {};}; diff --git a/events/messageUpdate.js b/events/messageUpdate.js index 38fda2f..98b6e40 100644 --- a/events/messageUpdate.js +++ b/events/messageUpdate.js @@ -3,8 +3,12 @@ const Discord = require('discord.js'); const channelTypes = ["GUILD_MESSAGE", "DM", "GUILD_NEWS_THREAD", "GUILD_PRIVATE_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_NEWS", "GROUP_DM", "GUILD_STORE"]; module.exports = async (client, oldM, newM) => { + if (oldM.partial) {await oldM.fetch().catch(() => {});} + if (newM.partial) {await newM.fetch().catch(() => {});} + if (oldM.channel.partial) {await oldM.channel.fetch().catch(() => {});} + if (!channelTypes.includes(oldM.channel.type)) {return;}; - if (oldM.author.bot) {return;} + if (!oldM.author || oldM.author.bot) {return;} if (oldM.deleted) {return;} //if (!Object.keys(snipe.edit).includes(oldM.guild.id)) {snipe.edit[oldM.guild.id] = {};}; //snipe.edit[oldM.guild.id][oldM.channel.id] = {old: oldM, cur: newM};