From 3cba110d58d252d43d9ca38eba262e93641e1e96 Mon Sep 17 00:00:00 2001 From: mAxYoLo01 Date: Sat, 19 Aug 2023 10:44:05 +0200 Subject: [PATCH] feat: add Guild.fetch_all_webhooks --- interactions/models/discord/guild.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/interactions/models/discord/guild.py b/interactions/models/discord/guild.py index cc605bdc9..5551f2bf7 100644 --- a/interactions/models/discord/guild.py +++ b/interactions/models/discord/guild.py @@ -12,7 +12,11 @@ from interactions.client.const import MISSING, PREMIUM_GUILD_LIMITS, Absent from interactions.client.errors import EventLocationNotProvided, NotFound from interactions.client.mixins.serialization import DictSerializationMixin -from interactions.client.utils.attr_converters import optional, list_converter, timestamp_converter +from interactions.client.utils.attr_converters import ( + list_converter, + optional, + timestamp_converter, +) from interactions.client.utils.attr_utils import docs from interactions.client.utils.deserialise_app_cmds import deserialize_app_cmds from interactions.client.utils.serializer import no_export_meta, to_image_data @@ -33,6 +37,7 @@ DefaultNotificationLevel, ExplicitContentFilterLevel, ForumLayoutType, + ForumSortOrder, IntegrationExpireBehaviour, MFALevel, NSFWLevel, @@ -41,7 +46,6 @@ ScheduledEventType, SystemChannelFlags, VerificationLevel, - ForumSortOrder, ) from .snowflake import ( Snowflake_Type, @@ -1399,6 +1403,17 @@ async def fetch_custom_sticker(self, sticker_id: Snowflake_Type) -> Optional["mo return None return models.Sticker.from_dict(sticker_data, self._client) + async def fetch_all_webhooks(self) -> List["models.Webhook"]: + """ + Fetches all the webhooks for this guild. + + Returns: + A list of webhook objects. + + """ + webhooks_data = await self._client.http.get_guild_webhooks(self.id) + return models.Webhook.from_list(webhooks_data, self._client) + async def fetch_active_threads(self) -> "models.ThreadList": """ Fetches all active threads in the guild, including public and private threads. Threads are ordered by their id, in descending order.