Skip to content

Commit

Permalink
Provide old thread data in thread_update (#2553)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbt365 authored Oct 7, 2023
1 parent 012b051 commit c7d6918
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/client/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,12 @@ fn update_cache_with_event(ctx: Context, event: Event) -> Option<(FullEvent, Opt
}
},
Event::ThreadUpdate(mut event) => {
update_cache(&ctx, &mut event);
let old = if_cache!(update_cache(&ctx, &mut event));

FullEvent::ThreadUpdate {
ctx,
thread: event.thread,
old,
new: event.thread,
}
},
Event::ThreadDelete(mut event) => {
Expand Down
4 changes: 2 additions & 2 deletions src/client/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ event_handler! {

/// Dispatched when a thread is updated.
///
/// Provides the updated thread.
async fn thread_update(&self, ThreadUpdate { ctx: Context, thread: GuildChannel });
/// Provides the updated thread and the old thread data, provided the thread was cached prior to dispatch.
async fn thread_update(&self, ThreadUpdate { ctx: Context, old: Option<GuildChannel>, new: GuildChannel });

/// Dispatched when a thread is deleted.
///
Expand Down

0 comments on commit c7d6918

Please sign in to comment.