Skip to content

Commit

Permalink
Add webhook_channels() to UserGuild
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfies committed Mar 4, 2025
1 parent e6e3ad1 commit 4117688
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
3 changes: 1 addition & 2 deletions discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 22 additions & 3 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Check failure on line 304 in discord/guild.py

View workflow job for this annotation

GitHub Actions / check

Argument of type "Self@UserGuild" cannot be assigned to parameter "guild" of type "Guild" in function "_from_webhook_channel"   "UserGuild" is incompatible with "Guild" (reportGeneralTypeIssues)

async def leave(self) -> None:
"""|coro|
Expand Down Expand Up @@ -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|
Expand All @@ -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
Expand Down

0 comments on commit 4117688

Please sign in to comment.