From a8b4eb1e9b9bd83dedce6b23f055ca02a0b59aae Mon Sep 17 00:00:00 2001 From: dolfies Date: Mon, 24 Feb 2025 05:07:21 -0500 Subject: [PATCH] Create ScheduledEvent on cache miss in SCHEDULED_EVENT_DELETE --- discord/state.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/discord/state.py b/discord/state.py index c4b71b368..0fbeadea2 100644 --- a/discord/state.py +++ b/discord/state.py @@ -1553,12 +1553,8 @@ class ConnectionState(Generic[ClientT]): def parse_guild_scheduled_event_delete(self, data: gw.GuildScheduledEventDeleteEvent) -> None: guild = self._get_guild(int(data['guild_id'])) if guild is not None: - try: - scheduled_event = guild._scheduled_events.pop(int(data['id'])) - except KeyError: - pass - else: - self.dispatch('scheduled_event_delete', scheduled_event) + scheduled_event = guild._scheduled_events.pop(int(data['id']), ScheduledEvent(state=self, data=data)) + self.dispatch('scheduled_event_delete', scheduled_event) else: _log.debug('SCHEDULED_EVENT_DELETE referencing unknown guild ID: %s. Discarding.', data['guild_id'])