From 9d979d3df1ada4a9b745894ed6ba3b587cb1b307 Mon Sep 17 00:00:00 2001 From: DA344 <108473820+DA-344@users.noreply.github.com> Date: Wed, 15 May 2024 19:38:19 +0200 Subject: [PATCH] Some docs fixes for polls --- discord/interactions.py | 4 ++++ discord/poll.py | 6 +++--- docs/api.rst | 21 +++++++++++++-------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/discord/interactions.py b/discord/interactions.py index 5702e8b8d..5d9d2a680 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -807,6 +807,10 @@ class InteractionResponse(Generic[ClientT]): then it is silently ignored. .. versionadded:: 2.1 + poll: :class:`~discord.Poll` + The poll to send with this message. + + .. versionadded:: 2.4 Raises ------- diff --git a/discord/poll.py b/discord/poll.py index 0d8e90366..b8f036aec 100644 --- a/discord/poll.py +++ b/discord/poll.py @@ -202,7 +202,7 @@ class PollAnswer: @property def poll(self) -> Poll: - """:class:`Poll`: Returns the parent poll of this answer""" + """:class:`Poll`: Returns the parent poll of this answer.""" return self._poll def _to_dict(self) -> PollAnswerPayload: @@ -310,7 +310,7 @@ class Poll: The duration of the poll. Duration must be in hours. multiple: :class:`bool` Whether users are allowed to select more than one answer. - Defaultsto ``False``. + Defaults to ``False``. layout_type: :class:`PollLayoutType` The layout type of the poll. Defaults to :attr:`PollLayoutType.default`. """ @@ -431,7 +431,7 @@ class Poll: @property def answers(self) -> List[PollAnswer]: - """List[:class:`PollAnswer`]: Returns a read-only copy of the answers""" + """List[:class:`PollAnswer`]: Returns a read-only copy of the answers.""" return list(self._answers.values()) @property diff --git a/docs/api.rst b/docs/api.rst index 13b49df5b..e8a00b7e4 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -3615,7 +3615,7 @@ of :class:`enum.Enum`. .. class:: PollLayoutType - Represents how a poll answers are shown + Represents how a poll answers are shown. .. versionadded:: 2.4 @@ -5077,6 +5077,14 @@ PartialWebhookChannel .. autoclass:: PartialWebhookChannel() :members: +PollAnswer +~~~~~~~~~~ + +.. attributetable:: PollAnswer + +.. autoclass:: PollAnswer() + :members: + .. _discord_api_data: Data Classes @@ -5347,18 +5355,15 @@ Poll .. attributetable:: Poll -.. autoclass:: Poll() +.. autoclass:: Poll :members: -.. attributetable:: PollAnswer - -.. autoclass:: PollAnswer() - :members: - :inherited-members: +PollMedia +~~~~~~~~~ .. attributetable:: PollMedia -.. autoclass:: PollMedia() +.. autoclass:: PollMedia :members: