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

Thread Support #1899

Closed
Cisien opened this issue Jul 28, 2021 · 18 comments
Closed

Thread Support #1899

Cisien opened this issue Jul 28, 2021 · 18 comments

Comments

@Cisien
Copy link

Cisien commented Jul 28, 2021

I understand it's still very early in the rollout of thread support to discord communities, but large public communities are starting have the option of enabling this feature in their servers. Unfortunately, bots written in discord.net cannot see the messages sent in threads, and therefore cannot moderate threads.

Is thread support on the roadmap for discord.net? Or should we seek out alternatives?

@xXBuilderBXx
Copy link
Contributor

xXBuilderBXx commented Jul 28, 2021

Gateway events for threads are on version 9 of the Discord API atm which would probably need some major changes to the code also it dosen't even support buttons and slash commands yet either so threads are gonna take a while.

@JimboJacksonBroDudeMan
Copy link

IMO this one should be waaaaaaay higher priority than slash commands or buttons. a lot of us use discord.net for moderation functions so having our bots not being able to see threads complicates everything.

@Cisien
Copy link
Author

Cisien commented Jul 28, 2021

It means that discord.net isn't suitable for purpose on servers that wish to use this feature.

@JimboJacksonBroDudeMan
Copy link

So your solution here is to completely rewrite our bots using something else. Got it. Very helpful.

@Cisien
Copy link
Author

Cisien commented Jul 28, 2021

I'm not affiliated with this project. For what it's worth; we are re-writing our bots to use other libraries that have support for threads.

@AntiTcb
Copy link
Collaborator

AntiTcb commented Jul 28, 2021

You don't have to complete re-write your bots; you can have multiple applications running simultaneously. Keep your existing bot in D.NET, and you're free to also have an application running using a separate API library with the support for the newer Discord features that this library doesn't support yet.

@Cisien
Copy link
Author

Cisien commented Jul 28, 2021

Yeah, sure. That's AN option, but a terrible one.

@SubZero0
Copy link
Member

I understand how critical threads can be for some, I'll try to get some time to add support to them in the latest version.
So applications can, at least, receive and process messages sent in those.

For now, my plan is doing it in a similar way as private channels, as not keeping them in cache (unlike text channels), and I'll probably need to request the ability to use threads in a private server to Discord so I can test it.

@JimboJacksonBroDudeMan
Copy link

JimboJacksonBroDudeMan commented Jul 28, 2021

I understand how critical threads can be for some, I'll try to get some time to add support to them in the latest version.
So applications can, at least, receive and process messages sent in those.

For now, my plan is doing it in a similar way as private channels, as not keeping them in cache (unlike text channels), and I'll probably need to request the ability to use threads in a private server to Discord so I can test it.

Check your servers. My partnered server didnt have it enabled till after the partnered happy hour today but a server of mine with 7 members had it enabled before that and another with a few hundred had it before as well.

I checked two of my friend's private servers and both have threads enabled already.

@SubZero0
Copy link
Member

SubZero0 commented Jul 30, 2021

To start, I wrote two possible solutions:

#1901 - Change the IMessage.Channel property from IMessageChannel to Cacheable<IMessageChannel, ulong>
Pro: this would make pretty easy to know if the channel is present or not, while making people adjust their code (won't get surprised by the change since they will need to redo the logic as it'll break)
Con: sending messages isn't as trivial as before as Channel could not be there, would require adding SendMessage and SendFile to the client and changing from context.Channel.SendMessageAsync(... to context.Client.SendMessageAsync(channelId, ... if they don't want to possibly download the channel

#1902 - Create a new channel type: UnknownChannel
Pro: won't require any changes as Channel will still exist as an IMessageChannel, no weirdness to send messages/files
Con: logic from before might not work well, since this new channel type wasnt considered when they built their applications (Name would be null and different logic as this channel at the moment could only be a thread channel but not classified as one since the id is the only thing present), would require to get the actual channel ("download" by REST) to do more than send messages/files

At this moment, I'm leaning towards the second because one of the two:

  • If I decide to cache thread channels, the lib consumer will barely notice the existance of SocketUnknownChannel when a proper SocketThreadChannel is added by a following PR.
  • If I don't, it's still "plug'n'play" and trivial to send messages, except that when using the lib, it might be needed to be careful with SocketUnknownChannels and deal with it differently since it would be needed to get the channel by REST (for now, the only case for an unknown channel is a thread).

@quinchs
Copy link
Member

quinchs commented Jul 31, 2021

I mean... labs has threads, i can open a PR and we can work from there to implement them here @SubZero0

@IS4Code
Copy link

IS4Code commented Aug 2, 2021

Gateway events for threads are on version 9 of the Discord API atm which would probably need some major changes to the code also it dosen't even support buttons and slash commands yet either so threads are gonna take a while.

Well the version in Discord.Net was bumped to 9 two months ago and seems to work so...

@Sasino97
Copy link

Sasino97 commented Sep 2, 2021

This is a major feature lacking, it should be priority number 1 for Discord.NET
Meanwhile, I think I'm gonna write a second bot in JS to moderate threads

@MathieuDR
Copy link

r feature lacking, it should be priority number 1 for Discord.NET
Meanwhile, I think I'm gonna write a second bot in JS to moderate threads

You could always check Discord.Net Labs, it has some more new experimental features

@IS4Code
Copy link

IS4Code commented Sep 3, 2021

You could always check Discord.Net Labs, it has some more new experimental features

Doesn't seem like the support for creating threads is there either, but hopefully it will come sooner.

@mcmonkey4eva
Copy link

It's in a branch @ https://github.com/Discord-Net-Labs/Discord.Net-Labs/tree/feature/threads

@roridev
Copy link
Contributor

roridev commented Sep 4, 2021

It's in a branch @ https://github.com/Discord-Net-Labs/Discord.Net-Labs/tree/feature/threads

its actually already merged into labs, and is released on v3.0.

@quinchs quinchs mentioned this issue Sep 20, 2021
34 tasks
@MrCakeSlayer
Copy link
Collaborator

This has now been implemented via the merged labs PR (#1923)

@quinchs quinchs unpinned this issue Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests