Skip to content

Commit b72b1cc

Browse files
authored
Add newly_created bool field to the ThreadCreate event (#3084)
https://discord.com/developers/docs/events/gateway-events#thread-create
1 parent 18d9582 commit b72b1cc

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/gateway/client/dispatch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ fn update_cache_with_event(
420420

421421
FullEvent::ThreadCreate {
422422
thread: event.thread,
423+
newly_created: event.newly_created,
423424
}
424425
},
425426
Event::ThreadUpdate(mut event) => {

src/gateway/client/event_handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,8 @@ event_handler! {
411411

412412
/// Dispatched when a thread is created or the current user is added to a private thread.
413413
///
414-
/// Provides the thread.
415-
ThreadCreate { thread: GuildChannel } => async fn thread_create(&self, ctx: Context);
414+
/// Provides the thread and if the thread was newly created.
415+
ThreadCreate { thread: GuildChannel, newly_created: Option<bool> } => async fn thread_create(&self, ctx: Context);
416416

417417
/// Dispatched when a thread is updated.
418418
///

src/model/event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,10 +861,11 @@ pub struct StageInstanceDeleteEvent {
861861
/// [Discord docs](https://discord.com/developers/docs/topics/gateway-events#thread-create).
862862
#[cfg_attr(feature = "typesize", derive(typesize::derive::TypeSize))]
863863
#[derive(Clone, Debug, Deserialize, Serialize)]
864-
#[serde(transparent)]
865864
#[non_exhaustive]
866865
pub struct ThreadCreateEvent {
866+
#[serde(flatten)]
867867
pub thread: GuildChannel,
868+
pub newly_created: Option<bool>,
868869
}
869870

870871
/// Requires [`GatewayIntents::GUILDS`].

0 commit comments

Comments
 (0)