From 7067d1f4de8a10ab918326055aa38333f747ed9d Mon Sep 17 00:00:00 2001 From: dolfies Date: Sat, 2 Apr 2022 12:20:38 -0400 Subject: [PATCH] More documentation fixes --- discord/client.py | 23 ++++++++++++++++------- discord/http.py | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/discord/client.py b/discord/client.py index 1ffd7571e..03b936fbe 100644 --- a/discord/client.py +++ b/discord/client.py @@ -25,7 +25,6 @@ DEALINGS IN THE SOFTWARE. from __future__ import annotations import asyncio -import datetime import logging import sys import traceback @@ -66,7 +65,7 @@ from .voice_client import VoiceClient from .http import HTTPClient from .state import ConnectionState from . import utils -from .utils import MISSING, time_snowflake +from .utils import MISSING from .object import Object from .backoff import ExponentialBackoff from .webhook import Webhook @@ -82,14 +81,14 @@ from .member import _ClientStatus if TYPE_CHECKING: from typing_extensions import Self from types import TracebackType - from .types.guild import Guild as GuildPayload from .guild import GuildChannel - from .abc import PrivateChannel, GuildChannel, Snowflake, SnowflakeTime + from .abc import PrivateChannel, GuildChannel, Snowflake from .channel import DMChannel from .message import Message from .member import Member from .relationship import Relationship from .voice_client import VoiceProtocol + from .types.snowflake import Snowflake as _Snowflake # fmt: off __all__ = ( @@ -2125,6 +2124,8 @@ class Client: Retrieves a list of :class:`Note` objects representing all your notes. + .. versionadded:: 1.9 + Raises ------- HTTPException @@ -2144,6 +2145,8 @@ class Client: Retrieves a :class:`Note` for the specified user ID. + .. versionadded:: 1.9 + Parameters ----------- user_id: :class:`int` @@ -2168,6 +2171,8 @@ class Client: Retrieves all of your connections. + .. versionadded:: 2.0 + Raises ------- HTTPException @@ -2187,6 +2192,8 @@ class Client: Retrieves all your private channels. + .. versionadded:: 2.0 + Raises ------- HTTPException @@ -2229,16 +2236,18 @@ class Client: data = await state.http.start_private_message(user.id) return state.add_dm_channel(data) - async def create_group(self, *recipients) -> GroupChannel: + async def create_group(self, *recipients: Snowflake) -> GroupChannel: r"""|coro| Creates a group direct message with the recipients provided. These recipients must be have a relationship of type :attr:`RelationshipType.friend`. + .. versionadded:: 2.0 + Parameters ----------- - \*recipients: :class:`User` + \*recipients: :class:`~abc.Snowflake` An argument :class:`list` of :class:`User` to have in your group. @@ -2252,7 +2261,7 @@ class Client: :class:`.GroupChannel` The new group channel. """ - users = [u.id for u in recipients] + users: List[_Snowflake] = [u.id for u in recipients] state = self._connection data = await state.http.start_group(users) return GroupChannel(me=self.user, data=data, state=state) # type: ignore - user is always present when logged in diff --git a/discord/http.py b/discord/http.py index 74c052547..107f12728 100644 --- a/discord/http.py +++ b/discord/http.py @@ -634,7 +634,7 @@ class HTTPClient: # PM functionality - def start_group(self, recipients: SnowflakeList) -> Response[channel.GroupDMChannel]: + def start_group(self, recipients: List[Snowflake]) -> Response[channel.GroupDMChannel]: payload = { 'recipients': recipients, }