fn on_event(&mut self, cli: &RtmClient, event: Event) {
        match event {
            Event::Message(msg) => {
                let (text, channel_id) = match *msg {
                    Message::Standard(MessageStandard {
                        ref text,
                        ref channel,
                        ..
                    }) => (text.as_ref().unwrap(), channel.as_ref().unwrap()),
                    _ => {
                        println!("could not get text and channel");
                        return;
                    }
                };

                for tag in &self.giphy_keywords {
                    if text.to_lowercase().contains(tag) {
                        match get_giph(&self.giphy_api_key, tag) {
                            Some(giph) => {
                                let _ = cli.sender().send_message(&channel_id, giph.as_str());
                                break;
                            }
                            None => println!("could not get gif"),
                        }
                    }
                }
            }
            _ => println!("on_event(event: {:?})", event),
        };
    }
/// Handles every `slack::Event` and takes appropreate action for each event.
///
/// # Arguments
///
/// * `cli` - The Slack RtmClient
///
/// * `event` - The event from Slack
Handles every `slack::Event` and takes appropreate action for each event.
Handles every ` slack :: Event ` and takes appropreate action for each event .
fn on_event(&mut self, cli: &RtmClient, event: Event) {
        match event {
            Event::Message(msg) => {
                let (text, channel_id) = match *msg {
                    Message::Standard(MessageStandard {
                        ref text,
                        ref channel,
                        ..
                    }) => (text.as_ref().unwrap(), channel.as_ref().unwrap()),
                    _ => {
                        println!("could not get text and channel");
                        return;
                    }
                };
                for tag in &self.giphy_keywords {
                    if text.to_lowercase().contains(tag) {
                        match get_giph(&self.giphy_api_key, tag) {
                            Some(giph) => {
                                let _ = cli.sender().send_message(&channel_id, giph.as_str());
                                break;
                            }
                            None => println!("could not get gif"),
                        }
                    }
                }
            }
            _ => println!("on_event(event: {:?})", event),
        };
    }
fn on_event ( & mut self , cli : & RtmClient , event : Event ) { match event { Event :: Message ( msg ) => { let ( text , channel_id ) = match * msg { Message :: Standard ( MessageStandard { ref text , ref channel , .. } ) => ( text . as_ref ( ) . unwrap ( ) , channel . as_ref ( ) . unwrap ( ) ) , _ => { println ! ( " " ) ; return ; } } ; for tag in & self . giphy_keywords { if text . to_lowercase ( ) . contains ( tag ) { match get_giph ( & self . giphy_api_key , tag ) { Some ( giph ) => { let _ = cli . sender ( ) . send_message ( & channel_id , giph . as_str ( ) ) ; break ; } None => println ! ( " " ) , } } } } _ => println ! ( " " event ) , } ; }
Handles every `slack::Event` and takes appropreate action for each event.
Handles every ` slack :: Event ` and takes appropreate action for each event .
&mut self
cli
&RtmClient
event
Event
&mut self
cli
&RtmClient
event
Event