From 781981f333345482e93ed35453e98e519bb7cc5e Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 2 Oct 2017 01:27:08 -0700 Subject: move everything to src/ --- src/commands/look_up.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/commands/look_up.rs (limited to 'src/commands/look_up.rs') diff --git a/src/commands/look_up.rs b/src/commands/look_up.rs new file mode 100644 index 0000000..d04f984 --- /dev/null +++ b/src/commands/look_up.rs @@ -0,0 +1,32 @@ +use tw; +use ::Queryer; + +use commands::Command; + +pub static LOOK_UP_USER: Command = Command { + keyword: "look_up_user", + params: 1, + exec: look_up_user +}; + +fn look_up_user(line: String, tweeter: &mut tw::TwitterCache, mut queryer: &mut Queryer) { + if let Some(user) = tweeter.fetch_user(&line, &mut queryer) { + println!("{:?}", user); + } else { +// println!("Couldn't retrieve {}", userid); + } +} + +pub static LOOK_UP_TWEET: Command = Command { + keyword: "look_up_tweet", + params: 1, + exec: look_up_tweet +}; + +fn look_up_tweet(line: String, tweeter: &mut tw::TwitterCache, mut queryer: &mut Queryer) { + if let Some(tweet) = tweeter.fetch_tweet(&line, &mut queryer) { + println!("{:?}", tweet); + } else { +// println!("Couldn't retrieve {}", tweetid); + } +} -- cgit v1.1