Skip to content

Commit c9f43c0

Browse files
authored
feat: add Guild.fetch_all_webhooks (#1534)
1 parent 0945662 commit c9f43c0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

interactions/models/discord/guild.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
from interactions.client.const import MISSING, PREMIUM_GUILD_LIMITS, Absent
1313
from interactions.client.errors import EventLocationNotProvided, NotFound
1414
from interactions.client.mixins.serialization import DictSerializationMixin
15-
from interactions.client.utils.attr_converters import optional, list_converter, timestamp_converter
15+
from interactions.client.utils.attr_converters import (
16+
list_converter,
17+
optional,
18+
timestamp_converter,
19+
)
1620
from interactions.client.utils.attr_utils import docs
1721
from interactions.client.utils.deserialise_app_cmds import deserialize_app_cmds
1822
from interactions.client.utils.serializer import no_export_meta, to_image_data
@@ -33,6 +37,7 @@
3337
DefaultNotificationLevel,
3438
ExplicitContentFilterLevel,
3539
ForumLayoutType,
40+
ForumSortOrder,
3641
IntegrationExpireBehaviour,
3742
MFALevel,
3843
NSFWLevel,
@@ -41,7 +46,6 @@
4146
ScheduledEventType,
4247
SystemChannelFlags,
4348
VerificationLevel,
44-
ForumSortOrder,
4549
)
4650
from .snowflake import (
4751
Snowflake_Type,
@@ -1399,6 +1403,17 @@ async def fetch_custom_sticker(self, sticker_id: Snowflake_Type) -> Optional["mo
13991403
return None
14001404
return models.Sticker.from_dict(sticker_data, self._client)
14011405

1406+
async def fetch_all_webhooks(self) -> List["models.Webhook"]:
1407+
"""
1408+
Fetches all the webhooks for this guild.
1409+
1410+
Returns:
1411+
A list of webhook objects.
1412+
1413+
"""
1414+
webhooks_data = await self._client.http.get_guild_webhooks(self.id)
1415+
return models.Webhook.from_list(webhooks_data, self._client)
1416+
14021417
async def fetch_active_threads(self) -> "models.ThreadList":
14031418
"""
14041419
Fetches all active threads in the guild, including public and private threads. Threads are ordered by their id, in descending order.

0 commit comments

Comments
 (0)