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

discord: Add forum channel support #1908

Open
tomabrafix opened this issue Nov 2, 2022 · 1 comment · May be fixed by #1914
Open

discord: Add forum channel support #1908

tomabrafix opened this issue Nov 2, 2022 · 1 comment · May be fixed by #1914

Comments

@tomabrafix
Copy link

Discord released new "forum channel" with multiple "forums" last month. The matterbridge sadly does not support bridging to these. The forum channel has two IDs: the channel ID (the same for all forums in a forum channel) and a thread ID (different for each forum/thread). Using the forum/thread ID as channel ID in the matterbridge does not work (Unknown Channel). Manually creating and using the webhook via WebhookURL does not work either, because the discordgo library appends ?wait=true (see below).

Webhook documentation with parameter thread_id: https://discord.com/developers/docs/resources/webhook#execute-webhook

Environment

Version: 1.25.2

Operating system: Debian 10

Please describe the expected behavior.

Working bridge to discord forum channel.

Please describe the actual behavior.

SendMessage failed: execute failed: HTTP 400 Bad Request, {"code": 50035, "errors": {"thread_id": {"_errors": [{"code": "NUMBER_TYPE_COERCE", "message": "Value \"2222222222?wait=true\" is not snowflake."}]}}

Any steps to reproduce the behavior?

Try bridging to a new discord forum channel.

Example configuration file

[[gateway]]
name="example"
enable=true
    [[gateway.inout]]
    account="irc.net"
    channel="#game"
    [[gateway.inout]]
    account="discord.game"
    channel="ID:2222222222"
        [gateway.inout.options]
        WebhookURL="https://discord.com/api/webhooks/1111111111/s3cr3t-token?thread_id=2222222222"
tomabrafix added a commit to tomabrafix/matterbridge that referenced this issue Nov 6, 2022
Messages send to forum threads need to use the ID of the forum for the
webhook but also need to set an additional parameter during the API call
to specify the destination thread.

Receiving messages from threads works by using the thread ID. The forum
ID is not required.

This commit adds an optional channel option "ForumID" which can be used
to supply the forum ID of a thread (= channel). When sending/editing
messages the ForumID will be used for the webhook and the channel ID
will be supplied as the additional parameter "thread_id".

Fixes 42wim#1908
@tomabrafix
Copy link
Author

I have implemented forum channel support. In contrast to my first post, this would be the according working config:

[[gateway]]
name="example"
enable=true
    [[gateway.inout]]
    account="irc.net"
    channel="#game"
    [[gateway.inout]]
    account="discord.game"
    channel="ID:2222222222"
        [gateway.inout.options]
        ForumID="1111111111"

I am not a main Go developer, so I would appreciate any feedback or suggestions for improvement.

tomabrafix added a commit to tomabrafix/matterbridge that referenced this issue Jun 29, 2023
Messages send to forum threads need to use the ID of the forum for the
webhook but also need to set an additional parameter during the API call
to specify the destination thread.

Receiving messages from threads works by using the thread ID. The forum
ID is not required.

This commit adds an optional channel option "ForumID" which can be used
to supply the forum ID of a thread (= channel). When sending/editing
messages the ForumID will be used for the webhook and the channel ID
will be supplied as the additional parameter "thread_id".

Fixes 42wim#1908
tomabrafix added a commit to tomabrafix/matterbridge that referenced this issue Sep 3, 2023
Messages send to forum threads need to use the ID of the forum for the
webhook but also need to set an additional parameter during the API call
to specify the destination thread.

Receiving messages from threads works by using the thread ID. The forum
ID is not required.

This commit adds an optional channel option "ForumID" which can be used
to supply the forum ID of a thread (= channel). When sending/editing
messages the ForumID will be used for the webhook and the channel ID
will be supplied as the additional parameter "thread_id".

Fixes 42wim#1908
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

Successfully merging a pull request may close this issue.

1 participant