Add events to Twitter node

to close #126
Thanks @ukmoose
(sorry had to do it manually)
This commit is contained in:
Dave Conway-Jones
2016-11-12 11:43:25 +00:00
parent a9d669411c
commit 1bfda975ef
5 changed files with 78 additions and 5 deletions

View File

@@ -90,6 +90,7 @@
<option value="true" data-i18n="twitter.search.follow"></option>
<option value="user" data-i18n="twitter.search.user"></option>
<option value="dm" data-i18n="twitter.search.direct"></option>
<option value="event" data-i18n="twitter.search.events"></option>
</select>
</div>
<div class="form-row" id="node-input-tags-row">
@@ -109,12 +110,17 @@
<li>all the tweets from accounts that the authenticated user follows</li>
<li>all tweets by specified users</li>
<li>direct messages received by the authenticated user</li>
<li>twitter events for the authenticated user</li>
</ul></p>
<p>Use space for <i>and</i> and comma , for <i>or</i> when searching for multiple terms.
If you want to pass in the search term(s) via the <code>msg.payload</code>, leave the <b>for</b> field blank.</p>
<p>Sets the <code>msg.topic</code> to <i>tweets/</i> and then appends the senders screen name.</p>
<p>Sets <code>msg.location</code> to the tweeters location if known.</p>
<p>Sets <code>msg.tweet</code> to the full tweet object as documented by <a href="https://dev.twitter.com/overview/api/tweets">Twitter</a>.
<p>When returning events it sets the <code>msg.payload</code> to the twitter event, a full list is documented by
<a href="https://dev.twitter.com/streaming/overview/messages-types#Events_event" target="_new">Twitter</a>.</p>
<p>Sets <code>msg.tweet</code> to the full tweet object as documented by <a href="https://dev.twitter.com/overview/api/tweets" target="_new">Twitter</a>.
<p><b>Note</b>: This node is not connected to the FireHose, so will not return 100% of all tweets to a busy @id or #hashtag.</p>
<p><b>Note:</b> when set to follow specific users, or your direct messages, the node is subject to
the rate limiting of the Twitter API. If you deploy the flows multiple times within a 15 minute window, you may
exceed the limit and will see errors from the node. These errors will clear automatically when the current 15
@@ -143,6 +149,9 @@
var uname = RED.nodes.node(this.twitter);
if (this.user == "dm") {
return (uname?uname.label()+" ":"")+this._("twitter.label.dmslabel");
} else if (this.user == "event") {
var user = RED.nodes.node(this.twitter);
return (user?user.label()+" ":"")+this._("twitter.label.eventslabel");
} else if (this.user == "user") {
return this.tags+" "+this._("twitter.label.tweetslabel");
}
@@ -165,7 +174,7 @@
$("#node-input-tags-row").show();
$("#node-input-tags-label").html(userlabel);
$("#node-input-tags").attr("placeholder",userph);
} else if ((type == "dm")||(type == "true")) {
} else if ((type == "dm")||(type == "true")||(type == "event")) {
$("#node-input-tags-row").hide();
} else {
$("#node-input-tags-row").show();