Skip to content

Commit

Permalink
fix unflood options parse
Browse files Browse the repository at this point in the history
  • Loading branch information
pgolm committed Jun 28, 2013
1 parent 54bcfa3 commit d5ad864
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/irc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ class IrcBot extends Adapter
throw new Error("HUBOT_IRC_SERVER is not defined: try: export HUBOT_IRC_SERVER='irc.myserver.com'")

unfloodProtection: (unflood) ->
if unflood? then unflood else unflood == null
if unflood? and (unflood == 'true' or !isNaN(parseInt(unflood))) then true else false

unfloodProtectionDelay: (unflood) ->
switch @unfloodProtection(unflood)
when true then 1000
when true then (if !isNaN(parseInt(unflood)) then parseInt(unflood) else 1000)
when false then 0
else parseInt(unflood / 60)

run: ->
self = @
Expand Down

0 comments on commit d5ad864

Please sign in to comment.