Browse Source

More documentation fixes

pull/10109/head
dolfies 3 years ago
parent
commit
7067d1f4de
  1. 23
      discord/client.py
  2. 2
      discord/http.py

23
discord/client.py

@ -25,7 +25,6 @@ DEALINGS IN THE SOFTWARE.
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
import datetime
import logging import logging
import sys import sys
import traceback import traceback
@ -66,7 +65,7 @@ from .voice_client import VoiceClient
from .http import HTTPClient from .http import HTTPClient
from .state import ConnectionState from .state import ConnectionState
from . import utils from . import utils
from .utils import MISSING, time_snowflake from .utils import MISSING
from .object import Object from .object import Object
from .backoff import ExponentialBackoff from .backoff import ExponentialBackoff
from .webhook import Webhook from .webhook import Webhook
@ -82,14 +81,14 @@ from .member import _ClientStatus
if TYPE_CHECKING: if TYPE_CHECKING:
from typing_extensions import Self from typing_extensions import Self
from types import TracebackType from types import TracebackType
from .types.guild import Guild as GuildPayload
from .guild import GuildChannel from .guild import GuildChannel
from .abc import PrivateChannel, GuildChannel, Snowflake, SnowflakeTime from .abc import PrivateChannel, GuildChannel, Snowflake
from .channel import DMChannel from .channel import DMChannel
from .message import Message from .message import Message
from .member import Member from .member import Member
from .relationship import Relationship from .relationship import Relationship
from .voice_client import VoiceProtocol from .voice_client import VoiceProtocol
from .types.snowflake import Snowflake as _Snowflake
# fmt: off # fmt: off
__all__ = ( __all__ = (
@ -2125,6 +2124,8 @@ class Client:
Retrieves a list of :class:`Note` objects representing all your notes. Retrieves a list of :class:`Note` objects representing all your notes.
.. versionadded:: 1.9
Raises Raises
------- -------
HTTPException HTTPException
@ -2144,6 +2145,8 @@ class Client:
Retrieves a :class:`Note` for the specified user ID. Retrieves a :class:`Note` for the specified user ID.
.. versionadded:: 1.9
Parameters Parameters
----------- -----------
user_id: :class:`int` user_id: :class:`int`
@ -2168,6 +2171,8 @@ class Client:
Retrieves all of your connections. Retrieves all of your connections.
.. versionadded:: 2.0
Raises Raises
------- -------
HTTPException HTTPException
@ -2187,6 +2192,8 @@ class Client:
Retrieves all your private channels. Retrieves all your private channels.
.. versionadded:: 2.0
Raises Raises
------- -------
HTTPException HTTPException
@ -2229,16 +2236,18 @@ class Client:
data = await state.http.start_private_message(user.id) data = await state.http.start_private_message(user.id)
return state.add_dm_channel(data) return state.add_dm_channel(data)
async def create_group(self, *recipients) -> GroupChannel: async def create_group(self, *recipients: Snowflake) -> GroupChannel:
r"""|coro| r"""|coro|
Creates a group direct message with the recipients Creates a group direct message with the recipients
provided. These recipients must be have a relationship provided. These recipients must be have a relationship
of type :attr:`RelationshipType.friend`. of type :attr:`RelationshipType.friend`.
.. versionadded:: 2.0
Parameters Parameters
----------- -----------
\*recipients: :class:`User` \*recipients: :class:`~abc.Snowflake`
An argument :class:`list` of :class:`User` to have in An argument :class:`list` of :class:`User` to have in
your group. your group.
@ -2252,7 +2261,7 @@ class Client:
:class:`.GroupChannel` :class:`.GroupChannel`
The new group channel. The new group channel.
""" """
users = [u.id for u in recipients] users: List[_Snowflake] = [u.id for u in recipients]
state = self._connection state = self._connection
data = await state.http.start_group(users) 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 return GroupChannel(me=self.user, data=data, state=state) # type: ignore - user is always present when logged in

2
discord/http.py

@ -634,7 +634,7 @@ class HTTPClient:
# PM functionality # PM functionality
def start_group(self, recipients: SnowflakeList) -> Response[channel.GroupDMChannel]: def start_group(self, recipients: List[Snowflake]) -> Response[channel.GroupDMChannel]:
payload = { payload = {
'recipients': recipients, 'recipients': recipients,
} }

Loading…
Cancel
Save