Skip to content

Commit

Permalink
Improve cached's name and documentation (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakelezz authored and arqunis committed Jun 3, 2019
1 parent 6586830 commit 7706475
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/client/dispatch.rs
Expand Up @@ -478,7 +478,7 @@ fn handle_event<H: EventHandler + Send + Sync + 'static>(
let event_handler = Arc::clone(event_handler);

threadpool.execute(move || {
event_handler.cached(context, guild_amount);
event_handler.cache_ready(context, guild_amount);
});
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/client/event_handler.rs
Expand Up @@ -10,11 +10,16 @@ use crate::client::bridge::gateway::event::*;

/// The core trait for handling events by serenity.
pub trait EventHandler {
/// Dispatched when the cache gets full.
/// Dispatched when the cache has received and inserted all data from
/// guilds.
///
/// This process happens upon starting your bot and should be fairly quick.
/// However, cache actions performed prior this event may fail as the data
/// could be not inserted yet.
///
/// Provides the cached guilds' ids.
#[cfg(feature = "cache")]
fn cached(&self, _ctx: Context, _guilds: Vec<GuildId>) {}
fn cache_ready(&self, _ctx: Context, _guilds: Vec<GuildId>) {}

/// Dispatched when a channel is created.
///
Expand Down

0 comments on commit 7706475

Please sign in to comment.