summaryrefslogtreecommitdiffstats
path: root/__init__.py
diff options
context:
space:
mode:
authorSean B. Palmer <http://inamidst.com/sbp/>2008-02-21 12:06:33 +0000
committerSean B. Palmer <http://inamidst.com/sbp/>2008-02-21 12:06:33 +0000
commit7931fab14599b739c18c8f1ebcc24b75688dbc09 (patch)
treebf4df9757f10c155e3b6f78aed48f15884ebbbe6 /__init__.py
downloadbot-7931fab14599b739c18c8f1ebcc24b75688dbc09.tar.gz
bot-7931fab14599b739c18c8f1ebcc24b75688dbc09.tar.bz2
bot-7931fab14599b739c18c8f1ebcc24b75688dbc09.zip
Phenny2, now being tested on Freenode as the main phenny.
Diffstat (limited to '__init__.py')
-rw-r--r--__init__.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..8137683
--- /dev/null
+++ b/__init__.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+"""
+__init__.py - Phenny Init Module
+Copyright 2008, Sean B. Palmer, inamidst.com
+Licensed under the Eiffel Forum License 2.
+
+http://inamidst.com/phenny/
+"""
+
+import sys, time, threading
+import bot
+
+def run_phenny(config):
+ if hasattr(config, 'delay'):
+ delay = config.delay
+ else: delay = 20
+
+ def connect(config):
+ p = bot.Phenny(config)
+ p.run(config.host)
+
+ while True:
+ connect(config)
+ if not isinstance(delay, int): break
+
+ warning = 'Warning: Disconnected. Reconnecting in %s seconds...' % delay
+ print >> sys.stderr, warning
+ time.sleep(delay)
+
+def run(config):
+ t = threading.Thread(target=run_phenny, args=(config,))
+ t.start()
+
+if __name__ == '__main__':
+ print __doc__