matrix-appservice-slack
matrix-appservice-slack copied to clipboard
Bridged Matrix avatars will not show up if not a PNG/GIF/JPEG
Describe the bug I'm running a Matrix instance bridged into IRC, Discord and Slack.
- All users show up fine in Matrix (avatars work from both Discord and Slack)
- Matrix users show up fine in Slack, with avatars as expected
- Discord users show up with the bot's default avatar icon (the name changes properly, but they get the default icon)
At first, I thought it was a missconfiguration of the slack bot account/permissions, but I think if that was the case, then the matrix users' avatars wouldn't show up, right?
For what it's worth, I'm running everything via the matrix-docker-ansible-deploy...
All users show up fine in Matrix (avatars work from both Discord and Slack) Matrix users show up fine in Slack, with avatars as expected
I'm confused. What is the problem?
I'm reading this as: As a Slack user, I don't see the avatars of Discord users.
That's a strange problem. There isn't really a distinction between Matrix avatars and Discord avatars from the Slack perspective.
Sorry I haven't been paying attention to emails, but yes, that's what's happening.
For Slack users, only slack users and matrix users have their avatar images loaded properly. Anyone who is double-bridged is showing up with the bot's default icon, so the conversation looks like this a lot (the yellow icon is my bot's default avatar):

You can see the last two messages were sent by me:
- one from Matrix (note the "App" is still there), and it shows my avatar.
- one from Discord, and it doesn't show my avatar.
I have this set up with Discord, Slack, and IRC all connected -- on the discord side, only the IRC users don't get avatars. On slack, only Matrix users do (well, and Slack users, obviously).
Side note: I really wish the bots would all use https://robohash.org/ or a similar service for users with no icon...
It's a public community, you can see this for yourself if you like ;-)
- https://poshcode.org/slack
- https://poshcode.org/discord
- https://poshcode.org/irc
- https://matrix.to/#/#bridge:PoshCode.org
Any ideas @Half-Shot?
Quick guess:
- All Discord avatars seem to be WebP images. Slack may not support WebP as avatars.
I guess I've experimentally confirmed this. Not sure what to do about it, unless the bot wants to try converting everything to png for slack -- since that means it can inherently affect anyone, since Matrix / Element does support using webp images as your avatar:

If you try to upload a webp as your avatar in Slack, they be like:

Tediously, I suspect the best way is to indeed make the bridge convert to PNG. It feels like this could be a concern of the media repo to support clients (and bridges) who cannot display certain media. However, yeah we will need to look at solving this in the short term in the bridge. I'm aware that adding support for this would be potentially tricky though so I don't know how long a solution would take.
How's that going, @jaller94?
You know, to avoid the dependency on convert, you could always ship your own binary 🤨 -- at least, that's what /scionoftech/webp-converter does...
@Half-Shot
Maybe I'm missing something, can't you just url-rewrite the .webp to .png for slack? Without any transcoding? The api lets you choose filetype
For example, these both work.
- https://cdn.discordapp.com/icons/519944446557683712/b5ac241b2a9645dac9f5497553967417.png?size=256
- https://cdn.discordapp.com/icons/519944446557683712/b5ac241b2a9645dac9f5497553967417.webp?size=256
All CDNs support at least .png. Most have more.
https://discord.com/developers/docs/reference#image-formatting-cdn-endpoints
I don't think this bridge will ever see the discord URLs. However (at least in my case), I think the icon is coming from a matrix media server that could also provide whatever media type we wanted. I'm not sure how to make that happen, but I'll look into the configuration.