matrix-org / matrix-appservice-discord

A bridge between Matrix and Discord.
Apache License 2.0
815 stars 152 forks source link

Some Discord users join Matrix with their id instead of nickname #870

Open roughnecks opened 2 years ago

roughnecks commented 2 years ago

This is an example: @_discord1016472849575329843=44yno:woodpeckersnest.space

Is there a way to fix it?

Miepee commented 2 years ago

the =44 part is weird, usually the format is @_discord_[user id]:[server domain] Is the message from some webhook or bot?

roughnecks commented 2 years ago

yes, it's a bot posting a youtube video (Dyno to be exact).

Miepee commented 2 years ago

The bot doesn't happen to post the videos when using slash commands?

roughnecks commented 2 years ago

Nope, it's an automated thing. I setup my Youtube channel in bot's control panel and it sends updates to a channel whenever there's new content posted on YT.

Miepee commented 2 years ago

Good to know, so far I was only able to repro it with slash commands. Am not that familiar with the discord API, but seems like there's some sort of posting from a bot, that the current bridge doesn't handle that well. It might be necessary to bump the discordjs dependency in order to fix that.

jaller94 commented 2 years ago

the =44 part is weird

This is expected. The Matrix spec defines allowed characters in User Identifiers. In "Dyno" the upper case D is not allowed to be in a User Identifier. The bridge therefore uses URL encode to preserve the upper case D (%44) as described here: https://spec.matrix.org/v1.4/appendices/#mapping-from-other-character-sets

Miepee commented 2 years ago

Why are the display names sometimes in the MXID though? For example here, the first one (whose MXID is @_discord_185476724627210241:t2bot.io was a bot command initiated with "classic" commands, while the bottom one was initiated with a slash command. grafik