Configure whether to receive presences

This commit is contained in:
Cadence Ember
2025-11-19 16:47:35 +13:00
parent 0f24994af9
commit e6c30f80b5
3 changed files with 12 additions and 6 deletions

View File

@@ -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"

View File

@@ -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
}
}
}

2
src/types.d.ts vendored
View File

@@ -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
}
}