]> jfr.im git - erebus.git/commitdiff
Putting header on files
authorzonidjan <redacted>
Tue, 17 Dec 2013 10:22:15 +0000 (04:22 -0600)
committerzonidjan <redacted>
Tue, 17 Dec 2013 10:22:15 +0000 (04:22 -0600)
bot.py
config.py
ctlmod.py
erebus.py
modlib.py
modules/eval.py
modules/modtest.py
run.sh

diff --git a/bot.py b/bot.py
index 513f25722284543c144f4a80c13c76085c3b0fad..68cd8aeb0416522f2f78b6c40ef865d711c86b1e 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -1,5 +1,8 @@
 #!/usr/bin/python
 
+# Erebus IRC bot - Author: John Runyon
+# "Bot" and "BotConnection" classes (handling a specific "arm")
+
 #TODO: error checking
 
 import socket, sys
@@ -15,7 +18,8 @@ class Bot(object):
 
                self.conn = BotConnection(self, bind, server, port)
        def connect(self):
-               if self.conn.connect():
+               
+if self.conn.connect():
                        self.parent.newfd(self, self.conn.socket.fileno())
 
        def getdata(self):
index d274509e39b1e9f5d0f68360f997e119e05ddb33..92b08cb077877c5c17149960bebc66d432ba2b0f 100644 (file)
--- a/config.py
+++ b/config.py
@@ -1,3 +1,6 @@
+# Erebus IRC bot - Author: John Runyon
+# "Config" class (reading/providing access to bot.config)
+
 import ConfigParser
 
 class Config(object):
index 25046aad38b0823ea098a3e6eac18844f8c2933b..24dd236cfb1b3fccdca99e4e2a01efbd58398637 100644 (file)
--- a/ctlmod.py
+++ b/ctlmod.py
@@ -1,3 +1,6 @@
+# Erebus IRC bot - Author: John Runyon
+# module loading/unloading/tracking code
+
 import sys
 import modlib
 
index c75183ca31fe6a5239b7d6c6723a41e01e982b84..2c489f62ce74ee90f312821c2bea6e990aa19679 100644 (file)
--- a/erebus.py
+++ b/erebus.py
@@ -1,5 +1,8 @@
 #!/usr/bin/python
 
+# Erebus IRC bot - Author: John Runyon
+# main startup code
+
 #TODO: tons
 
 import os, sys, select, MySQLdb, MySQLdb.cursors
index 323ef0222579ce7bcfbcd1f363b37c60a2b17f16..8ad040677fe0510eea1926dd97b8161538bf51b4 100644 (file)
--- a/modlib.py
+++ b/modlib.py
@@ -1,3 +1,7 @@
+# Erebus IRC bot - Author: John Runyon
+# module helper functions, see modules/modtest.py for usage
+# This file is released into the public domain; see http://unlicense.org/
+
 class error(object):
        def __init__(self, desc):
                self.errormsg = desc
@@ -9,6 +13,13 @@ class error(object):
                return self.errormsg
 
 class modlib(object):
+       #access levels
+       MANAGER = 3
+       ADMIN = 2
+       STAFF = 1
+       AUTHED = 0
+       ANYONE = -1
+
        def __init__(self, name):
                self.hooks = {}
                self.parent = None
index ff65ceabcb6fc1655896450e409e0978cb7ff1c4..830600c3ebcd9338f51b8f5b1ec6bfd9751e8a59 100644 (file)
@@ -1,3 +1,6 @@
+# Erebus IRC bot - Author: John Runyon
+# !EVAL and !EXEC commands
+
 # module info
 modinfo = {
        'author': 'John Runyon (DimeCadmium)',
@@ -16,14 +19,14 @@ modstop = lib.modstop
 import sys
 
 
-@lib.hook('eval')
+@lib.hook('eval', lib.MANAGER)
 def cmd_eval(bot, user, chan, *args):
        try: ret = eval(' '.join(args))
        except: bot.msg(chan, "Error (%s): %s" % (sys.exc_info()[0], sys.exc_info()[1]))
        else: bot.msg(chan, "Done: %r" % (ret))
 
 
-@lib.hook('exec')
+@lib.hook('exec', lib.MANAGER)
 def cmd_exec(bot, user, chan, *args):
        try: exec ' '.join(args)
        except: bot.msg(chan, "Error: %s %s" % (sys.exc_info()[0], sys.exc_info()[1]))
index 75417e3f521b910c7b2db14db9165c6b9978001f..9ae5258460e25d2268bac1e5aaf4da7ba3e6042b 100644 (file)
@@ -1,3 +1,7 @@
+# Erebus IRC bot - Author: John Runyon
+# simple module example
+# This file is released into the public domain; see http://unlicense.org/
+
 # module info
 modinfo = {
        'author': 'John Runyon (DimeCadmium)',
diff --git a/run.sh b/run.sh
index ebf02420bb40ef77ac34539f8de1531b2f95fab1..b3e885e1e1e967a1a11c753426d18fc3e14709e3 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -1,3 +1,6 @@
 #!/bin/sh
 
+# Erebus IRC bot - Author: John Runyon
+# Startup script
+
 python -B "$(dirname $(readlink -f $0))/erebus.py"