fixed lack of correct intents

This commit is contained in:
2021-08-23 16:48:02 +02:00
parent 2b5d3fa0b6
commit 3dedfaca25

View File

@@ -3,7 +3,9 @@ const cfg = require('./cfg.json');
const fs = require('fs'); const fs = require('fs');
require('dotenv').config(); require('dotenv').config();
const cl = new Client({ intents: [Intents.FLAGS.GUILDS] }); const cl = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});
cl.cmds = new Collection(); cl.cmds = new Collection();
const cmdsFls = fs const cmdsFls = fs
@@ -15,8 +17,6 @@ for (const Fl of cmdsFls) {
cl.cmds.set(cmd.name, cmd); cl.cmds.set(cmd.name, cmd);
} }
// FIXME: messageCreate is never invoked for some reason, disabling
// literally all of the bot's functionality
cl.on('messageCreate', (msg) => { cl.on('messageCreate', (msg) => {
console.log('a message has been received'); console.log('a message has been received');
if (!msg.content.startsWith(cfg.prefix) || msg.author.bot) return; if (!msg.content.startsWith(cfg.prefix) || msg.author.bot) return;