matrix-org / matrix-appservice-discord

A bridge between Matrix and Discord.
Apache License 2.0
791 stars 148 forks source link

Bot doesn't relay Discord->Matrix messages since yesterday #845

Open z411 opened 1 year ago

z411 commented 1 year ago

Describe the bug Since yesterday the bot isn't bridging any Discord messages to Matrix. It bridges events like avatar and name changes, but not messages. Only Matrix -> Discord messages are bridged, but not Discord -> Matrix.

Expected behavior Messages between both Matrix and Discord should bridge.

Logs Nothing seems wrong here. I tried to bridge a room, but even though the bot can send the "please type !matrix approve" to Discord, it won't listen to it and never react.

Sep-5 03:27:41.216 [DiscordStore] info: Starting DB Init
Sep-5 03:27:41.219 [DiscordStore] info: Filename present in config, using sqlite
Sep-5 03:27:41.220 [SQLite3] info: Opening discord.db
Sep-5 03:27:41.231 [DiscordStore] info: Database schema version is 12, latest version is 12
Sep-5 03:27:41.231 [DiscordStore] info: Updated database to the latest schema
Sep-5 03:27:41.843 [ClientFactory] info: Waiting for shardReady signal
Sep-5 03:27:41.854 [ClientFactory] info: Got shardReady signal
Sep-5 03:27:41.856 [DiscordBot] info: Discord bot client logged in.
Sep-5 03:27:41.857 [DiscordAS] info: Discordbot started successfully
Sep-5 03:27:41.861 [DiscordAS] info: Started listening on port 9005
Sep-5 03:27:47.766 [bot-sdkAppservice] info: [ 'Processing transaction 88400' ]
Sep-5 03:27:47.767 [bot-sdkAppservice] info: [ 'Processing event of type m.room.message' ]
Sep-5 03:27:47.785 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [05/Sep/2022:06:27:47 +0000] "PUT /transactions/88400?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.66.0"\n'
]
Sep-5 03:28:37.076 [bot-sdkAppservice] info: [ 'Processing transaction 88401' ]
Sep-5 03:28:37.077 [bot-sdkAppservice] info: [ 'Processing event of type m.room.message' ]
Sep-5 03:28:37.098 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [05/Sep/2022:06:28:37 +0000] "PUT /transactions/88401?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.66.0"\n'
]
Sep-5 03:28:37.279 [bot-sdkAppservice] info: [ 'Processing transaction 88402' ]
Sep-5 03:28:37.280 [bot-sdkAppservice] info: [ 'Processing event of type m.room.message' ]
Sep-5 03:28:37.287 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [05/Sep/2022:06:28:37 +0000] "PUT /transactions/88402?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.66.0"\n'
]
Sep-5 03:28:44.736 [bot-sdkAppservice] info: [ 'Processing transaction 88403' ]
Sep-5 03:28:44.737 [bot-sdkAppservice] info: [ 'Processing event of type m.room.message' ]
Sep-5 03:28:44.858 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [05/Sep/2022:06:28:44 +0000] "PUT /transactions/88403?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.66.0"\n'
]
Sep-5 03:29:00.939 [bot-sdkAppservice] info: [ 'Processing transaction 88404' ]
Sep-5 03:29:00.939 [bot-sdkAppservice] info: [ 'Processing event of type m.room.message' ]
Sep-5 03:29:00.953 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [05/Sep/2022:06:29:00 +0000] "PUT /transactions/88404?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.66.0"\n'
]
Sep-5 03:29:00.967 [MatrixCommandHandler] info: Bridging matrix room !YdeurdghOSjTARrhBj:bienvenidoainternet.org to 780149015542235136/816504907536007198
Sep-5 03:29:01.072 [bot-sdkAppservice] info: [ 'Processing transaction 88405' ]
Sep-5 03:29:01.073 [bot-sdkAppservice] info: [ 'Processing event of type m.room.message' ]
Sep-5 03:29:01.079 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [05/Sep/2022:06:29:01 +0000] "PUT /transactions/88405?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.66.0"\n'
]

As seen in the logs, the homeserver is now Synapse/1.66 since I updated it to see if that was the issue. The problem started suddenly when no change was made to the server at all.

luphoria commented 1 year ago

Experiencing the same issue. Perhaps Discord has gone through with requiring higher "intents" in their API to read messages? So annoying...

z411 commented 1 year ago

Glad to know I'm not the only one. It also seems to me Discord might've changed something on their end...

luphoria commented 1 year ago

It's my speculation that's what happened because that's what they have been pushing for with their "intents API" for the new slash-command bots

luphoria commented 1 year ago

image I found that I already had Message Content Intent enabled. This will probably have to be fixed upstream :(

z411 commented 1 year ago

Same here. I tried enabling the intents and also kicking out and re-inviting the bot to the Discord guild to no avail. It keeps relaying name and avatar changes though, it's really weird.

z411 commented 1 year ago

@luphoria I managed to fix the issue. I updated the bot (git pull), recompiled it, and recreated the discord-registration.yaml file with the node build/src/discordas.js -r -u "http://localhost:9005" -c config.yaml command then copied it again to the Synapse installation. I also deleted discord.db (although this shouldn't be done but it didn't do any harm in my case) then restarted and rebridged all the roms. Everything works perfectly now. Apparently something got fixed, and I had updated but I had to recreate the discord-registration.yaml file. Tell me if it works for you.

luphoria commented 1 year ago

@luphoria I managed to fix the issue. I updated the bot (git pull), recompiled it, and recreated the discord-registration.yaml file with the node build/src/discordas.js -r -u "http://localhost:9005" -c config.yaml command then copied it again to the Synapse installation. I also deleted discord.db (although this shouldn't be done but it didn't do any harm in my case) then restarted and rebridged all the roms. Everything works perfectly now. Apparently something got fixed, and I had updated but I had to recreate the discord-registration.yaml file. Tell me if it works for you.

I don't know how to do any of this, I just bundled the matrix-as-discord with the ansible playbook. But i will get around to trying to tinker this soon

verymilan commented 1 year ago

same problem here ... (but not for all bridged channels it looks like)

Aterfax commented 1 year ago

I had to set usePrivilegedIntents: true today in order to get Discord ----> Matrix messages flowing so this is likely still a general issue for people.

Services were setup today on the most recent Synapse ("1.70.1") / bridging client version (commit: ac5180ed11e67ea9c1e6467941148b90dd122fb5) using docker.

z411 commented 1 year ago

Thank you, I'll try enabling this.

Aterfax commented 1 year ago

Thank you, I'll try enabling this.

Make sure to also enable it on the Discord bot permissions as shown a bit further above at https://discord.com/developers/applications/$YOUR_BOT_ID/bot :

image

verymilan commented 1 year ago

I can confirm that this helped, thanks!