diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/nickrecover.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/data/rbot/plugins/nickrecover.rb b/data/rbot/plugins/nickrecover.rb index 02def493..ed3c8708 100644 --- a/data/rbot/plugins/nickrecover.rb +++ b/data/rbot/plugins/nickrecover.rb @@ -52,17 +52,25 @@ class NickRecoverPlugin < Plugin end def stop_recovery - @bot.timer.remove(@recovery) if @recovery + begin + @bot.timer.remove(@recovery) if @recovery + ensure + @recovery = nil + end end def start_recovery(time=self.poll_time) if @recovery - @bot.timer.reschedule(@recovery, poll_time) - else - @recovery = @bot.timer.add(time) do - has_nick? ? stop_recovery : recover + begin + @bot.timer.reschedule(@recovery, poll_time) + return + rescue + @recovery=nil end end + @recovery = @bot.timer.add(time) do + has_nick? ? stop_recovery : recover + end end def initialize |