Permalink
Browse files

Hose the old module API

  • Loading branch information...
1 parent 0c4db32 commit 741f065924c2acfed736b46495e3af6283fb5b04 @richo richo committed Sep 24, 2011
Showing with 1 addition and 60 deletions.
  1. +0 −24 modules.d/000_core.py
  2. +1 −1 modules.d/core_modules.py
  3. +0 −35 modules.d/extras.py
View
@@ -27,30 +27,6 @@ class Restart(Exception):
class StopHandling(Exception):
pass
-class BawtModule(object):
- """This is a hax module, it just says hi to people"""
- matcher_re = "hi %(nick)s"
- matcher_flags = 0
- _name = "BawtModule"
- def __init__(self, parent, channel):
- self.parent = parent
- self.channel = channel
- self.rehash()
- def __repr__(self):
- return self._name
- def __str__(self):
- return self._name
- def rehash(self):
- """Reconstruct matcher regex"""
- self.matcher = re.compile(self.matcher_re % {'nick': self.parent.nick}, # ADD more as neededh
- self.matcher_flags)
- def want(self, msg):
- # OLD API, compat
- return self.matcher.search(msg.data_segment)
-
- def handle(self, msg):
- self.parent.privmsg(msg.replyto, "%s: Hi!" % (msg.nick))
-
class BawtM2(object):
"""I'm a lazy programmer who doesn't write help files"""
@@ -14,7 +14,7 @@ class ModuleAlreadyLoaded(Exception):
pass
# TODO Split this out into core modules, and then import a set of user added
-# ones. BawtModule and the stuff to do reloads is all that needs to be global
+# ones. BawtM2 and the stuff to do reloads is all that needs to be global
# TODO Work out how the channel infrastructure will work (structured
# import?)(Circular ref??)
# Implement something to reference these by name instead of type hax.
View
@@ -38,30 +38,6 @@ class SnackModule(BawtM2):
def handle_privmsg(self, msg):
self.parent.privmsg(msg.replyto, ":D")
-class PingModule(BawtModule):
- "Used to ping users. Incomplete"
- matcher_re = "^!ping"
- matcher_flags = re.I
- _name = "PingModule"
- def handle(self, msg):
- args = msg.data_segment.split(" ")
- if len(args) == 1:
- self.parent.privmsg(msg.replyto, "%s: Who do you want to ping?" % (msg.nick))
- return
- else:
- if self.ping(args[1]):
- self.parent.privmsg(msg.replyto, "%s: I have pinged: %s" % (msg.nick, args[1]))
- else:
- self.parent.privmsg(msg.replyto, "%s: Sorry, I don't know how to ping %s" % (msg.nick, args[1]))
-
- def ping(self, who):
- # Fix this later
- target = who.lower()
- if target == "richo":
- return True
- else:
- return False
-
class HarrassModule(BawtM2):
"Yells incessantly at someone's bot"
_name = "HarrassModule"
@@ -78,17 +54,6 @@ class IllustrationModule(BawtM2):
def handle_privmsg(self, msg):
self.parent.privmsg(msg.replyto, "Authored by richo (warl0ck) before you start arguing. Dynamic module loading bitchez0rz.")
-class BattleModule(BawtModule):
- "richo's submission for the battlebots project"
- matcher_re = "SOLVE"
- _name = "BattleModule"
- def handle(self, msg):
- if msg.nick == "DickServ":
- if msg.data_segment.startswith("SOLVE"):
- equation = msg.data_segment.split(":", 1)[1]
- self.parent.privmsg(msg.nick, "!solve " + str(eval(equation)))
- self.parent.privmsg(msg.replyto, "!solve " + str(eval(equation)))
-
class DebugTopicModule(BawtM2):
"Testing for dynamic topic handling, checking that I can hook topic changes at the module level"
topic_re = "."

0 comments on commit 741f065

Please sign in to comment.