Skip to content

feat: add additional webhook functions #1534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions interactions/models/discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,6 +37,7 @@
DefaultNotificationLevel,
ExplicitContentFilterLevel,
ForumLayoutType,
ForumSortOrder,
IntegrationExpireBehaviour,
MFALevel,
NSFWLevel,
Expand All @@ -41,7 +46,6 @@
ScheduledEventType,
SystemChannelFlags,
VerificationLevel,
ForumSortOrder,
)
from .snowflake import (
Snowflake_Type,
Expand Down Expand Up @@ -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.
Expand Down