Skip to content

discohook.poll ​

Classes ​

Poll ​

discohook.poll.Poll

A poll object. Properties ​

question: Optional[:class:str] The question of the poll. answers: Optional[List[:class:PollAnswer]] The answers to the poll. expiry: Optional[:class:int] The expiry time of the poll. allow_multiselect: :class:bool Whether the poll allows multiple answers. layout: :class:PollLayoutType The layout of the poll.

Method Index ​

Methods ​

end ​

python
async end(self)

Ends the poll.

fetch_all_voters ​

python
async fetch_all_voters(self) -> Dict[int, List[discohook.user.User]]

Fetch all the answers of the poll. Returns ​

Dict[:class:int, List[:class:User]]

fetch_voters ​

python
async fetch_voters(self, answer_id: int, *, after: str | None = None, limit: int = 25) -> List[discohook.user.User]

Fetch the voters of an answer with pagination. Parameters ​

answer_id: :class:int The ID of the answer. after: Optional[:class:str] The ID of the last user fetched. limit: :class:int The number of users to fetch. Maximum is 100. Returns ​

List[:class:User]

PollAnswer ​

discohook.poll.PollAnswer

An answer to a poll. Properties ​

answer_id: :class:int The ID of the answer. poll_media: Optional[:class:PollMedia] The media of the answer.

Method Index ​

Methods ​

new ​

Create a new poll answer. Parameters ​

answer_id: :class:int The ID of the answer. media: Union[:class:str, :class:PollMedia] The media of the answer. Returns ​

:class:PollAnswer The newly created poll answer.

PollAnswerCount ​

discohook.poll.PollAnswerCount

Represents the count of an answer in a poll. Properties ​

answer_id: :class:int The ID of the answer. count: :class:int The count of the answer.

PollMedia ​

discohook.poll.PollMedia

The question of the poll. Only text is supported. Properties ​

text: Optional[:class:str] The text of the media. emoji: Optional[:class:PartialEmoji] The emoji of the media.