Skip to content

Unarchiving a privat thread channel and adding a new member fails #2533

Discussion options

You must be logged in to vote

You can try something like this:

channel.getManager().setArchived(false)
  .delay(Duration.ofSeconds(1)) // 1 second later
  .map(v -> jda.getThreadChannelById(channel.getIdLong())) // get fresh instance from cache
  .flatMap(thread -> thread.addThreadMember(user)) // then add a member
  .queue(); // important not to use complete() here so cache can catch up!

The issue here is definitely the cache, archived threads are never cached by JDA, so the state of that object is never updated. Besides that, discord also has some race-conditions related to archiving, so it is best to wait a little before adding a new member.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Ascend1984
Comment options

Answer selected by Ascend1984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants