From 14d37fa0b7c1fc79309db27a18eb95c6c5e14bf6 Mon Sep 17 00:00:00 2001 From: dolfies Date: Sun, 19 Jan 2025 20:19:28 -0500 Subject: [PATCH] Allow creating gdms with one user --- discord/client.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/discord/client.py b/discord/client.py index f07bc21ba..922093ae8 100644 --- a/discord/client.py +++ b/discord/client.py @@ -3147,13 +3147,10 @@ class Client: ----------- \*recipients: :class:`~discord.abc.Snowflake` An argument :class:`list` of :class:`discord.User` to have in - your group. Groups cannot be created with only one person, - but they can be created with zero people. + your group. Raises ------- - TypeError - Only one recipient was given. HTTPException Failed to create the group direct message. @@ -3162,11 +3159,13 @@ class Client: :class:`.GroupChannel` The new group channel. """ - if len(recipients) == 1: - raise TypeError('Cannot create a group with only one recipient') + state = self._connection users: List[_Snowflake] = [u.id for u in recipients] - state = self._connection + if len(users) == 1: + # To create a group DM with one user, the client user must be included + users.append(state.self_id) # type: ignore # user is always present when logged in + 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