diff --git a/src/bot.js b/src/bot.js index 0ab965b..82ef37e 100644 --- a/src/bot.js +++ b/src/bot.js @@ -1,8 +1,23 @@ const Eris = require("eris"); const config = require("./cfg"); +const intents = [ + "directMessages", // For core functionality + "guildMessages", // For bot commands and mentions + "guilds", // For core functionality + "guildVoiceStates", // For member information in the thread header + "guildMessageTyping", // For typing indicators + "directMessageTyping", // For typing indicators + + ...config.extraIntents, // Any extra intents added to the config +]; + const bot = new Eris.Client(config.token, { restMode: true, + intents: Array.from(new Set(intents)), }); +/** + * @type {Eris.Client} + */ module.exports = bot; diff --git a/src/cfg.js b/src/cfg.js index dc18bd0..18f7b91 100644 --- a/src/cfg.js +++ b/src/cfg.js @@ -220,4 +220,7 @@ if (! configIsValid) { console.log("Configuration ok!"); process.exit(0); +/** + * @type {ModmailConfig} + */ module.exports = config; diff --git a/src/data/cfg.jsdoc.js b/src/data/cfg.jsdoc.js index e3de128..339b8f8 100644 --- a/src/data/cfg.jsdoc.js +++ b/src/data/cfg.jsdoc.js @@ -50,4 +50,5 @@ * @property {string} [dbDir] * @property {object} [knex] * @property {string} [logDir] + * @property {array} [extraIntents=[]] */ diff --git a/src/data/cfg.schema.json b/src/data/cfg.schema.json index 70c1a70..acf5c33 100644 --- a/src/data/cfg.schema.json +++ b/src/data/cfg.schema.json @@ -262,6 +262,11 @@ "logDir": { "type": "string", "deprecationMessage": "This option is no longer used" + }, + + "extraIntents": { + "$ref": "#/definitions/stringArray", + "default": [] } }, "allOf": [