question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add getThreadChannel() to Message Object

See original GitHub issue

General 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:closed
  • Created a year ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MinnDevelopmentcommented, May 18, 2022

This has been achieved with Message#getStartedThread in 5.0.0-alpha.12

1reaction
RealYusufIsmailcommented, May 3, 2022

Can I be assigned to this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

GenericMessageReactionEvent (JDA 5.0.0-alpha.5 API) - Javadoc.io
Retrieves the message for this reaction event. Simple shortcut for getChannel().retrieveMessageById(getMessageId()) . The Message.getMember() method will always ...
Read more >
JDA (JDA 5.0.0-beta.2 API)
addEventListener(Object... listeners). Adds all provided listeners to the event-listeners that will be used to handle events. default JDA. awaitReady().
Read more >
1.17 - skUnity Docs
Adds a line of text to the hologram. codeExamples. arrow_drop_up 0 arrow_drop_down. flag. add line "This is a hologram!" ...
Read more >
Laravel each() closure not executing - Stack Overflow
So there is no deleting event fired for your Replies in this case: $thread->replies()->delete() . That is a direct DELETE query on the...
Read more >
Jda commands - Nova Break
JDA add support for threads JDA add support for member timeouts JDA add GenericMessageEvent#getThreadChannel() JDA introduce Context Menu Commands (v5): ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found