Add getThreadChannel() to Message Object
See original GitHub issueGeneral Troubleshooting
- I have checked for similar issues.
- I have updated to the latest JDA version.
- I have checked the branches or the maintainers’ PRs for upcoming features.
Feature Request
Discord provides an optional thread
object in the Message object, but JDA as of right now does not have a simple way to obtain a thread through a Message object with a getter.
A simple getThreadChannel()
which returns a nullable ThreadChannel instance would be enough here.
Example Use-Case
Example use-cases can be where you f.e. have a suggestion system where users submit suggestions through slash commands, which then get posted in a dedicated channel with a thread created for discussion. If you then want the bot to archive the Thread before deleting the parent message is this not doable, as there is no Getter for it. At most could you probably go through all non-archived threads and check if they have the right message attached…
With the getter could something like this be doable:
TextChannel tc = // Obtain Text channel
tc.retrieveMessageById(1234567890L).queue(msg -> {
ThreadChannel thread = msg.getThreadChannel();
if (thread == null || thread.isArchived()) { // Doesn't have a thread channel or it is already archived.
return;
}
thread.getManager().setArchived(true).queue();
}
Issue Analytics
- State:
- Created a year ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
This has been achieved with Message#getStartedThread in 5.0.0-alpha.12
Can I be assigned to this?