Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send discord emojis in text from matrix to discord #82

Open
XHawk87 opened this issue Apr 27, 2023 · 5 comments
Open

Send discord emojis in text from matrix to discord #82

XHawk87 opened this issue Apr 27, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@XHawk87
Copy link

XHawk87 commented Apr 27, 2023

I have this bridge on my matrix server, and I have it set up to puppet my discord account. I was trying out direct messages with a friend to see how it works. It's great in most respects, but one key thing that's missing is the ability to use my own discord emojis in chat messages. I wanted to open up a discussion about if/how this can be implemented. I'm a software developer, and I'd be willing to pitch in to help make this happen.

@XHawk87 XHawk87 added the enhancement New feature or request label Apr 27, 2023
@XHawk87
Copy link
Author

XHawk87 commented May 4, 2023

It seems to me like the correct way to handle this would be to detect <img data-mx-emoticon/> tags in org.matrix.custom.html messages, and have the discord puppet replace these with the matching discord emoji if found, or just send the image link if not. Any thoughts on using this approach?

@XHawk87
Copy link
Author

XHawk87 commented May 4, 2023

According to https://discord.com/developers/docs/reference#message-formatting

Type Structure Example
Custom Emoji <:NAME:ID> <:mmLol:216154654256398347>
Custom Emoji (Animated) <a:NAME:ID> <a:b1nzy:392938283556143104>

So we'll need to get the emoji ID somehow.

@XHawk87
Copy link
Author

XHawk87 commented May 10, 2023

For reference, this is how spoiler tags are currently handled:
https://github.com/mautrix/go/blob/ac3d88b512f26cee04d90eb8b6c47ce5ebec750b/format/htmlparser.go#L232
https://github.com/mautrix/go/blob/ac3d88b512f26cee04d90eb8b6c47ce5ebec750b/format/htmlparser.go#L307
https://github.com/mautrix/go/blob/ac3d88b512f26cee04d90eb8b6c47ce5ebec750b/format/htmlparser.go#L60

SpoilerConverter: func(text, reason string, ctx format.Context) string {

This seems like an appropriate place to set up conversion of matrix emoticons tags to discord tags

@HonbraDev
Copy link

It would also be possible to include Discord's custom emoticons by including it in the 'server' space, as defined in MSC 2545.

@Spaenny
Copy link

Spaenny commented Mar 24, 2024

You could retrieve all emotes from a Discord guild using the Discord API (https://discord.com/developers/docs/resources/emoji), and then upload them to the respective space using the State Event: im.ponies.room_emotes. This feature is supported by certain clients such as Cinny and FluffyChat.

You could simply add an extra prefix to the emotes for identification on the Matrix side, for example, "discord_emotename"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants