summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2016-05-10 04:52:48 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2016-05-10 04:52:48 +0200
commit526a0cc778356f231fb27a24c3faa24f5f1e3293 (patch)
tree09b9dd0ed3abce7aa0143bf2c0f1b432e42ecc5b
parentfed5397b774fdb77fcb2afd564f7e956cabd78e5 (diff)
downloadalternative-nick-526a0cc778356f231fb27a24c3faa24f5f1e3293.tar.gz
alternative-nick-526a0cc778356f231fb27a24c3faa24f5f1e3293.tar.bz2
alternative-nick-526a0cc778356f231fb27a24c3faa24f5f1e3293.zip
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.
-rw-r--r--alternativ_nick.py8
1 files 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):