X-Git-Url: https://jfr.im/git/erebus.git/blobdiff_plain/b9c6eb1d457efe531333ab32818ca5de2bc696e3..0bf186e88f4f1753b7bc8096eb99fb9ac58fd858:/erebus.py diff --git a/erebus.py b/erebus.py index 34a4ef1..a4d6ca3 100644 --- a/erebus.py +++ b/erebus.py @@ -27,7 +27,9 @@ class Erebus(object): self.chans = [] def msg(self, *args, **kwargs): - main.randbot.msg(self, *args, **kwargs) + main.randbot().msg(self, *args, **kwargs) + def fastmsg(self, *args, **kwargs): + main.randbot().fastmsg(self, *args, **kwargs) def isauthed(self): return self.auth is not None @@ -84,7 +86,9 @@ class Erebus(object): def msg(self, *args, **kwargs): - self.bot.msg(self.name, *args, **kwargs) + self.bot.msg(self, *args, **kwargs) + def fastmsg(self, *args, **kwargs): + self.bot.fastmsg(self, *args, **kwargs) def levelof(self, auth): if auth is None: @@ -253,6 +257,11 @@ def setup(): global cfg, main cfg = config.Config('bot.config') + + pidfile = open(cfg.pidfile, 'w') + pidfile.write(str(os.getpid())) + pidfile.close() + main = Erebus(cfg) autoloads = [mod for mod, yes in cfg.items('autoloads') if int(yes) == 1] @@ -275,5 +284,9 @@ def loop(): main.fd(fileno).parse(line) if __name__ == '__main__': + try: os.rename('logfile', 'oldlog.%s' % (time.time())) + except: pass + sys.stdout = open('logfile', 'w') + sys.stderr = sys.stdout setup() while True: loop()