diff options
| author | Matthieu Pignolet <matthieu@matthieu-dev.xyz> | 2024-06-06 18:06:55 +0400 |
|---|---|---|
| committer | Matthieu Pignolet <matthieu@matthieu-dev.xyz> | 2024-06-06 18:06:55 +0400 |
| commit | 11ab5f3ad4e754187de2590c0738a798e7f86511 (patch) | |
| tree | 0178be9787122b541f35b83175a94d189ff897c8 /discordjs/src | |
| parent | ddd0543284dc19a15740153ff26389e6d5e74fab (diff) | |
handle dm(s) and edits
Diffstat (limited to 'discordjs/src')
| -rw-r--r-- | discordjs/src/index.mjs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/discordjs/src/index.mjs b/discordjs/src/index.mjs index b9d43bb..46c22a2 100644 --- a/discordjs/src/index.mjs +++ b/discordjs/src/index.mjs @@ -58,6 +58,23 @@ client.on("messageCreate", async (message) => { } catch (e) { console.log(e); } -}) +}); + +client.on("messageUpdate", async (message) => { + if (message.author.bot) return; + + try { + // Get the completed word found by the db. + + let response = await completeWord(cutWord(message.cleanContent)); + + // Ignore if there is no completion + if ((response || response === "") && (Math.random() > 0.95 || message.channelId == '1248226018406301696')) { + message.reply(response); + } + } catch (e) { + console.log(e); + } +}); client.login(process.env.TOKEN); |
