42wim / matterbridge

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)
Apache License 2.0
6.55k stars 617 forks source link

Discord sends numeric channel ID when mentioning a bridged channel #1880

Open timschumi opened 2 years ago

timschumi commented 2 years ago

Describe the bug When bridging a Discord channel somewhere else (e.g. IRC) and mentioning a channel that is bridged by that matterbridge instance, the channel mention looks like #ID:12314523534545 on the other side instead of #channelname.

To Reproduce Steps to reproduce the behavior:

  1. Set up a bridge between Discord and IRC.
  2. Send a Discord message that mentions the channel that one is currently writing in.

Expected behavior The mention should look like #channelname on the IRC side.

Screenshots/debug logs Bildschirmfoto_2022-08-26_22-22-22

Environment (please complete the following information):

Additional context

``` [irc.libera] Server="irc.libera.chat:6697" Nick="timschumi" NickServNick="timschumi" NickServPassword="" UseTLS=true UseSASL=true SkipTLSVerify=true Label="irc" RemoteNickFormat="[{LABEL}] <{NICK}> " [discord.bridged] Token="" Server="" Label="discord" RemoteNickFormat="<{LABEL}> {NICK} " AutoWebhooks=true UseLocalAvatar=["irc.libera"] AllowMention=["users"] [[gateway]] name="irc-bridged" enable=true [[gateway.inout]] account="discord.bridged" channel="" [[gateway.inout]] account="irc.libera" channel="" ```
timschumi commented 2 years ago

The issue is caused by this piece of code in the getChannelName that replaces the channel mention with its ID, but doesn't care that the other side will not replace it with a mention on their side.

EDIT: I just realized that this function is also used internally to relay messages apparently.