From b30e61520061a17759c7d00e1419200b64b7c1c0 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Thu, 13 Aug 2020 00:23:59 +0300 Subject: [PATCH] Use gateway intents, add extraIntents config option --- src/bot.js | 15 +++++++++++++++ src/cfg.js | 3 +++ src/data/cfg.jsdoc.js | 1 + src/data/cfg.schema.json | 5 +++++ 4 files changed, 24 insertions(+) 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": [