From 41176889d80d4fc7ff92d7edf21cbb27db476862 Mon Sep 17 00:00:00 2001 From: dolfies Date: Tue, 4 Mar 2025 00:29:55 -0500 Subject: [PATCH] Add webhook_channels() to UserGuild --- discord/client.py | 3 +-- discord/guild.py | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/discord/client.py b/discord/client.py index 79ad2be20f8d..94e9a20326db 100644 --- a/discord/client.py +++ b/discord/client.py @@ -1881,8 +1881,7 @@ async def change_voice_state( self_deaf: :class:`bool` Indicates if the client should be self-deafened. self_video: :class:`bool` - Indicates if the client is using video. Untested & unconfirmed - (do not use). + Indicates if the client is using video. Do not use. """ state = self._connection ws = self.ws diff --git a/discord/guild.py b/discord/guild.py index addf5e30740c..741345e32547 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -282,6 +282,27 @@ def is_joined(self) -> bool: """ return True + async def webhook_channels(self) -> List[PartialMessageable]: + """|coro| + + Retrieves the channels that the current user can create webhooks in for the guild. + + .. versionadded:: 2.1 + + Raises + ------- + HTTPException + Retrieving the webhook channels failed. + + Returns + -------- + List[ :class:`PartialMessageable`] + The channels that the current user can create webhooks in. Any :class:`PartialMessageable` will have its :attr:`PartialMessageable.name` filled in. + """ + state = self._state + data = await state.http.get_guild_webhook_channels(self.id) + return [PartialMessageable._from_webhook_channel(self, c) for c in data] + async def leave(self) -> None: """|coro| @@ -5232,7 +5253,6 @@ async def change_voice_state( self_mute: bool = False, self_deaf: bool = False, self_video: bool = False, - preferred_region: Optional[str] = MISSING, ) -> None: """|coro| @@ -5253,8 +5273,7 @@ async def change_voice_state( self_deaf: :class:`bool` Indicates if the client should be self-deafened. self_video: :class:`bool` - Indicates if the client is using video. Untested & unconfirmed - (do not use). + Indicates if the client is using video. Do not use. """ state = self._state ws = state.ws