diff options
| author | Matthieu Pignolet <matthieu@matthieu-dev.xyz> | 2024-06-06 19:23:36 +0400 | 
|---|---|---|
| committer | Matthieu Pignolet <matthieu@matthieu-dev.xyz> | 2024-06-06 19:23:36 +0400 | 
| commit | 1ef2af2826cb132215dc47a51f765a053a548614 (patch) | |
| tree | da57b2fed657371f4a45ef0317b7be3f2b7a7066 /discordjs | |
| parent | 11ab5f3ad4e754187de2590c0738a798e7f86511 (diff) | |
handle dm(s) and edits
Diffstat (limited to 'discordjs')
| -rw-r--r-- | discordjs/src/index.mjs | 6 | 
1 files changed, 3 insertions, 3 deletions
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) {  | 
