diff options
Diffstat (limited to 'twittperator.js')
-rw-r--r-- | twittperator.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/twittperator.js b/twittperator.js index 66f5c0b..edf0d04 100644 --- a/twittperator.js +++ b/twittperator.js @@ -1439,6 +1439,9 @@ let PLUGIN_INFO = if (msg.text) Twittperator.onMessage(msg); + + if (msg.friends) + Twittperator.onFriends(msg); } function clearPluginData() { @@ -1637,6 +1640,9 @@ let PLUGIN_INFO = io.getRuntimeDirectories("plugin/twittperator").forEach(loadPluginFromDir(true)); io.getRuntimeDirectories("twittperator").forEach(loadPluginFromDir(false)); }, // }}} + onFriends: function(msg) { // {{{ + __context__.Friends = friends = msg.friends; + }, // }}} onMessage: function(msg) { // {{{ history.unshift(msg); if (history.length > setting.historyLimit) @@ -2230,7 +2236,12 @@ let PLUGIN_INFO = let arg = args.literalArg.slice(0, context.caret); let m; - if (m = arg.match(/(RT\s+)@.*$/)) { + if (m = arg.match(/^D\s+/)) { + context.title = ["Name#ID", "Entry"]; + context.advance(m[0].length); + Completers.name(rejectMine)(context, args); + return; + } else if (m = arg.match(/(RT\s+)@.*$/)) { (m.index === 0 ? Completers.name_id : Completers.name_id_text)(m.index === 0 && rejectMine)(context, args); } else if (m = tailMatch(/(^|\b|\s)#[^#\s]*$/, arg)) { @@ -2280,7 +2291,7 @@ let PLUGIN_INFO = (!lastTime || ((lastTime + setting.statusValidDuration * 1000) < now)); let completer = args.bang ? subCommandCompleter : commandCompelter; - let matches = args.bang || args.literalArg.match(/(RT\s+|)@|#/); + let matches = args.bang || args.literalArg.match(/(RT\s+|)@|#|^D\s+/); if (!matches) return; @@ -2331,6 +2342,10 @@ let PLUGIN_INFO = if (!history) history = __context__.Tweets = Store.get("history", []); + let friends = __context__.Friends; + if (!friends) + friends = __context__.Friends = Store.get("friends", []); + let tw = new TwitterOauth(Store); // ストリーム @@ -2351,7 +2366,7 @@ let PLUGIN_INFO = if (setting.useChirp){ if(setting.allReplies) ChirpUserStream.start({"replies":"all"}); - else + else ChirpUserStream.start(); } @@ -2361,6 +2376,7 @@ let PLUGIN_INFO = __context__.onUnload = function() { Store.set("history", history); + Store.set("friends", friends); ChirpUserStream.stop(); TrackingStream.stop(); }; |