From: Matthieu Pignolet Date: Thu, 6 Jun 2024 15:23:36 +0000 (+0400) Subject: handle dm(s) and edits X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=1ef2af2826cb132215dc47a51f765a053a548614;p=matthieu%2Fgru.git handle dm(s) and edits --- diff --git a/discordjs/src/index.mjs b/discordjs/src/index.mjs index 46c22a2..2d2842b 100644 --- a/discordjs/src/index.mjs +++ b/discordjs/src/index.mjs @@ -1,9 +1,9 @@ // Require the necessary discord.js classes -import { Client, GatewayIntentBits, Message } from 'discord.js'; +import { Client, GatewayIntentBits, Message, MessageType } from 'discord.js'; import { request } from "undici"; // Create a new client instance -const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessages] }); +const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessages, GatewayIntentBits.DirectMessages] }); // `autofeur_db` service export const DB = process.env.DB || "http://localhost:3000"; @@ -69,7 +69,7 @@ client.on("messageUpdate", async (message) => { let response = await completeWord(cutWord(message.cleanContent)); // Ignore if there is no completion - if ((response || response === "") && (Math.random() > 0.95 || message.channelId == '1248226018406301696')) { + if ((response || response === "") && (Math.random() > 0.95 || message.channelId == '1248226018406301696' || message.guild == null)) { message.reply(response); } } catch (e) {