Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

No longer using the adapter directly to send message

  • Loading branch information...
commit ca6d957f984bef2e8b14c715ab6e734953f78ac8 1 parent e85bde9
@sachinr sachinr authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/scripts/twitter_mention.coffee
View
10 src/scripts/twitter_mention.coffee
@@ -17,7 +17,9 @@
module.exports = (robot) ->
response = new robot.Response(robot)
+ room = process.env.HUBOT_TWITTER_MENTION_ROOM
robot.brain.data.twitter_mention ?= {}
+
setInterval ->
last_tweet = robot.brain.data.twitter_mention.last_tweet || ''
@@ -29,11 +31,10 @@ module.exports = (robot) ->
if tweets.results? and tweets.results.length > 0
robot.brain.data.twitter_mention.last_tweet = tweets.results[0].id_str
for tweet in tweets.results.reverse()
- sendMessage robot, "http://twitter.com/#!/#{tweet.from_user}/status/#{tweet.id_str}"
-
+ message = "http://twitter.com/#!/#{tweet.from_user}/status/#{tweet.id_str}"
+ robot.messageRoom room, message
, 1000 * 60 * 5
-
robot.respond /(set twitter query) (.*)/i, (msg) ->
robot.brain.data.twitter_mention.query = msg.match[2]
robot.brain.data.twitter_mention.last_tweet = ''
@@ -45,6 +46,3 @@ module.exports = (robot) ->
twitter_query = (robot) ->
robot.brain.data.twitter_mention.query ||
process.env.HUBOT_TWITTER_MENTION_QUERY
-
-sendMessage = (robot, str) ->
- robot.adapter.send({room: process.env.HUBOT_TWITTER_MENTION_ROOM}, str )
Please sign in to comment.
Something went wrong with that request. Please try again.