From 526a0cc778356f231fb27a24c3faa24f5f1e3293 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 10 May 2016 04:52:48 +0200 Subject: Add config option for NICK delay The time between two attempts to get the default nick can be configured. If the value is not an int, the bot will not attempt to get the default nick. --- alternativ_nick.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/alternativ_nick.py b/alternativ_nick.py index aae2435..9041f21 100644 --- a/alternativ_nick.py +++ b/alternativ_nick.py @@ -12,14 +12,18 @@ import threading # Duration to wait before trying to get the nick again (in seconds) -NICKLOOP_DELAY = 60 +DEFAULT_NICK_DELAY = 60 def _start_nickloop(phenny): + delay = getattr(phenny.config, 'nick_delay', DEFAULT_NICK_DELAY) + if not isinstance(delay, int): + return + def nickloop(): print >> sys.stderr, ('Trying to get: %s' % phenny.config.nick) phenny.write(('NICK', phenny.config.nick)) - threading.Timer(NICKLOOP_DELAY, nickloop).start() + threading.Timer(delay, nickloop).start() def _set_nick(wrapper, nick): -- cgit v1.2.3-1-g7c22