should work idk
This commit is contained in:
parent
85728a4311
commit
593158044f
17
bot.py
17
bot.py
|
@ -3,8 +3,10 @@ import teambot, sys, os
|
|||
|
||||
class Circles(teambot.Handler):
|
||||
def __init__(self, bot):
|
||||
print('initilized')
|
||||
self.modules = []
|
||||
self.cmd = {}
|
||||
self.raw = {}
|
||||
self.help = {}
|
||||
self.prefix = "."
|
||||
def loadMods(self):
|
||||
|
@ -17,10 +19,14 @@ class Circles(teambot.Handler):
|
|||
self.modules.append(m)
|
||||
def registerCommand(self, txt, func):
|
||||
self.cmd[txt] = func
|
||||
def regosterRaw(self, txt, func):
|
||||
self.raw[txt] = func
|
||||
def registerHelp(self, cmd, ht):
|
||||
self.help[cmd] = ht
|
||||
def on_connection_established(self):
|
||||
print('Connected!')
|
||||
self.loadMods()
|
||||
print('Ready!')
|
||||
def on_pubmessage(self,c,n,m):
|
||||
if m.startswith(self.prefix):
|
||||
args = m[len(self.prefix):].strip().split()
|
||||
|
@ -30,7 +36,14 @@ class Circles(teambot.Handler):
|
|||
self.cmd[cmd](self,c,n,m)
|
||||
except TypeError:
|
||||
self.say(c,n+": Usage: "+self.help[cmd])
|
||||
if cmd in self.raw:
|
||||
try:
|
||||
self.raw[cmd](self,c,n,m)
|
||||
except TypeError:
|
||||
self.say(c,n+": Usage: "+self.help[cmd])
|
||||
|
||||
|
||||
|
||||
if __name__=="__main__":
|
||||
chans = ['#chaos']
|
||||
bot = teambot.TeamBot(chans, "circles", "localhost", chandler=Circles)
|
||||
bot.start()
|
||||
|
||||
|
|
Loading…
Reference in New Issue