Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit a4d22b2

Browse files
Merge pull request #1269 from smashwilson/tweeter-crash
[tweeter] Don't crash when HUBOT_TWEETER_ACCOUNTS is unset.
2 parents a9b48f5 + a940223 commit a4d22b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/scripts/tweeter.coffee

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,17 @@ Twit = require "twit"
4040
config =
4141
consumer_key: process.env.HUBOT_TWITTER_CONSUMER_KEY
4242
consumer_secret: process.env.HUBOT_TWITTER_CONSUMER_SECRET
43-
accounts: JSON.parse(process.env.HUBOT_TWEETER_ACCOUNTS)
43+
accounts_json: process.env.HUBOT_TWEETER_ACCOUNTS
4444

4545
unless config.consumer_key
4646
console.log "Please set the HUBOT_TWITTER_CONSUMER_KEY environment variable."
4747
unless config.consumer_secret
4848
console.log "Please set the HUBOT_TWITTER_CONSUMER_SECRET environment variable."
49-
unless config.accounts
49+
unless config.accounts_json
5050
console.log "Please set the HUBOT_TWEETER_ACCOUNTS environment variable."
5151

52+
config.accounts = JSON.parse(config.accounts_json || "{}")
53+
5254
module.exports = (robot) ->
5355
robot.respond /tweet\@([^\s]+)$/i, (msg) ->
5456
msg.reply "You can't very well tweet an empty status, can ya?"

0 commit comments

Comments
 (0)