2020-01-31 16:32:17 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import teambot, sys, os
|
|
|
|
|
2020-01-31 22:17:11 +00:00
|
|
|
class Circles(teambot.Handler):
|
|
|
|
def __init__(self, bot):
|
|
|
|
self.modules = []
|
|
|
|
self.cmd = {}
|
|
|
|
self.prefix = "."
|
|
|
|
def loadMods(self):
|
|
|
|
for i in [s for s in os.listdir('modules') if ".py" in s]:
|
|
|
|
i = i[:-3]
|
|
|
|
print('loading',i)
|
|
|
|
m = __import__("modules."+i)
|
|
|
|
m = eval('m.'+i)
|
|
|
|
m.init()
|
|
|
|
self.modules.append(m)
|
|
|
|
def registerCommand(self, txt, func):
|
|
|
|
self.cmd[txt] = func
|
|
|
|
def on_connection_established(self):
|
|
|
|
self.loadMods()
|
|
|
|
def on_pubmessage(self,c,n,m):
|
|
|
|
if m.startswith(self.prefix):
|
|
|
|
args = m[len(self.prefix):].strip().split()
|
|
|
|
cmd = args.pop
|
|
|
|
if cmd in self.cmd:
|
|
|
|
self.cmd[cmd](self,c,n,m)
|
2020-01-31 16:32:17 +00:00
|
|
|
|
|
|
|
|