referenced_message
appears inconsistently for type 6
(CHANNEL_PINNED_MESSAGE) system messages
#2255
Labels
referenced_message
appears inconsistently for type 6
(CHANNEL_PINNED_MESSAGE) system messages
#2255
Description
Hi there. It was noted over in #2252 and in #2053 that
message_reference
would appear for messages of types6
(CHANNEL_PINNED_MESSAGE) and12
(CHANNEL_FOLLOW_ADD). I had also noted that type6
messages would include areferenced_message
field, with the data of the message being pinned (except when the message had been deleted).Talking with @advaith1 right after my PR was submitted, we found an additional quirk with type
6
messages: They will only have areferenced_message
field if the message being referenced is also being returned.To elaborate: If you are pulling down a channel's message history, and one of the message is a message of type
6
(CHANNEL_PINNED_MESSAGE), it will only include areferenced_message
field if the message being referenced is also being returned as part of the history that you requested. If it is not part of the history being returned, the API will not bother to fetch the message. This also means that if the system message is being returned through the Get Channel Message endpoint, the system message will not include areferenced_message
field. Examples of this weirdness can be found here, under the files marked 1 and 2 in the TOC.This is in stark contrast to reply-type messages (type
19
), as they will always include thereferenced_message
field, even if the message would not otherwise be returned, and even if it is from several years back. You can see this in the files marked 3, 4, and 5 in the gist linked above.This is an oddity as the
referenced_message
field only appears for type6
messages in the exact situations where you wouldn't need it -- but in other situations, it requires a separate Get Channel Message request in order to see what the pinned message was.Steps to Reproduce
referenced_message
field.referenced_message
field.referenced_message
field.Expected Behavior
I would expect type
6
messages to include areferenced_message
field at all times (except when the message is deleted).Current Behavior
Type
6
messages will only include areferenced_message
field if the message being referenced was also loaded and returned separately -- the exact situation where you wouldn't need thereferenced_message
field.Screenshots/Videos
https://gist.github.com/LikeLakers2/a10f6f7883947576eb734b6efa570b02
Client and System Information
N/A, though the above info was found using v8 of the REST API.
The text was updated successfully, but these errors were encountered: