diff --git a/src/main/java/net/dv8tion/jda/api/entities/Message.java b/src/main/java/net/dv8tion/jda/api/entities/Message.java
index 1c513dfcfc..127eef6e38 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/Message.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java
@@ -360,6 +360,25 @@ default Message getReferencedMessage()
@Nullable
Member getMember();
+ /**
+ * Returns the approximate position of this message in a {@link ThreadChannel}.
+ *
This can be used to estimate the relative position of a message in a thread, by comparing against {@link ThreadChannel#getTotalMessageCount()}.
+ *
+ *
Notes: + *
position
property on the message object
+ */
+ int getApproximatePosition();
+
/**
* Returns the jump-to URL for the received message. Clicking this URL in the Discord client will cause the client to
* jump to the specified message.
diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java
index 2aade7038c..f267f73ba2 100644
--- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java
+++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java
@@ -159,6 +159,13 @@ public Member getMember()
return null;
}
+ @Override
+ public int getApproximatePosition()
+ {
+ unsupported();
+ return 0;
+ }
+
@Nonnull
@Override
public String getJumpUrl()
diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java
index 70ae322447..450c427ca4 100644
--- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java
+++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java
@@ -1751,15 +1751,17 @@ else if (MISSING_CHANNEL.equals(ex.getMessage()))
if (guild != null && !jsonObject.isNull("thread"))
startedThread = createThreadChannel(guild, jsonObject.getObject("thread"), guild.getIdLong());
+ int position = jsonObject.getInt("position", -1);
+
if (!type.isSystem())
{
return new ReceivedMessage(id, channel, type, messageReference, fromWebhook, applicationId, tts, pinned,
- content, nonce, user, member, activity, editTime, mentions, reactions, attachments, embeds, stickers, components, flags, messageInteraction, startedThread);
+ content, nonce, user, member, activity, editTime, mentions, reactions, attachments, embeds, stickers, components, flags, messageInteraction, startedThread, position);
}
else
{
return new SystemMessage(id, channel, type, messageReference, fromWebhook, applicationId, tts, pinned,
- content, nonce, user, member, activity, editTime, mentions, reactions, attachments, embeds, stickers, flags, startedThread);
+ content, nonce, user, member, activity, editTime, mentions, reactions, attachments, embeds, stickers, flags, startedThread, position);
}
}
diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
index 83c7bb52eb..ffacef8177 100644
--- a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
+++ b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
@@ -88,6 +88,7 @@ public class ReceivedMessage extends AbstractMessage
protected final int flags;
protected final Message.Interaction interaction;
protected final ThreadChannel startedThread;
+ protected final int position;
// LAZY EVALUATED
protected String altContent = null;
@@ -101,7 +102,7 @@ public ReceivedMessage(
String content, String nonce, User author, Member member, MessageActivity activity, OffsetDateTime editTime,
Mentions mentions, List