diff options
author | iximeow <me@iximeow.net> | 2017-12-31 04:49:49 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2017-12-31 04:49:49 -0800 |
commit | 935c78ce7d2aaabca269d81cff3459cef1084fbc (patch) | |
tree | 9b4ade0ad1d036df2c5f50016720d48355f50e5e /src/tw | |
parent | 9979821629fc8943ad50b06e934a83a24b352a7f (diff) |
clean up DM support, add thing to send DMs
Diffstat (limited to 'src/tw')
-rw-r--r-- | src/tw/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
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( |