diff --git a/src/d2m/discord-client.js b/src/d2m/discord-client.js index b05d48f..c84b466 100644 --- a/src/d2m/discord-client.js +++ b/src/d2m/discord-client.js @@ -20,17 +20,20 @@ class DiscordClient { * @param {string} listen "full", "half", "no" - whether to set up the event listeners for OOYE to operate */ constructor(discordToken, listen = "full") { + /** @type {import("cloudstorm").IClientOptions["intents"]} */ + const intents = [ + "DIRECT_MESSAGES", "DIRECT_MESSAGE_REACTIONS", "DIRECT_MESSAGE_TYPING", + "GUILDS", "GUILD_EMOJIS_AND_STICKERS", "GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS", "GUILD_MESSAGE_TYPING", "GUILD_WEBHOOKS", + "MESSAGE_CONTENT" + ] + if (reg.ooye.receive_presences !== false) intents.push("GUILD_PRESENCES") this.discordToken = discordToken this.snow = new SnowTransfer(discordToken) this.cloud = new CloudStorm(discordToken, { shards: [0], reconnect: true, snowtransferInstance: this.snow, - intents: [ - "DIRECT_MESSAGES", "DIRECT_MESSAGE_REACTIONS", "DIRECT_MESSAGE_TYPING", - "GUILDS", "GUILD_EMOJIS_AND_STICKERS", "GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS", "GUILD_MESSAGE_TYPING", "GUILD_WEBHOOKS", - "MESSAGE_CONTENT", "GUILD_PRESENCES" - ], + intents, ws: { compress: false, encoding: "json" diff --git a/src/matrix/read-registration.js b/src/matrix/read-registration.js index d126851..9316158 100644 --- a/src/matrix/read-registration.js +++ b/src/matrix/read-registration.js @@ -57,7 +57,8 @@ function getTemplateRegistration(serverName) { max_file_size: 5000000, content_length_workaround: false, include_user_id_in_mxid: false, - invite: [] + invite: [], + receive_presences: true } } } diff --git a/src/types.d.ts b/src/types.d.ts index 7135867..cafd9be 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -32,6 +32,7 @@ export type AppServiceRegistrationConfig = { discord_cdn_origin?: string, web_password: string time_zone?: string + receive_presences: boolean } old_bridge?: { as_token: string @@ -64,6 +65,7 @@ export type InitialAppServiceRegistrationConfig = { content_length_workaround: boolean invite: string[] include_user_id_in_mxid: boolean + receive_presences: boolean } }