/This is a squash-commit - the following is a rough summary of all sub-commits, written in style of commit messages (not necessarily those commits themselves), ie. short and in present tense./ * Document design choice to not bridge Discord threads as Matrix threads [by directly quoting Cadence] * Alter thread-to-announcement, so that it replies in-thread [with this, Matrix users will get a list of almost all (exl. those that don't branch from anything) open threads on a given channel, whereas before it wasn't possible. Also features slight alterations to the text] * Notify the user, whenever an in-thread message on Matrix is sent, that this isn't how they're supposed to do threads on OOYE * Detect /thread being ran as a reply or in-thread to branch the thread from the relevant message * Handle various /thread errors [notably being ran without args (infer the title if ran in the context above, simply show help if not)] * Whenever possible, direct the user to an already-existing thread-room [if /thread was ran as a reply or in-thread, or as part of the notification mentioned in point 3 (feat. a new utility method)] AUXILIARY TYPE CHANGES (not always relevant to UX-improvement-related changes): * Fix „boolean” being referred to as „bool” in types.d.ts * Rename execute(event) in matrix-command-handler is now parseAndExecute(event) [and it is no longer of type CommandExecute, but has its own custom definition, because a) it has a different return now (returns what command was ran (needed for point 3 in section above) instead of always undefined and b) other params from CommandExecute (like ctx or words) weren't being used - quite the contrary, their values were only being created at that stage (as part of command parsing - hence the rename, too), so telling that they're values you pass into execute() was at least somewhat confusing] * Further narrow-down the type of guard() in m2d event-dispatcher TEST CHANGES: * Create 7 new tests, all pass * Update 4 existing threads, all pass * Pass all other relevant tests [and almost all other tests, too - there are some issues with event2message for stickers, but given the fact that this commit does not touch the stickers subsystem in any way at all, it does not seem like they are any way related to my changes and they must've been failing before] * Do extensive manual testing and debugging Co-authored-by: Guzio <guzekk@protonmail.com> Co-committed-by: Guzio <guzekk@protonmail.com> |
||
|---|---|---|
| .vscode | ||
| docs | ||
| scripts | ||
| src | ||
| test | ||
| .c8rc.json | ||
| .gitignore | ||
| addbot.js | ||
| addbot.sh | ||
| COPYING | ||
| jsconfig.json | ||
| package-lock.json | ||
| package.json | ||
| readme.md | ||
| start.js | ||
Out Of Your Element
Modern Matrix-to-Discord appservice bridge, created by @cadence:cadence.moe
Why a new bridge?
- Modern: Supports new Discord features like replies, threads and stickers, and new Matrix features like edits, spaces and space membership.
- Efficient: Special attention has been given to memory usage, database indexes, disk footprint, runtime algorithms, and queries to the homeserver. Efficiency details.
- Reliable: Any errors on either side are notified on Matrix and can be retried. Messages sent during bridge downtime will still be bridged after it comes back up.
- Tested: A test suite and code coverage make sure all the logic and special cases work.
- Simple development: No build step (it's JavaScript, not TypeScript), minimal/lightweight dependencies, and abstraction only where necessary so that less background knowledge is required. No need to learn about Intents or library functions.
- No locking algorithm: Other bridges use a locking algorithm which is a source of frequent bugs. This bridge avoids the need for one.
- Latest API: Being on the latest Discord API version lets it access all features, without the risk of deprecated API versions being removed.
What works?
Most features you'd expect in both directions: messages, edits, deletions, formatting (including spoilers), reactions, custom emojis, custom emoji reactions, mentions, channel mentions, replies, threads, stickers (all formats: PNG, APNG, GIF, Lottie), attachments, spoiler attachments (compatible with most clients), embeds, URL previews, presence, discord.com hyperlinks, and more.
Metadata is also synced: people's names, avatars, usernames; channel names, icons, topics; spaces containing rooms; custom emoji lists. Syncing Matrix rooms, room icons, and topics is optional: you can keep them different from the Discord ones if you prefer.
I've also added some interesting features that I haven't seen in any other bridge:
- Members using the PluralKit bot each get their own persistent accounts
- Replies from PluralKit members are restyled into native Matrix replies
- Simulated user accounts are named @the_persons_username rather than @112233445566778899
- Matrix custom emojis from private rooms are still visible on Discord as a sprite sheet
- To save space, larger files from Discord are linked instead of reuploaded to Matrix (links don't expire)
For more information about features, see the user guide.
Caveats
- This bridge is not designed for puppetting.
- Direct Messaging is not supported until I figure out a good way of doing it.
- Encrypted messages are not supported. Decryption is often unreliable on Matrix, and your messages end up in plaintext on Discord anyway, so there's not much advantage.