diff options
Diffstat (limited to 'twittperator.js')
-rwxr-xr-x | twittperator.js | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/twittperator.js b/twittperator.js index 65bbee7..52f9107 100755 --- a/twittperator.js +++ b/twittperator.js @@ -1454,35 +1454,14 @@ let PLUGIN_INFO = }); } }, // }}} - say: function(stat) { // {{{ - let sendData = {}; - let prefix, replyUser, replyID, postfix; - if (stat.match(/^(.*)@(\w{1,15})#(\d+)(.*)$/)) { - [prefix, replyUser, replyID, postfix] = [RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$4]; - if (stat.indexOf("RT @" + replyUser + "#" + replyID) == 0) { - Twittperator.withProtectedUserConfirmation( - { screenName: replyUser, statusId: replyID }, - "retweet", - function() Twitter.retweet(replyID) - ); - return; - } - stat = prefix + "@" + replyUser + postfix; - if (replyID && !prefix) - sendData.in_reply_to_status_id = replyID; - } - Twittperator.withProtectedUserConfirmation( - { screenName: replyUser, statusId: replyID }, - "reply", - function() { - sendData.status = stat; - sendData.source = "Twittperator"; - tw.post("statuses/update.json", sendData, function(text) { - let t = Utils.fixStatusObject(JSON.parse(text || "{}")).text; - Twittperator.echo("Your post " + '"' + t + '" (' + t.length + " characters) was sent."); - }); - } - ); + say: function(status, inReplyToStatusId) { // {{{ + let sendData = {status: status, source: "Twittperator"}; + if (inReplyToStatusId) + sendData.in_reply_to_status_id = inReplyToStatusId; + tw.post("statuses/update.json", sendData, function(text) { + let t = Utils.fixStatusObject(JSON.parse(text || "{}")).text; + Twittperator.echo("Your post " + '"' + t + '" (' + t.length + " characters) was sent."); + }); }, // }}} retweet: function(id) { // {{{ let url = "statuses/retweet/" + id + ".json"; @@ -1603,6 +1582,29 @@ let PLUGIN_INFO = map(function(ss) (ss.reverse(), ss.map(String.trim))) Twittperator.selectAndOpenLink(links); }, // }}} + say: function(stat) { // {{{ + let sendData = {}; + let prefix, replyUser, replyID, postfix; + if (stat.match(/^(.*)@(\w{1,15})#(\d+)(.*)$/)) { + [prefix, replyUser, replyID, postfix] = [RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$4]; + if (stat.indexOf("RT @" + replyUser + "#" + replyID) == 0) { + Twittperator.withProtectedUserConfirmation( + { screenName: replyUser, statusId: replyID }, + "retweet", + function() Twitter.retweet(replyID) + ); + return; + } + stat = prefix + "@" + replyUser + postfix; + if (replyID && !prefix) + sendData.in_reply_to_status_id = replyID; + } + Twittperator.withProtectedUserConfirmation( + { screenName: replyUser, statusId: replyID }, + "reply", + function() Twitter.say(stat, replyID) + ); + }, // }}} selectAndOpenLink: function(links) { // {{{ if (!links || !links.length) return; @@ -2000,7 +2002,7 @@ let PLUGIN_INFO = if (arg.length === 0) Twittperator.showFollowersStatus(); else - Twitter.say(arg); + Twittperator.say(arg); } }, { bang: true, |