Skip to content

Non-thread messages have unexpected position in responses from Edit Message #7570

@shayypy

Description

@shayypy

Description

I use the position attribute to determine whether a message is in a thread without knowledge of its parent channel type; if a value exists, it's a thread message. However, I discovered today that after editing a message, Discord will incorrectly populate the value with 0.

This issue occurs when editing bot messages as well as webhook messages, but I encountered it using webhooks (and it is more salient for my use case since webhook message endpoints require knowledge of threadhood)

Steps to Reproduce

  1. Send a webhook message in a non-thread channel:
curl --request POST \
  --url 'https://discord.com/api/v10/webhooks/{id}/{token}?wait=true' \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: insomnia/11.1.0' \
  --data '{"content":"test"}'
  1. Observe that position is not present in the response
  2. Update the message:
curl --request PATCH \
  --url 'https://discord.com/api/v10/webhooks/{id}/{token}/messages/{message_id}' \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: insomnia/11.1.0' \
  --data '{"content":"new content"}'
  1. Observe position in the response:
{
	"content": "new content",
	// [...]
	"position": 0
}
  1. Fetch the message again:
curl --request GET \
  --url 'https://discord.com/api/v10/webhooks/{id}/{token}/messages/{message_id}' \
  --header 'User-Agent: insomnia/11.1.0'
  1. Observe that position is not present in the response

Expected Behavior

position should not be present in any message that is not in a thread

Current Behavior

position is included for a non-thread message

Screenshots/Videos

No response

Client and System Information

Used Insomnia 11.1.0 to generate cURL samples for this issue, but I discovered this while using the discordjs/rest package

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions