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

Add support for discord forum channels/threads (discord) #1914

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomabrafix
Copy link

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 #1908

@42wim 42wim added the discord label Nov 26, 2022
@42wim 42wim added this to the 1.26.0 milestone Nov 26, 2022
@42wim 42wim modified the milestones: 1.26.0, 1.27.0 Jan 29, 2023
@42wim
Copy link
Owner

42wim commented Mar 14, 2023

@tomabrafix sorry for the long delay on response for this PR, are you still willing to work on it and rebase it?

@anteac
Copy link

anteac commented Mar 27, 2023

any update on tis?

@yousefmansy1
Copy link
Contributor

sorry for the long delay on response for this PR, are you still willing to work on it and rebase it?

Might take a look at this later... a bit busy these days :P

// Returns messageID and error.
func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordgo.Message, error) {
func (b *Bdiscord) webhookSendThread(msg *config.Message, channelID string, threadID string) (*discordgo.Message, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method Bdiscord.webhookSendThread has 52 lines of code (exceeds 50 allowed). Consider refactoring.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think a shorter function (even by two lines) will improve the understanding of this code. Is it possible to ignore the "issue" at this point?

@aicynide
Copy link

aicynide commented Sep 3, 2023

Merge it merge it

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
@codeclimate
Copy link

codeclimate bot commented Sep 3, 2023

Code Climate has analyzed commit 3e3090f and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

@Ogromny
Copy link

Ogromny commented Sep 17, 2023

I currently use matterbridge to bridge an IRC and a discord server. This feature would greatly improve the user experience, is it ready to merge ?

@tomabrafix
Copy link
Author

From my point of view it can be merged

@Divide-By-0
Copy link

How would i use this to mirror i.e. slack threads with discord threads?

@tomabrafix
Copy link
Author

How would i use this to mirror i.e. slack threads with discord threads?

If I understand Slack correctly, Slack Threads and Discord "Threads" are different concepts and should not be mirrored:
Discord "Threads" are special channels (part of Discords "Forums"; a forum is like a group of these special channels; only available for community servers).
As far as I understand, Slack Threads are only replies to a message in a channel. In Discord it is possible to reply to a message too, which will be mirrored as a Slack thread if PreserveThreading=true is set.

@Divide-By-0
Copy link

How would i use this to mirror i.e. slack threads with discord threads?

If I understand Slack correctly, Slack Threads and Discord "Threads" are different concepts and should not be mirrored: Discord "Threads" are special channels (part of Discords "Forums"; a forum is like a group of these special channels; only available for community servers). As far as I understand, Slack Threads are only replies to a message in a channel. In Discord it is possible to reply to a message too, which will be mirrored as a Slack thread if PreserveThreading=true is set.

I'm not talking about forum channels in Discord, I'm talking about threads within normal channels, which is a feature released around 1 year ago. You can have threads in normal channels as well now (see: https://support.discord.com/hc/en-us/articles/4403205878423-Threads-FAQ ). The slack thread <> discord reply feature is nice, but Discord threads would be better and more intuitive.

By the way, do you have some fork of this that is being more actively maintained that I could use, with all your features upstreamed to some main branch? Here I have to choose between one feature or another based on which branch is making the PR...

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

Successfully merging this pull request may close these issues.

discord: Add forum channel support
7 participants