discorddiscord-jda

JDA thread/post create event listener


In JDA 5 is there an EventListener for thread or forum post creation?

I want to give a new role to anyone who created a forum post. In my understanding, a forum post is the same as a thread since both are refered to as "Thread ID" in discord developer mode.

I am looking for a similiar event listener like onChannelCreate but I can't seem to find any for thread or forum post related. If a direct implementation is not possible, I alternative is to look into aduit log on a scheduler basis.


Solution

  • If you view JDA's documentation on Channel object, you will find a ChannelType enum property that determines the type of the channel, which could be of type Thread or Forum (which ever you're trying to catch), so by using the onChannelCreate EventListener, you should be able to check the channel created against ChannelType.