Skip to content

feat: Provide Guild ID in GuildLeft event #1435

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
Jun 2, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions interactions/api/events/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def on_guild_join(event):
from interactions.api.events.base import GuildEvent, BaseEvent
from interactions.client.const import Absent
from interactions.client.utils.attr_utils import docs
from interactions.models.discord.snowflake import to_snowflake

__all__ = (
"ApplicationCommandPermissionsUpdate",
Expand Down Expand Up @@ -292,6 +293,9 @@ class GuildUpdate(BaseEvent):
class GuildLeft(BaseEvent):
"""Dispatched when a guild is left."""

guild_id: "Snowflake_Type" = attrs.field(repr=True, converter=to_snowflake)
"""The ID of the guild"""

guild: "Guild" = attrs.field(repr=True)
"""The guild this event is dispatched from"""

Expand Down
2 changes: 1 addition & 1 deletion interactions/api/events/processors/guild_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def _on_raw_guild_delete(self, event: "RawGatewayEvent") -> None:
guild = self.cache.get_guild(guild_id)
self.cache.delete_guild(guild_id)

self.dispatch(events.GuildLeft(guild))
self.dispatch(events.GuildLeft(guild_id, guild))

@Processor.define()
async def _on_raw_guild_ban_add(self, event: "RawGatewayEvent") -> None:
Expand Down