matrix-org / matrix-appservice-discord

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

Discord -> Matrix Nickname Desync #832

Open FSG-Cat opened 2 years ago

FSG-Cat commented 2 years ago

Describe the bug As the title says Discord -> Matrix nickname desync can happen under unknown circumstances and i am filing this issue to document that in atleast one case the bridge should be aware of the Desync it can be argued.

To Reproduce The way to reproduce the bug is not known to me. The bug has popped up for plenty of bridged guilds tho. On the t2bot.io version of the bridge and back on the 1.0.0 release of the bridge too as far as i know.

Expected behavior For the bridge to the best of its ability keep these mappings in Sync and to not let it go out of Sync without a way to use a command to force it to fix it self.

So in this case the expected behavior is for the bridge to update my puppets display name to Cat/FSG-Cat as is the discord side nick.

Additional context Event bodies for a pair of events that shows the bridge is partially aware of the issue. These events are from the room #fosscord:feline.support and are given in partially redacted versions.

This event body shows the partially redacted version of the message that illuminated it for me that the bridge has the ability to know its out of Sync.

{
  "content": {
    "body": "Cat/FSG-Cat (@_discord_194854934846373899:t2bot.io) tl;dr\",
    "format": "org.matrix.custom.html",
    "formatted_body": "<a href=\"https://matrix.to/#/@_discord_194854934846373899:t2bot.io\">Cat/FSG-Cat</a> tl;dr<br><a href=\"\"></a>",
    "msgtype": "m.text"
  },
  "origin_server_ts": 1660411985046,
  "room_id": "!MpXYqDQVscfYxfGxOE:feline.support",
  "sender": "@_discord_84022289024159744:t2bot.io",
  "type": "m.room.message",
  "unsigned": {},
  "event_id": "$MEJvHibveTymwjujWM8oMq9XAHbod5_tRBjNQ23f7uE",
  "user_id": "@_discord_84022289024159744:t2bot.io"
}

Current member event for the room for the puppet that is representing me.

{
  "content": {
    "avatar_url": "mxc://t2bot.io/76fc40a77a1f63e64a24e13115949bae1c8fbc42",
    "displayname": "Legendariska Kattprogramvarugrup",
    "membership": "join",
    "uk.half-shot.discord.member": {
      "bot": false,
      "displayColor": 15211527,
      "id": "194854934846373899",
      "roles": [
        {
          "color": 3066993,
          "name": "Swedish",
          "position": 23
        },
        {
          "color": 3447003,
          "name": "Early supporters",
          "position": 37
        },
        {
          "color": 15211527,
          "name": "Moderator",
          "position": 46
        },
        {
          "color": 2800855,
          "name": "Translator",
          "position": 36
        },
        {
          "color": 0,
          "name": "@everyone",
          "position": 0
        }
      ],
      "username": "I ❤ Azukinut#9705"
    }
  },
  "origin_server_ts": 1657647263007,
  "room_id": "!MpXYqDQVscfYxfGxOE:feline.support",
  "sender": "@_discord_194854934846373899:t2bot.io",
  "state_key": "@_discord_194854934846373899:t2bot.io",
  "type": "m.room.member",
  "unsigned": {},
  "event_id": "$spEy_X0w9xT6xJoW538ZtztVQGB_83TdC6SJ4LPvTdI",
  "user_id": "@_discord_194854934846373899:t2bot.io"
}

This event was left intact as i do not know if removing data from it removes information that is useful to investigation of this issue.