diff --git a/index.js b/index.js index 96ece9a..fc80385 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ const discordClient = new Discord.Client({ Discord.GatewayIntentBits.GuildPresences, Discord.GatewayIntentBits.GuildMessages, Discord.GatewayIntentBits.GuildMessageReactions, - Discord.GatewayIntentBits.GuildMessageTyping, + //Discord.GatewayIntentBits.GuildMessageTyping, Discord.GatewayIntentBits.DirectMessages, Discord.GatewayIntentBits.DirectMessageReactions, //Discord.GatewayIntentBits.DirectMessageTyping, @@ -242,9 +242,10 @@ discordClient.on("roleDelete", async (eventRole) =>{ }); //A rank is edited -discordClient.on("roleUpdate", async (eventOldRole, eventNewRole) =>{ +//Disabled : sometimes, when a role is created, this event will be triggered multiple times +/*discordClient.on("roleUpdate", async (eventOldRole, eventNewRole) =>{ event_functions.roleUpdate(eventOldRole, eventNewRole, logger, database_pool); -}); +});*/ //An user is banned from the guild discordClient.on("guildBanAdd", async (eventBan) =>{ @@ -279,9 +280,10 @@ discordClient.on("voiceStateUpdate", async (oldState, newState) =>{ });*/ //A guildMember is typing -discordClient.on("typingStart", async (typingState) =>{ +//Disabled : This event is always triggered multiple times when a big message is written +/*discordClient.on("typingStart", async (typingState) =>{ event_functions.typingStart(typingState, logger, database_pool); -}); +});*/ /*############################################*/ /* Starting the bot */ diff --git a/modules/event_functions.js b/modules/event_functions.js index 93570e4..f7be159 100644 --- a/modules/event_functions.js +++ b/modules/event_functions.js @@ -91,7 +91,7 @@ module.exports = { return; } - if(eventNewMessage.channel.type == Discord.ChannelType.DM){return;}//Do nothing if done in PM channel + if(eventNewMessage.channel.type == Discord.ChannelType.DM || eventNewMessage.author.bot || eventOldMessage.content === eventNewMessage.content ){return;}//Do nothing if done in PM channel or author is bot or content wasn't edited const CURRENT_GUILD = eventNewMessage.guild;//We save here the guild we're working on logger.debug("A message was edited in guild "+CURRENT_GUILD.id+", creating a SQL request..."); diff --git a/package-lock.json b/package-lock.json index a3f0b31..6678985 100644 --- a/package-lock.json +++ b/package-lock.json @@ -640,9 +640,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "node_modules/vm2": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.10.tgz", - "integrity": "sha512-AuECTSvwu2OHLAZYhG716YzwodKCIJxB6u1zG7PgSQwIgAlEaoXH52bxdcvT8GkGjnYK7r7yWDW0m0sOsPuBjQ==", + "version": "3.9.11", + "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz", + "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==", "dependencies": { "acorn": "^8.7.0", "acorn-walk": "^8.2.0" @@ -1199,9 +1199,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "vm2": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.10.tgz", - "integrity": "sha512-AuECTSvwu2OHLAZYhG716YzwodKCIJxB6u1zG7PgSQwIgAlEaoXH52bxdcvT8GkGjnYK7r7yWDW0m0sOsPuBjQ==", + "version": "3.9.11", + "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz", + "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==", "requires": { "acorn": "^8.7.0", "acorn-walk": "^8.2.0"