From bbc6a85e93c64ee3e0ee15233d78f6959de90930 Mon Sep 17 00:00:00 2001
From: anekos
Date: Sun, 19 Dec 2010 07:35:27 +0900
Subject: tw!findpeople 追加
---
twittperator.js | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/twittperator.js b/twittperator.js
index c3e2e40..8076d3c 100644
--- a/twittperator.js
+++ b/twittperator.js
@@ -28,7 +28,7 @@ let PLUGIN_INFO =
Twittperator
Twitter Client using OAuth and Streaming API
OAuth/StreamingAPI対応Twitterクライアント
- 1.11.3
+ 1.12.0
2.3
3.0
teramako
@@ -1529,7 +1529,9 @@ let PLUGIN_INFO =
Twittperator.echo("unfav: " + res.user.name + " " + res.text, true);
});
}, // }}}
-
+ searchUsers: function(word, callback) { // {{{
+ tw.jsonGet("users/search", { q: word }, callback);
+ } // }}}
}; // }}}
let Utils = { // {{{
anchorLink: function(str) { // {{{
@@ -1630,6 +1632,9 @@ let PLUGIN_INFO =
return (r && r.user.protected && r.user.screen_name) ? true : false;
}
}, // }}}
+ jsonGet: function(api, query, callback) { // {{{
+ tw.jsonGet(api, query, callback);
+ }, // }}}
loadPlugins: function() { // {{{
function isEnabled(file)
let (name = file.leafName.replace(/\..*/, "").replace(/-/g, "_"))
@@ -1803,6 +1808,26 @@ let PLUGIN_INFO =
}
});
}, // }}}
+ showUsersSeachResult: function(word) { // {{{
+ Twitter.searchUsers(word, function(res){
+ // フォーマットが違うので変換
+ function konbuArt(obj) {
+ return {
+ __proto__: obj.status,
+ user: {
+ __proto__: obj,
+ }
+ };
+ }
+
+ // TODO ユーザのリストが返ってきますが、タイムラインとして表示します。
+ if (res.length > 0) {
+ Twittperator.showTL(res.map(Utils.fixStatusObject).map(konbuArt));
+ } else {
+ Twittperator.echo("No results found.")
+ }
+ });
+ }, // }}}
sourceScriptFile: function(file) { // {{{
// XXX 悪い子向けのハックです。すみません。 *.tw ファイルを *.js のように読み込みます。
let script = liberator.plugins.contexts[file.path];
@@ -2087,6 +2112,11 @@ let PLUGIN_INFO =
timelineCompleter: false,
completer: Completers.id(function (it) it.in_reply_to_status_id)
}),
+ SubCommand({
+ command: ["findpeople"],
+ description: "Find people with the words.",
+ action: function(arg) Twittperator.showUsersSeachResult(arg),
+ }),
]; // }}}
function findSubCommand(s) { // {{{
--
cgit v1.2.3