Trait slack::EventHandler
[−]
[src]
pub trait EventHandler { fn on_event(&mut self, cli: &mut RtmClient, event: Result<&Event, Error>, raw_json: &str); fn on_ping(&mut self, cli: &mut RtmClient); fn on_close(&mut self, cli: &mut RtmClient); fn on_connect(&mut self, cli: &mut RtmClient); }
Implement this trait in your code to handle message events
Required Methods
fn on_event(&mut self, cli: &mut RtmClient, event: Result<&Event, Error>, raw_json: &str)
When a message is received this will be called with self, the slack client, and the result of parsing the event received, as well as the raw json string.
fn on_ping(&mut self, cli: &mut RtmClient)
Called when a ping is received; you do NOT need to handle the reply pong, but you may use this event to track the connection as a keep-alive.
fn on_close(&mut self, cli: &mut RtmClient)
Called when the connection is closed for any reason.
fn on_connect(&mut self, cli: &mut RtmClient)
Called when the connection is opened.