class Calculate(object): def __init__(self, server, appid): self.source = MathApi(appid) xmap(server, 'CMSG', self.calculate) @regcmd('@calc (?P<exp>.+)$') def calculate(self, server, nick, user, host, target, msg, exp): send_msg(server, target, self.source.submit(exp))
def __init__(self, server, appid): self.source = MathApi(appid) xmap(server, 'CMSG', self.calculate)