From 935c78ce7d2aaabca269d81cff3459cef1084fbc Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 31 Dec 2017 04:49:49 -0800 Subject: clean up DM support, add thing to send DMs --- src/tw/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/tw/mod.rs') diff --git a/src/tw/mod.rs b/src/tw/mod.rs index 2eb574f..9a14b11 100644 --- a/src/tw/mod.rs +++ b/src/tw/mod.rs @@ -1200,8 +1200,12 @@ fn handle_twitter_dm( display_info: &mut DisplayInfo, _queryer: &mut ::Queryer) { // show DM - display_info.recv(display::Infos::Text(vec![format!("{:?}", structure)])); - display_info.recv(display::Infos::DM(structure["direct_message"]["text"].as_str().unwrap().to_string())); + tweeter.cache_api_user(structure["direct_message"]["recipient"].clone()); + tweeter.cache_api_user(structure["direct_message"]["sender"].clone()); + let dm_text = structure["direct_message"]["text"].as_str().unwrap().to_string(); + let to = structure["direct_message"]["recipient_id_str"].as_str().unwrap().to_string(); + let from = structure["direct_message"]["sender_id_str"].as_str().unwrap().to_string(); + display_info.recv(display::Infos::DM(dm_text, from, to)); } fn handle_twitter_welcome( -- cgit v1.1