Use gateway intents, add extraIntents config option

cshd
Dragory 2020-08-13 00:23:59 +03:00
parent 2beadbe924
commit b30e615200
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
4 changed files with 24 additions and 0 deletions

View File

@ -1,8 +1,23 @@
const Eris = require("eris"); const Eris = require("eris");
const config = require("./cfg"); 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, { const bot = new Eris.Client(config.token, {
restMode: true, restMode: true,
intents: Array.from(new Set(intents)),
}); });
/**
* @type {Eris.Client}
*/
module.exports = bot; module.exports = bot;

View File

@ -220,4 +220,7 @@ if (! configIsValid) {
console.log("Configuration ok!"); console.log("Configuration ok!");
process.exit(0); process.exit(0);
/**
* @type {ModmailConfig}
*/
module.exports = config; module.exports = config;

View File

@ -50,4 +50,5 @@
* @property {string} [dbDir] * @property {string} [dbDir]
* @property {object} [knex] * @property {object} [knex]
* @property {string} [logDir] * @property {string} [logDir]
* @property {array} [extraIntents=[]]
*/ */

View File

@ -262,6 +262,11 @@
"logDir": { "logDir": {
"type": "string", "type": "string",
"deprecationMessage": "This option is no longer used" "deprecationMessage": "This option is no longer used"
},
"extraIntents": {
"$ref": "#/definitions/stringArray",
"default": []
} }
}, },
"allOf": [ "allOf": [