matrix-org / matrix-appservice-discord

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

Allow Discord server admins to approve bridges #694

Open CorpulentBrony opened 3 years ago

CorpulentBrony commented 3 years ago

Recently set-up the bridge and noticed that it appears it is requiring the server owner approve the bridge, whereas the documentation states it's the Discord server's admins.

It would be preferable if the bot would allow any server administrator to approve it, since I happen to be an administrator on a server the owner abandoned. Alternatively, the documentation should be updated to state specifically that only the owner of the Discord server can approve the bridge.

CorpulentBrony commented 3 years ago

It appears there may be something else going on here, I just tried to bridge a Discord server where I'm the owner, and I'm not even getting a message there either. How does one approve the bridge on the Discord side? Should the bot be sending Discord messages?

auscompgeek commented 3 years ago

The bot should be sending a message in the Discord channel, yes.

CorpulentBrony commented 3 years ago

Isn't happening, bot's saying nothing on Discord. Bot is present and appears online.

Apr-18 05:24:43.924 [MatrixCommandHandler] error: Error bridging !hmYfKUBJIiMiTpOSkF:mlp.chat to 831367801234915338/833211281858887700
Apr-18 05:24:43.924 [MatrixCommandHandler] error: Error: Guild "831367801234915338" not found
    at DiscordBot.<anonymous> (/home/corpubro/matrix-appservice-discord/src/bot.ts:372:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/corpubro/matrix-appservice-discord/build/src/bot.js:20:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
127.0.0.1 - - [18/Apr/2021:05:24:43 +0000] "PUT /transactions/22?access_token=1b2c3597-a616-439f-95c4-198795d6b156 HTTP/1.1" 200 2 "-" "Synapse/1.31.0"

Double-checked that is the proper guild ID and channel ID, bot does exist in the guild with the default 607250432 perms.

CorpulentBrony commented 3 years ago

Is it possible it's not recognizing newer snowflake IDs? Tried again in an older server I own and it accepts the guild ID but doesn't like the channel ID.

Apr-18 05:47:39.655 [MatrixCommandHandler] error: Error: Channel "833184859785658378" not found

CorpulentBrony commented 3 years ago

OK, I'm pretty sure the core of the problem is better-discord.js isn't finding rooms for some reason.

Screenshot showing URL of channel and the presence of the Discord bot

When I attempt to bridge from Matrix:

Apr-19 03:09:41.752 [DiscordBot] verbose: LookupRoom =>  Error: Channel "833211281858887700" not found
    at DiscordBot.<anonymous> (/home/corpubro/matrix-appservice-discord-1.0.0/src/bot.ts:390:19)
    at Generator.next (<anonymous>)
    at fulfilled (/home/corpubro/matrix-appservice-discord-1.0.0/build/src/bot.js:20:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Apr-19 03:09:41.752 [MatrixCommandHandler] error: Error bridging !hmYfKUBJIiMiTpOSkF:mlp.chat to 831367801234915338/833211281858887700
Apr-19 03:09:41.752 [MatrixCommandHandler] error: Error: Channel "833211281858887700" not found
    at DiscordBot.<anonymous> (/home/corpubro/matrix-appservice-discord-1.0.0/src/bot.ts:390:19)
    at Generator.next (<anonymous>)
    at fulfilled (/home/corpubro/matrix-appservice-discord-1.0.0/build/src/bot.js:20:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Apr-19 03:09:41.753 [bot-sdkMatrixLiteClient (REQ-12)] info: [
  'PUT https://mlp.chat/_matrix/client/r0/rooms/!hmYfKUBJIiMiTpOSkF%3Amlp.chat/send/m.room.message/1618801781752__REQ11'
]

May be the same as #684

I still haven't been able to experience the Discord-side approval process, but if anyone with the Administrator privilege can approve the room then this issue is moot. However, if that's restricted only to server owner (as the message sent to Matrix implies), then I'd like the issue to remain focused on that.

auscompgeek commented 3 years ago

Last time I did the self-serve bridge workflow, I was able to approve without being the owner.