Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document the poll result message and embed #7050

Merged
merged 8 commits into from
Aug 16, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions docs/resources/Message.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Represents a message sent in a channel within Discord.
| GUILD_INCIDENT_REPORT_RAID | 38 | true |
| GUILD_INCIDENT_REPORT_FALSE_ALARM | 39 | true |
| PURCHASE_NOTIFICATION | 44 | true |
| POLL_RESULT | 46 | true |

\* Can only be deleted by members with `MANAGE_MESSAGES` permission

Expand Down Expand Up @@ -345,6 +346,13 @@ There are multiple message types that have a `message_reference` object.
- These messages have `message_id`, `channel_id`, and `guild_id`.
- These messages will never have content, embeds, or attachments, mainly just the `message_reference` and `referenced_message` fields.

###### Poll result messages

- These are automatic messages sent after a poll has ended and the results have been finalized. (type 46)
- These messages have `message_id` and `channel_id`, which point to the original poll message. The `channel_id` will be the same as that of the poll.
- The author will be the same as the author of the poll and will be mentioned.
- These messages contain a [`poll_result` embed](#DOCS_RESOURCES_MESSAGE/embed-fields-by-embed-type-poll-result-embed-fields)

#### Voice Messages

Voice messages are messages with the `IS_VOICE_MESSAGE` flag. They have the following properties.
Expand Down Expand Up @@ -420,16 +428,15 @@ The reaction count details object contains a breakdown of normal and super react

###### Embed Types

Embed types are "loosely defined" and, for the most part, are not used by our clients for rendering. Embed attributes power what is rendered. Embed types should be considered deprecated and might be removed in a future API version.

| Type | Description |
|---------|----------------------------------------------------|
| rich | generic embed rendered from embed attributes |
| image | image embed |
| video | video embed |
| gifv | animated gif image embed rendered as a video embed |
| article | article embed |
| link | link embed |
| Type | Description |
|-------------|--------------------------------------------------------------------------------------------------|
| rich | generic embed rendered from embed attributes |
| image | image embed |
| video | video embed |
| gifv | animated gif image embed rendered as a video embed |
| article | article embed |
| link | link embed |
| poll_result | [poll result embed](#DOCS_RESOURCES_MESSAGE/embed-fields-by-embed-type-poll-result-embed-fields) |

###### Embed Thumbnail Structure

Expand Down Expand Up @@ -510,6 +517,23 @@ Additionally, the combined sum of characters in all `title`, `description`, `fie

Embeds are deduplicated by URL. If a message contains multiple embeds with the same URL, only the first is shown.

#### Embed Fields by Embed Type

Certain embed types are used to power special UIs. These embeds use [fields](#DOCS_RESOURCES_MESSAGE/embed-object-embed-field-structure) to include additional data in key-value pairs. Below is a reference of possible embed fields for each of the following embed types.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Certain embed types are used to power special UIs. These embeds use [fields](#DOCS_RESOURCES_MESSAGE/embed-object-embed-field-structure) to include additional data in key-value pairs. Below is a reference of possible embed fields for each of the following embed types.
Certain embed types are used to power special UIs. These embeds use [embed fields](#DOCS_RESOURCES_MESSAGE/embed-object-embed-field-structure) to include additional data in key-value pairs. Consequently, values will always be strings.
Below is a reference of possible embed fields for each of the following embed types.


###### Poll Result Embed Fields

| Embed Field Name | Embed Field Value Description |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a "parse as" (or something like that) column could be added to indicate what the value string will look like.
Additionally, a code sample would probably still help to visualize the explanation given above.

shaydewael marked this conversation as resolved.
Show resolved Hide resolved
|-------------------------------|------------------------------------------------------------|
| poll_question_text | the question text from the original poll |
| victor_answer_votes | number of votes for the answer(s) with the most votes |
| total_votes | total number of votes in the poll |
| victor_answer_id? | the id for the winning answer |
| victor_answer_text? | the text for the winning answer |
| victor_answer_emoji_id? | the id for an emoji associated with the winning answer |
| victor_answer_emoji_name? | the name of an emoji associated with the winning answer |
| victor_answer_emoji_animated? | if an emoji associated with the winning answer is animated |
shaydewael marked this conversation as resolved.
Show resolved Hide resolved

### Attachment Object

###### Attachment Structure
Expand Down