Skip to content

Commit

Permalink
use /n to seperate tweets
Browse files Browse the repository at this point in the history
  • Loading branch information
MathildeLemee committed Oct 28, 2011
1 parent 0b257a5 commit a51615b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/hubot/scripts/help.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
# help - Displays all of the help commands that Hubot knows about.

module.exports = (robot) ->
robot.hear /help$/i, (msg) ->
robot.helpCommands().forEach (str) =>
msg.send str
robot.respond /help$/i, (msg) ->
msg.send robot.helpCommands().join("\n")

14 changes: 8 additions & 6 deletions src/hubot/twitter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ secret=process.env.HUBOT_TWITTER_SECRET
token=process.env.HUBOT_TWITTER_TOKEN
tokensecret=process.env.HUBOT_TWITTER_TOKEN_SECRET


consumer = new oauth.OAuth("https://twitter.com/oauth/request_token", "https://twitter.com/oauth/access_token",key, secret, "1.0", "", "HMAC-SHA1");


class Twitter extends Robot
send: (user, strings...) ->
strings.forEach (str) =>
text= str
console.log "send twitt to #{user} with text #{text}"
consumer.post "https://api.twitter.com/1/statuses/update.json", token,tokensecret,{status:'@'+user+' '+text},'UTF-8', (error, data, response) ->
if error
console.log "twitter send error: #{error} #{data}"
console.log "Status #{response.statusCode}"
console.log text
tweetsText = str.split('\n')
tweetsText.forEach (tweetText) =>
console.log "send twitt to #{user} with text #{tweetText}"
consumer.post "https://api.twitter.com/1/statuses/update.json", token,tokensecret,{status:'@'+user+' '+tweetText},'UTF-8', (error, data, response) ->
if error
console.log "twitter send error: #{error} #{data}"
console.log "Status #{response.statusCode}"


reply: (user, strings...) ->
Expand Down
2 changes: 0 additions & 2 deletions src/robot.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ class Robot.Brain extends EventEmitter
mergeData: (data) ->
for k of (data or { })
@data[k] = data[k]

@emit 'loaded', @data

class Robot.Message
# Represents an incoming message from the chat.
Expand Down

0 comments on commit a51615b

Please sign in to comment.