aboutsummaryrefslogtreecommitdiff
path: root/src/tw
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2017-12-31 04:54:17 -0800
committerGitHub <noreply@github.com>2017-12-31 04:54:17 -0800
commit0668cdd7d5e800d8c7e8b1c0853f8b747179356f (patch)
tree9b4ade0ad1d036df2c5f50016720d48355f50e5e /src/tw
parent9979821629fc8943ad50b06e934a83a24b352a7f (diff)
parent935c78ce7d2aaabca269d81cff3459cef1084fbc (diff)
Merge pull request #5 from iximeow/dm-fixup
clean up DM support, add thing to send DMs
Diffstat (limited to 'src/tw')
-rw-r--r--src/tw/mod.rs8
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(