diff --git a/src/main/java/net/dv8tion/jda/api/entities/ThreadChannel.java b/src/main/java/net/dv8tion/jda/api/entities/ThreadChannel.java
index 03865b90e5..86c5631bfa 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/ThreadChannel.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/ThreadChannel.java
@@ -101,6 +101,88 @@ default ThreadMember getThreadMemberById(String id)
@Nullable
ThreadMember getThreadMemberById(long id);
+ /**
+ * Load the thread-member for the specified user.
+ *
If the thread-member is already loaded it, will be retrieved from {@link #getThreadMemberById(long)}
+ * and immediately provided if the thread-member information is consistent. If the bot hasn't joined the thread,
+ * {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GatewayIntent.GUILD_MEMBERS} is required to keep the cache updated.
+ *
+ * @param member
+ * The member to load the thread-member from
+ *
+ * @throws IllegalArgumentException
+ * If provided with null
+ *
+ * @return {@link RestAction} - Type: {@link ThreadMember}
+ */
+ @Nonnull
+ @CheckReturnValue
+ default RestAction retrieveThreadMember(@Nonnull Member member)
+ {
+ Checks.notNull(member, "Member");
+ return retrieveThreadMemberById(member.getIdLong());
+ }
+
+ /**
+ * Load the thread-member for the specified user.
+ *
If the thread-member is already loaded, it will be retrieved from {@link #getThreadMemberById(long)}
+ * and immediately provided if the thread-member information is consistent. If the bot hasn't joined the thread,
+ * {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GatewayIntent.GUILD_MEMBERS} is required to keep the cache updated.
+ *
+ * @param user
+ * The user to load the thread-member from
+ *
+ * @throws IllegalArgumentException
+ * If provided with null
+ *
+ * @return {@link RestAction} - Type: {@link ThreadMember}
+ */
+ @Nonnull
+ @CheckReturnValue
+ default RestAction retrieveThreadMember(@Nonnull User user)
+ {
+ Checks.notNull(user, "User");
+ return retrieveThreadMemberById(user.getIdLong());
+ }
+
+ /**
+ * Load the thread-member for the user with the specified id.
+ *
If the thread-member is already loaded, it will be retrieved from {@link #getThreadMemberById(long)}
+ * and immediately provided if the thread-member information is consistent. If the bot hasn't joined the thread,
+ * {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GatewayIntent.GUILD_MEMBERS} is required to keep the cache updated.
+ *
+ * @param id
+ * The user id to load the thread-member from
+ *
+ * @throws IllegalArgumentException
+ * If the provided id is empty or null
+ * @throws NumberFormatException
+ * If the provided id is not a snowflake
+ *
+ * @return {@link RestAction} - Type: {@link ThreadMember}
+ */
+ @Nonnull
+ @CheckReturnValue
+ default RestAction retrieveThreadMemberById(@Nonnull String id)
+ {
+ return retrieveThreadMemberById(MiscUtil.parseSnowflake(id));
+ }
+
+ /**
+ * Load the thread-member for the user with the specified id.
+ *
If the thread-member is already loaded, it will be retrieved from {@link #getThreadMemberById(long)}
+ * and immediately provided if the thread-member information is consistent. If the bot hasn't joined the thread,
+ * {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GatewayIntent.GUILD_MEMBERS} is required to keep the cache updated.
+ *
+ * @param id
+ * The user id to load the thread-member from
+ *
+ * @return {@link RestAction} - Type: {@link ThreadMember}
+ */
+ @Nonnull
+ @CheckReturnValue
+ RestAction retrieveThreadMemberById(long id);
+
@CheckReturnValue
RestAction> retrieveThreadMembers();
diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ThreadChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/ThreadChannelImpl.java
index 71bdb8bcae..da8c1c6ada 100644
--- a/src/main/java/net/dv8tion/jda/internal/entities/ThreadChannelImpl.java
+++ b/src/main/java/net/dv8tion/jda/internal/entities/ThreadChannelImpl.java
@@ -23,22 +23,24 @@
import net.dv8tion.jda.api.utils.cache.CacheView;
import net.dv8tion.jda.api.utils.data.DataArray;
import net.dv8tion.jda.api.utils.data.DataObject;
+import net.dv8tion.jda.internal.JDAImpl;
import net.dv8tion.jda.internal.entities.mixin.channel.middleman.GuildMessageChannelMixin;
import net.dv8tion.jda.internal.managers.channel.concrete.ThreadChannelManagerImpl;
+import net.dv8tion.jda.internal.requests.DeferredRestAction;
import net.dv8tion.jda.internal.requests.RestActionImpl;
import net.dv8tion.jda.internal.requests.Route;
import net.dv8tion.jda.internal.utils.Checks;
import net.dv8tion.jda.internal.utils.Helpers;
-import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-public class ThreadChannelImpl extends AbstractGuildChannelImpl implements
- ThreadChannel,
+public class ThreadChannelImpl extends AbstractGuildChannelImpl implements
+ ThreadChannel,
GuildMessageChannelMixin
{
private final ChannelType type;
@@ -135,6 +137,21 @@ public ThreadMember getThreadMemberById(long id)
return threadMembers.get(id);
}
+ @Nonnull
+ @Override
+ public RestAction retrieveThreadMemberById(long id)
+ {
+ JDAImpl jda = (JDAImpl) getJDA();
+ return new DeferredRestAction<>(jda, ThreadMember.class,
+ () -> getThreadMemberById(id),
+ () -> {
+ Route.CompiledRoute route = Route.Channels.GET_THREAD_MEMBER.compile(getId(), Long.toUnsignedString(id));
+ return new RestActionImpl<>(jda, route, (resp, req) -> {
+ return jda.getEntityBuilder().createThreadMember(getGuild(), this, resp.getObject());
+ });
+ });
+ }
+
@Override
public RestAction> retrieveThreadMembers()
{