discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Clarify `referenced_message` is partial

Open davfsa opened this issue 2 years ago • 0 comments

  • Fix "Gateway documentation" link to point to more relevant area

Example:

Full message
{
    "type": 19,
    "tts": false,
    "timestamp": "2022-06-19T08:20:23.598000+00:00",
    "referenced_message": {
        "type": 19,
        "tts": false,
        "timestamp": "2022-06-19T08:20:18.241000+00:00",
        "pinned": false,
        "message_reference": {
            "message_id": "987995189564018688",
            "guild_id": "569855591489470485",
            "channel_id": "654355510669344798"
        },
        "mentions": [],
        "mention_roles": [],
        "mention_everyone": false,
        "id": "987995227254054952",
        "flags": 0,
        "embeds": [],
        "edited_timestamp": null,
        "content": "B",
        "components": [],
        "channel_id": "654355510669344798",
        "author": {
            "username": "davfsa",
            "public_flags": 131328,
            "id": "377812572784820226",
            "discriminator": "7026",
            "avatar_decoration": null,
            "avatar": "3e8f79240c38e0cb5df3caf6bdde567d"
        },
        "attachments": []
    },
    "pinned": false,
    "nonce": "987995248808427520",
    "message_reference": {
        "message_id": "987995227254054952",
        "guild_id": "569855591489470485",
        "channel_id": "654355510669344798"
    },
    "mentions": [],
    "mention_roles": [],
    "mention_everyone": false,
    "member": {
        "roles": [
            "812612829215195177",
            "607255251405242378",
            "674972763231879179",
            "655342655399657482",
            "643166676560379916",
            "812612371137691668"
        ],
        "premium_since": null,
        "pending": false,
        "nick": "a",
        "mute": false,
        "joined_at": "2019-04-22T12:02:40.472000+00:00",
        "flags": 0,
        "deaf": false,
        "communication_disabled_until": null,
        "avatar": null
    },
    "id": "987995249722941491",
    "flags": 0,
    "embeds": [],
    "edited_timestamp": null,
    "content": "C",
    "components": [],
    "channel_id": "654355510669344798",
    "author": {
        "username": "davfsa",
        "public_flags": 131328,
        "id": "377812572784820226",
        "discriminator": "7026",
        "avatar_decoration": null,
        "avatar": "3e8f79240c38e0cb5df3caf6bdde567d"
    },
    "attachments": [],
    "guild_id": "569855591489470485"
}

Extracted `referenced_message`
{
    "type": 19,
    "tts": false,
    "timestamp": "2022-06-19T08:20:18.241000+00:00",
    "pinned": false,
    "message_reference": {
        "message_id": "987995189564018688",
        "guild_id": "569855591489470485",
        "channel_id": "654355510669344798"
    },
    "mentions": [],
    "mention_roles": [],
    "mention_everyone": false,
    "id": "987995227254054952",
    "flags": 0,
    "embeds": [],
    "edited_timestamp": null,
    "content": "B",
    "components": [],
    "channel_id": "654355510669344798",
    "author": {
        "username": "davfsa",
        "public_flags": 131328,
        "id": "377812572784820226",
        "discriminator": "7026",
        "avatar_decoration": null,
        "avatar": "3e8f79240c38e0cb5df3caf6bdde567d"
    },
    "attachments": []
}

davfsa avatar Jun 19 '22 08:06 davfsa

I don't think it's true that this is a partial object—all of the required fields look like they're there and when I'm looking at the types in the codebase, referenced_message's type is no different than a regular message object.

shaydewael avatar Sep 15 '22 20:09 shaydewael

I don't think it's true that this is a partial object—all of the required fields look like they're there and when I'm looking at the types in the codebase, referenced_message's type is no different than a regular message object.

It is in fact a partial object, as not all the information is provided. An example of this is the reference message missing guild_id and member, even tho the message is clearly sent in a guild (notice the guild_id in the reply message). The aim of this PR is just to make it clear that not all fields are provided, as one would expect in, for example, a MESSAGE_CREATE

davfsa avatar Sep 17 '22 13:09 davfsa

While fixing conflicts I realized that the missing fields are considered to be GUILD_CREATE/GUILD_UPDATE specific fields only.

davfsa avatar Sep 17 '22 13:09 davfsa