-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
984 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/** | ||
* Types extracted from https://discord.com/developers/docs/resources/poll | ||
*/ | ||
|
||
import type { APIPartialEmoji } from './emoji.ts'; | ||
|
||
/** | ||
* https://discord.com/developers/docs/resources/poll#poll-object-poll-object-structure | ||
*/ | ||
export interface APIPoll { | ||
/** | ||
* The question of the poll | ||
*/ | ||
question: APIPollMedia; | ||
/** | ||
* Each of the answers available in the poll, up to 10 | ||
*/ | ||
answers: APIPollAnswer[]; | ||
/** | ||
* The time when the poll ends (IS08601 timestamp) | ||
*/ | ||
expiry: string; | ||
/** | ||
* Whether a user can select multiple answers | ||
*/ | ||
allow_multiselect: boolean; | ||
/** | ||
* The layout type of the poll | ||
*/ | ||
layout_type: PollLayoutType; | ||
/** | ||
* The results of the poll | ||
*/ | ||
results?: APIPollResults; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/resources/poll#layout-type | ||
*/ | ||
export enum PollLayoutType { | ||
/** | ||
* The, uhm, default layout type | ||
*/ | ||
Default = 1, | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/resources/poll#poll-media-object-poll-media-object-structure | ||
*/ | ||
export interface APIPollMedia { | ||
/** | ||
* The text of the field | ||
* | ||
* The maximum length is `300` for the question, and `55` for any answer | ||
*/ | ||
text?: string; | ||
/** | ||
* The emoji of the field | ||
*/ | ||
emoji?: APIPartialEmoji; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/resources/poll#poll-answer-object-poll-answer-object-structure | ||
*/ | ||
export interface APIPollAnswer { | ||
/** | ||
* The ID of the answer. Starts at `1` for the first answer and goes up sequentially | ||
*/ | ||
answer_id: number; | ||
/** | ||
* The data of the answer | ||
*/ | ||
media: APIPollMedia; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/resources/poll#poll-results-object-poll-results-object-structure | ||
*/ | ||
export interface APIPollResults { | ||
/** | ||
* Whether the votes have been precisely counted | ||
*/ | ||
is_finalized: boolean; | ||
/** | ||
* The counts for each answer | ||
*/ | ||
answer_counts: APIPollAnswerCount[]; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/resources/poll#poll-results-object-poll-answer-count-object-structure | ||
*/ | ||
export interface APIPollAnswerCount { | ||
/** | ||
* The `answer_id` | ||
*/ | ||
id: number; | ||
/** | ||
* The number of votes for this answer | ||
*/ | ||
count: number; | ||
/** | ||
* Whether the current user voted for this answer | ||
*/ | ||
me_voted: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.