From d37387c7ce5e4cd0a5fc14ac21ae69a87ab4e0ab Mon Sep 17 00:00:00 2001 From: jamesbt365 Date: Thu, 19 Dec 2024 00:21:50 +0000 Subject: [PATCH] Add newly_created bool to ThreadCreate event --- src/gateway/client/dispatch.rs | 1 + src/gateway/client/event_handler.rs | 4 ++-- src/model/event.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gateway/client/dispatch.rs b/src/gateway/client/dispatch.rs index ae16e8d04f0..ecb5408884a 100644 --- a/src/gateway/client/dispatch.rs +++ b/src/gateway/client/dispatch.rs @@ -420,6 +420,7 @@ fn update_cache_with_event( FullEvent::ThreadCreate { thread: event.thread, + newly_created: event.newly_created, } }, Event::ThreadUpdate(mut event) => { diff --git a/src/gateway/client/event_handler.rs b/src/gateway/client/event_handler.rs index fa5d61a050f..3a05e4ff6b3 100644 --- a/src/gateway/client/event_handler.rs +++ b/src/gateway/client/event_handler.rs @@ -411,8 +411,8 @@ event_handler! { /// Dispatched when a thread is created or the current user is added to a private thread. /// - /// Provides the thread. - ThreadCreate { thread: GuildChannel } => async fn thread_create(&self, ctx: Context); + /// Provides the thread and if the thread was newly created. + ThreadCreate { thread: GuildChannel, newly_created: Option } => async fn thread_create(&self, ctx: Context); /// Dispatched when a thread is updated. /// diff --git a/src/model/event.rs b/src/model/event.rs index afa7c4e5e00..29b25d072dd 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -861,10 +861,11 @@ pub struct StageInstanceDeleteEvent { /// [Discord docs](https://discord.com/developers/docs/topics/gateway-events#thread-create). #[cfg_attr(feature = "typesize", derive(typesize::derive::TypeSize))] #[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(transparent)] #[non_exhaustive] pub struct ThreadCreateEvent { + #[serde(flatten)] pub thread: GuildChannel, + pub newly_created: Option, } /// Requires [`GatewayIntents::GUILDS`].