Skip to content

Commit

Permalink
Considerations for private bots
Browse files Browse the repository at this point in the history
If I run my bot in a public place, like freenode, I want to be able to control exactly what rooms it joins.

Just walking into any room someone invites him into and talking with strangers is bad :)
  • Loading branch information
joshbetz committed Mar 10, 2013
1 parent 9468c79 commit 378fc4c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/irc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ class IrcBot extends Adapter

bot.addListener 'pm', (nick, message) ->
console.log('Got private message from %s: %s', nick, message)

if process.env.HUBOT_IRC_PRIVATE
return

nameLength = options.nick.length
if message.slice(0, nameLength).toLowerCase() != options.nick.toLowerCase()
Expand All @@ -209,7 +212,9 @@ class IrcBot extends Adapter

bot.addListener 'invite', (channel, from) ->
console.log('%s invite you to join %s', from, channel)
bot.join channel

if not process.env.HUBOT_IRC_PRIVATE
bot.join channel

@bot = bot

Expand Down

0 comments on commit 378fc4c

Please sign in to comment.