Skip to content

Commit

Permalink
Add newly_created bool to ThreadCreate event
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbt365 committed Dec 19, 2024
1 parent 18d9582 commit d37387c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/gateway/client/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ fn update_cache_with_event(

FullEvent::ThreadCreate {
thread: event.thread,
newly_created: event.newly_created,
}
},
Event::ThreadUpdate(mut event) => {
Expand Down
4 changes: 2 additions & 2 deletions src/gateway/client/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> } => async fn thread_create(&self, ctx: Context);

/// Dispatched when a thread is updated.
///
Expand Down
3 changes: 2 additions & 1 deletion src/model/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>,
}

/// Requires [`GatewayIntents::GUILDS`].
Expand Down

0 comments on commit d37387c

Please sign in to comment.