-
Notifications
You must be signed in to change notification settings - Fork 152
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
feat: add discord > matrix reaction support #862
base: develop
Are you sure you want to change the base?
Conversation
37819f5
to
2e91853
Compare
discord custom emojis can be done by setting a m.relates_to {
"shortcode": "something",
"m.relates_to": {
"event_id": "$abc123",
"key": "mxc://servername/someidhere",
"rel_type": "m.annotation"
}
} |
That's interesting. The MXC URL can be done already, but the SDK doesn't expose the I'll leave this as-is for now, but I'll check what you said and verify if that's actually how it works. If so, I can open a PR to matrix-bot-sdk to include this, then come back to fix it here in a 2nd iteration if that's cool with maintainers. Any chance you can link to where doing images as reactions is documented/defined? |
I believe the closest thing to documentation on that is the MSC: matrix-org/matrix-spec-proposals#3746 A bigger argument is probably that mx-puppet-discord, cinny, fluffychat, beeper, some element patches floating about, and probably more clients, all special case seeing an mxc url and render it as an image |
92c3151
to
ecc9dca
Compare
2a2548d
to
20f9048
Compare
I was testing this and it all seems to be working fine, but I'm getting this error
The room in question is a private room that has the bridge bot in it with admin access. Despite this error, everything appears to be functioning correctly. |
Hey @mangofeet, thanks for testing this! Any chance you could provide more in-depth steps to reproduce or a stack trace? |
Hi there ! I'm currently using this change on two servers with a few people. Thanks a lot for it ! I have two minor issues with it. The first one, as @mangofeet reported, is that we are getting the same errors :
A way to replicate the issue :
Shouldn't the ghost be invited before trying to create a reaction on Matrix's side ? The second issue has to do with Discord bot users. It seems their reactions are not bridged at all. And any subsequent Discord user which tries to react will simply be ignored. This specific emoji can never be seen on Matrix side. Having a Discord user use another emoji to react does work. |
@salixor @mangofeet I've rebased with I also found another bug. Removing all reactions in the Discord interface should bridge to Matrix correctly now. |
ba3d10b
to
2ac843f
Compare
Signed-off-by: Seth Falco <[email protected]>
Signed-off-by: Seth Falco <[email protected]>
Signed-off-by: Seth Falco <[email protected]>
Signed-off-by: Seth Falco <[email protected]>
Is there anything open but the rebase (same question goes for the related #877)? |
return false; | ||
} | ||
|
||
return event.content["m.relates_to"].key === reaction.emoji.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use reactionName
here in the same way as in OnMessageReactionAdd
discordBot = getDiscordBot(); | ||
const intent = mockBridge.getIntent(author.id); | ||
|
||
intent.underlyingClient.unstableApis.getRelationsForEvent = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not unstable anymore, using it via .unstableApis
is deprecated
intent.underlyingClient.unstableApis.getRelationsForEvent = async () => { | |
intent.underlyingClient.getRelationsForEvent = async () => { |
|
||
const underlyingClient = intent.underlyingClient; | ||
|
||
const { chunk } = await underlyingClient.unstableApis.getRelationsForEvent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { chunk } = await underlyingClient.unstableApis.getRelationsForEvent( | |
const { chunk } = await underlyingClient.getRelationsForEvent( |
const [ eventId, roomId ] = storeEvent.MatrixId.split(";"); | ||
const underlyingClient = this.bridge.botIntent.underlyingClient; | ||
|
||
const { chunk } = await underlyingClient.unstableApis.getRelationsForEvent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { chunk } = await underlyingClient.unstableApis.getRelationsForEvent( | |
const { chunk } = await underlyingClient.getRelationsForEvent( |
public async getRelationsForEvent(roomId: string, eventId: string, relationType?: string, eventType?: string): Promise<any> { | ||
this.funcCalled("getRelationsForEvent", roomId, eventId, relationType, eventType); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to MatrixClientMock
I've actually deleted my Discord account since creating this PR. Edit: I won't close it unless someone wants to take over. In future, I may create a dummy account just to update the PRs if no one else wants to maintain it. |
Related
Adds reaction support in one direction (Discord → Matrix).
Supports:
There is an "edge-case" with some emotes.
Here is a thumbs-up emoji on Discord: 👍 (Base64: 8J+RjQo=)
Here is a thumbs-up emoji on Element: 👍️ (Base64: 8J+Rje+4jwo=)
If someone reacts with a thumbs-up from Discord, then someone clicks that reaction in Element (and presumably any Matrix client) it's handled perfectly fine.
However, if a user separately goes through the Element interface to do a thumbs-up emoji, because it's technically a different character, you'll see 2 separate reactions for a thumbs-up.
Notes
There are a few ways we can approach bridging reactions with custom emojis.
It looks like in future it should be supported to use external images as reactions via MXC URLs. I don't do this yet because the
shortcode
is not exposed in the SDK and it's not clearly documented behavior, but in future can update the bridge to support that.Based on what I've seen, others use the format
:name:
for theshortcode
property. Based on this, I've decided to use the same format already. That way when we're in a position to support MXC URLs and theshortcode
property, we can just move the value ofkey
toshortcode
for those cases.Screenshots
Notes
getRelationsForEvent
was moved out ofunstableApis
in the main branch for matrix-bot-sdk. Eventually, when we update to a version of matrix-appservice-bridge that uses that version we should switch it out stop using it fromunstableApis
.