Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge.py only works in one direction #19

Open
Akselmo opened this issue Jul 2, 2022 · 11 comments
Open

Bridge.py only works in one direction #19

Akselmo opened this issue Jul 2, 2022 · 11 comments

Comments

@Akselmo
Copy link

Akselmo commented Jul 2, 2022

The messages come from discord to matrix, but not from matrix to discord

Logs

2022-07-02 21:05:21 discord.client:WARNING: PyNaCl is not installed, voice will NOT be supported
2022-07-02 21:05:21 discord.client:INFO: logging in using static token
2022-07-02 21:05:22 matrix_logger:INFO: Logged in as @matrix-discord-bridge:matrix.akselmo.dev, device id: GGEJQJXCIQ.
2022-07-02 21:05:22 matrix_logger:INFO: Clients ready!
2022-07-02 21:05:22 discord.gateway:INFO: Shard ID None has sent the IDENTIFY payload.
2022-07-02 21:05:22 discord.gateway:INFO: Shard ID None has connected to Gateway: ["gateway-prd-main-456x",{"micros":81093,"calls":["discord-sessions-green-prd-2-200",{"micros":79640,"calls":["start_session",{"micros":38729,"calls":["discord-api-f8857dbfb-dkkhc",{"micros":34594,"calls":["get_user",{"micros":8979},"add_authorized_ip",{"micros":1664},"get_guilds",{"micros":3365},"coros_wait",{"micros":2}]}]},"guilds_connect",{"micros":2,"calls":[]},"presence_connect",{"micros":23745,"calls":[]}]}]}] (Session ID: bb52c75524c62fca0b720dafd94b901d).
@Cknight70
Copy link

Cknight70 commented Jul 2, 2022

I have had this problem before too. For me clearing pycache and then waiting sometimes longer than 10 minutes from restarting the bot fixed it

@Akselmo
Copy link
Author

Akselmo commented Jul 2, 2022

Waiting hasnt worked for me.. And to clarify i meant the non-appservice bridge. The appservice one refuses to work for me at all.

@mayman007
Copy link

I have the same problem. Did you find the solution?

@Akselmo
Copy link
Author

Akselmo commented Aug 17, 2022

I have the same problem. Did you find the solution?

Unfortunately not. I just went with this instead: https://github.com/matrix-org/matrix-appservice-discord

@nfacha
Copy link

nfacha commented Sep 23, 2022

Also having this issue

@git-bruh
Copy link
Owner

git-bruh commented Sep 23, 2022

Also having this issue

Can you share your bridge config?

Unfortunately I don't use discord anymore so won't be able to debug the issue, the accounts keep getting disabled with phone verification popup. You could try adding debug prints in the message received callbacks and see.

@nfacha
Copy link

nfacha commented Sep 23, 2022

the accounts keep getting disabled with phone verification popup

Eh, just to confirm, this is a BOT account token, not a USER account token right?
If so that popup doesn't make sense at all

{
    "homeserver": "https://matrix.facha.dev",
    "username": "@neo:facha.dev",
    "password": "XXX",
    "token": "XXX",
    "discord_cmd_prefix": "**",
    "bridge": {
        "412668210853183516": "!dMlxDKlOrpNuCzbfzC:facha.dev"
    }
}

XXX = PLACEHOLDER

@git-bruh
Copy link
Owner

Yeah it's a bot token. I meant that discord disables your account during the sign up process itself before you can get to the developer portal thingy.

My current setup has been using the appservice bridge for around a year now and still works fine on a bot token created from an account which got deactivated in this manner (they don't deactivate bots). You could try that one since you have a self hosted server, has much better QOL too with proper dummy users instead of plaintext bridging, and infinitely better code quality

I'm looking into this issue, seems like the bot isn't able to get the channels for some reason, perhaps something to do with an intents change

@git-bruh
Copy link
Owner

Nvm, it still works OK. I had messed up in the dev panel and didn't even have the bot in the server. Do you mind sharing the scopes you requested for the bot? I made mine an Administrator, you probably just need the webhook permissions though.

Screenshot_20220924-004643_Chromium
Screenshot_20220924-004648_Element

@nfacha
Copy link

nfacha commented Sep 26, 2022

Nvm, it still works OK. I had messed up in the dev panel and didn't even have the bot in the server. Do you mind sharing the scopes you requested for the bot? I made mine an Administrator, you probably just need the webhook permissions though.

Screenshot_20220924-004643_Chromium Screenshot_20220924-004648_Element

Now I'm getting an error too on Discord > Matrix

root@matrix-bridge:~/matrix-discord-bridge/bridge# python3 bridge.py 
2022-09-26 14:09:27 discord.client:WARNING: PyNaCl is not installed, voice will NOT be supported
2022-09-26 14:09:27 discord.client:INFO: logging in using static token
2022-09-26 14:09:28 matrix_logger:INFO: Logged in as @neo:facha.dev, device id: QKYEPDZJDO.
2022-09-26 14:09:28 matrix_logger:INFO: Clients ready!
2022-09-26 14:09:28 discord.gateway:INFO: Shard ID None has sent the IDENTIFY payload.
2022-09-26 14:09:28 discord.gateway:INFO: Shard ID None has connected to Gateway: ["gateway-prd-us-east1-c-7cq2",{"micros":141600,"calls":["id_created",{"micros":1363,"calls":[]},"session_lookup_time",{"micros":6909,"calls":[]},"session_lookup_finished",{"micros":13,"calls":[]},"discord-sessions-blue-prd-2-8",{"micros":133046,"calls":["start_session",{"micros":72071,"calls":["discord-api-bf7497dbf-dkqk8",{"micros":63680,"calls":["get_user",{"micros":13837},"get_guilds",{"micros":7927},"send_scheduled_deletion_message",{"micros":11},"guild_join_requests",{"micros":2847},"authorized_ip_coro",{"micros":9}]}]},"starting_guild_connect",{"micros":52,"calls":[]},"presence_started",{"micros":40330,"calls":[]},"guilds_started",{"micros":87,"calls":[]},"guilds_connect",{"micros":1,"calls":[]},"presence_connect",{"micros":20462,"calls":[]},"connect_finished",{"micros":20467,"calls":[]},"build_ready",{"micros":19,"calls":[]},"optimize_ready",{"micros":1,"calls":[]},"split_ready",{"micros":0,"calls":[]},"clean_ready",{"micros":18,"calls":[]}]}]}] (Session ID: d914ed85b62613dc3ef56918a9d38bb5).
Ignoring exception in on_message
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/root/matrix-discord-bridge/bridge/bridge.py", line 281, in on_message
    matrix_message = await self.matrix_client.message_send(
  File "/root/matrix-discord-bridge/bridge/bridge.py", line 189, in message_send
    return message.event_id
AttributeError: 'RoomSendError' object has no attribute 'event_id'

@git-bruh
Copy link
Owner

git-bruh commented Sep 26, 2022

The message is failing to send, as I said the non-appservice bridge code is not so good so it doesn't have good error reporting.

Is the bot account invited and joined in the matrix room and are you able to send messages through that account via element?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants