diff --git a/bot.py b/bot.py index 7e3f151..5c8037a 100755 --- a/bot.py +++ b/bot.py @@ -14,6 +14,9 @@ class Oven(pydle.Client): print('loading modules...') await self.loadMods() + print('joining channels') + for i in self.chansjoin: + await self.join(i) print('Done!') async def loadMods(self): @@ -25,7 +28,9 @@ class Oven(pydle.Client): await m.init(self) self.modules[i] = m - + async def on_invite(self, channel, by): + print('{} invited me to {}!'.format(by, channel)) + await self.join(channel) async def on_message(self, chan, source, msg): diff --git a/modules/__pycache__/admin.cpython-36.pyc b/modules/__pycache__/admin.cpython-36.pyc index 5b3c836..7edfa5b 100644 Binary files a/modules/__pycache__/admin.cpython-36.pyc and b/modules/__pycache__/admin.cpython-36.pyc differ diff --git a/modules/__pycache__/channels.cpython-36.pyc b/modules/__pycache__/channels.cpython-36.pyc new file mode 100644 index 0000000..5798dae Binary files /dev/null and b/modules/__pycache__/channels.cpython-36.pyc differ diff --git a/modules/admin.py b/modules/admin.py index 0f8c591..a6c3948 100644 --- a/modules/admin.py +++ b/modules/admin.py @@ -20,12 +20,20 @@ async def reloadmods(self, chan, source, msg): await self.modules[i].init(self) await self.message(chan, 'done! did something break? if so you might need to restart') +async def part(self, chan, source, msg): + await self.message(chan, 'bye {}'.format(msg)) + await self.part(msg) +async def join(self, chan, source, msg): + await self.message(chan, 'joined {}'.format(msg)) + await self.join(msg) commands = { 'quit': quit, 'reload': reloadmods, - 'commit': commit + 'commit': commit, + 'part': part, + 'join': join } async def adminHandle(self, chan, source, msg): diff --git a/modules/channels.py b/modules/channels.py index f00ce66..f33e20b 100644 --- a/modules/channels.py +++ b/modules/channels.py @@ -1,11 +1,10 @@ + + async def init(self): self.chansjoin = ['#bots'] - print('joining channels', ' '.join(self.chansjoin)) - for i in self.chansjoin: - await self.join(i) - +