From b060451bafd620a581b6135a10af5167610a7e4e Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Tue, 16 Jan 2024 16:00:33 +1300 Subject: [PATCH] Minor documentation rewording --- d2m/actions/create-space.js | 8 ++++---- d2m/converters/message-to-event.js | 2 +- readme.md | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/d2m/actions/create-space.js b/d2m/actions/create-space.js index 0439496..4e30bcd 100644 --- a/d2m/actions/create-space.js +++ b/d2m/actions/create-space.js @@ -22,7 +22,7 @@ const ks = sync.require("../../matrix/kstate") const inflightSpaceCreate = new Map() /** - * @param {import("discord-api-types/v10").RESTGetAPIGuildResult} guild + * @param {DiscordTypes.RESTGetAPIGuildResult} guild * @param {any} kstate */ async function createSpace(guild, kstate) { @@ -199,7 +199,7 @@ async function syncSpaceFully(guildID) { } /** - * @param {import("discord-api-types/v10").GatewayGuildEmojisUpdateDispatchData | import("discord-api-types/v10").GatewayGuildStickersUpdateDispatchData} data + * @param {DiscordTypes.GatewayGuildEmojisUpdateDispatchData | DiscordTypes.GatewayGuildStickersUpdateDispatchData} data * @param {boolean} checkBeforeSync false to always send new state, true to check the current state and only apply if state would change */ async function syncSpaceExpressions(data, checkBeforeSync) { @@ -209,11 +209,11 @@ async function syncSpaceExpressions(data, checkBeforeSync) { if (!spaceID) return /** - * @typedef {import("discord-api-types/v10").GatewayGuildEmojisUpdateDispatchData & import("discord-api-types/v10").GatewayGuildStickersUpdateDispatchData} Expressions + * @typedef {DiscordTypes.GatewayGuildEmojisUpdateDispatchData & DiscordTypes.GatewayGuildStickersUpdateDispatchData} Expressions * @param {string} spaceID * @param {Expressions extends any ? keyof Expressions : never} key * @param {string} eventKey - * @param {(emojis: any[]) => any} fn + * @param {typeof expression["emojisToState"] | typeof expression["stickersToState"]} fn */ async function update(spaceID, key, eventKey, fn) { if (!(key in data) || !data[key].length) return diff --git a/d2m/converters/message-to-event.js b/d2m/converters/message-to-event.js index 60aba95..cb9e900 100644 --- a/d2m/converters/message-to-event.js +++ b/d2m/converters/message-to-event.js @@ -437,7 +437,7 @@ async function messageToEvent(message, guild, options = {}, di) { // Then embeds for (const embed of message.embeds || []) { if (embed.type === "image") { - continue // Matrix's own image embeds are fine. + continue // Matrix's own URL previews are fine for images. } // Start building up a replica ("rep") of the embed in Discord-markdown format, which we will convert into both plaintext and formatted body at once diff --git a/readme.md b/readme.md index df09c7d..e7baf18 100644 --- a/readme.md +++ b/readme.md @@ -53,7 +53,7 @@ For more information about features, [see the user guide.](https://gitdab.com/ca ## Efficiency details -Using WeatherStack as a thin layer between the bridge application and the Discord API lets us control exactly what data is cached. Only necessary information is cached. For example, member data, user data, message content, and past edits are never stored in memory. This keeps the memory usage low and also prevents it ballooning in size over the bridge's runtime. +Using WeatherStack as a thin layer between the bridge application and the Discord API lets us control exactly what data is cached in memory. Only necessary information is cached. For example, member data, user data, message content, and past edits are never stored in memory. This keeps the memory usage low and also prevents it ballooning in size over the bridge's runtime. The bridge uses a small SQLite database to store relationships like which Discord messages correspond to which Matrix messages. This is so the bridge knows what to edit when some message is edited on Discord. Using `without rowid` on the database tables stores the index and the data in the same B-tree. Since Matrix and Discord's internal IDs are quite long, this vastly reduces storage space because those IDs do not have to be stored twice separately. Some event IDs are actually stored as xxhash integers to reduce storage requirements even more. On my personal instance of OOYE, every 100,000 messages require 16.1 MB of storage space in the SQLite database. @@ -61,11 +61,11 @@ Only necessary data and columns are queried from the database. We only contact t File uploads (like avatars from bridged members) are checked locally and deduplicated. Only brand new files are uploaded to the homeserver. This saves loads of space in the homeserver's media repo, especially for Synapse. -Switching to [WAL mode](https://www.sqlite.org/wal.html) could improve your database access speed even more. Run `node scripts/wal.js` if you want to switch to WAL mode. +Switching to [WAL mode](https://www.sqlite.org/wal.html) could improve your database access speed even more. Run `node scripts/wal.js` if you want to switch to WAL mode. This will also enable `synchronous = NORMAL`. # Setup -If you get stuck, you're welcome to message @cadence:cadence.moe to ask for help setting up OOYE! +If you get stuck, you're welcome to message [#out-of-your-element:cadence.moe](https://matrix.to/#/#out-of-your-element:cadence.moe) or [@cadence:cadence.moe](https://matrix.to/#/@cadence:cadence.moe) to ask for help setting up OOYE! You'll need: