summaryrefslogtreecommitdiffstats
path: root/modules/admin.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 /modules/admin.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 'modules/admin.py')
-rw-r--r--modules/admin.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/modules/admin.py b/modules/admin.py
new file mode 100644
index 0000000..de2a7a7
--- /dev/null
+++ b/modules/admin.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+"""
+admin.py - Phenny Admin Module
+Copyright 2008, Sean B. Palmer, inamidst.com
+Licensed under the Eiffel Forum License 2.
+
+http://inamidst.com/phenny/
+"""
+
+def join(phenny, input):
+ # Can only be done in privmsg by an admin
+ if input.sender.startswith('#'): return
+ if input.admin:
+ phenny.write(['JOIN'], input.group(2))
+join.commands = ['join']
+join.priority = 'low'
+
+def part(phenny, input):
+ # Can only be done in privmsg by an admin
+ if input.sender.startswith('#'): return
+ if input.admin:
+ phenny.write(['PART'], input.group(2))
+part.commands = ['part']
+part.priority = 'low'
+
+def quit(phenny, input):
+ # Can only be done in privmsg by the owner
+ if input.sender.startswith('#'): return
+ if input.owner:
+ phenny.write(['QUIT'])
+ __import__('os')._exit(0)
+quit.commands = ['quit']
+quit.priority = 'low'
+
+def msg(phenny, input):
+ # Can only be done in privmsg by an admin
+ if input.sender.startswith('#'): return
+ if input.admin:
+ phenny.msg(input.group(2), input.group(3))
+msg.rule = (['msg'], r'(#\S+) (.*)')
+msg.priority = 'low'
+
+def me(phenny, input):
+ # Can only be done in privmsg by an admin
+ if input.sender.startswith('#'): return
+ if input.admin:
+ msg = '\x01ACTION %s\x01' % input.group(3)
+ phenny.msg(input.group(2), msg)
+me.rule = (['me'], r'(#\S+) (.*)')
+me.priority = 'low'
+
+if __name__ == '__main__':
+ print __doc__.strip()