Skip to content

Commit 74c2762

Browse files
anderswiftvaldotleadvaith1shaydewael
authored
document the poll result message and embed (#7050)
* document the poll result message and embed * fix redundant language Co-authored-by: val.le <[email protected]> * create a new section for embed fields by embed type * edit text * links * Update docs/resources/Message.md * Update docs/resources/Message.md * tables --------- Co-authored-by: val.le <[email protected]> Co-authored-by: Advaith Jagathesan <[email protected]> Co-authored-by: shay <[email protected]> Co-authored-by: Shay <[email protected]>
1 parent 330f1ce commit 74c2762

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

docs/resources/Message.md

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Represents a message sent in a channel within Discord.
104104
| GUILD_INCIDENT_REPORT_RAID | 38 | true |
105105
| GUILD_INCIDENT_REPORT_FALSE_ALARM | 39 | true |
106106
| PURCHASE_NOTIFICATION | 44 | true |
107+
| POLL_RESULT | 46 | true |
107108

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

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

349+
###### Poll result messages
350+
351+
- These are automatic messages sent after a poll has ended and the results have been finalized. (type 46)
352+
- 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.
353+
- The author will be the same as the author of the poll and will be mentioned.
354+
- These messages contain a [`poll_result` embed](#DOCS_RESOURCES_MESSAGE/embed-fields-by-embed-type-poll-result-embed-fields)
355+
348356
#### Voice Messages
349357

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

421429
###### Embed Types
422430

423-
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.
424-
425-
| Type | Description |
426-
|---------|----------------------------------------------------|
427-
| rich | generic embed rendered from embed attributes |
428-
| image | image embed |
429-
| video | video embed |
430-
| gifv | animated gif image embed rendered as a video embed |
431-
| article | article embed |
432-
| link | link embed |
431+
| Type | Description |
432+
|-------------|--------------------------------------------------------------------------------------------------|
433+
| rich | generic embed rendered from embed attributes |
434+
| image | image embed |
435+
| video | video embed |
436+
| gifv | animated gif image embed rendered as a video embed |
437+
| article | article embed |
438+
| link | link embed |
439+
| poll_result | [poll result embed](#DOCS_RESOURCES_MESSAGE/embed-fields-by-embed-type-poll-result-embed-fields) |
433440

434441
###### Embed Thumbnail Structure
435442

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

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

520+
#### Embed Fields by Embed Type
521+
522+
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.
523+
524+
###### Poll Result Embed Fields
525+
526+
| Field | Description |
527+
|-------------------------------|------------------------------------------------------------|
528+
| poll_question_text | question text from the original poll |
529+
| victor_answer_votes | number of votes for the answer(s) with the most votes |
530+
| total_votes | total number of votes in the poll |
531+
| victor_answer_id? | id for the winning answer |
532+
| victor_answer_text? | text for the winning answer |
533+
| victor_answer_emoji_id? | id for an emoji associated with the winning answer |
534+
| victor_answer_emoji_name? | name of an emoji associated with the winning answer |
535+
| victor_answer_emoji_animated? | if an emoji associated with the winning answer is animated |
536+
513537
### Attachment Object
514538

515539
###### Attachment Structure

0 commit comments

Comments
 (0)