Browse Source

Add rejoin module

dave/xdcc
dave 5 years ago
parent
commit
3cd61f6ce1
  1. 31
      pyircbot/modules/Rejoin.py

31
pyircbot/modules/Rejoin.py

@ -0,0 +1,31 @@
#!/usr/bin/env python
"""
.. module:: PressF
:synopsis: Press F to pay respects
.. moduleauthor:: Dave Pedu <dave@davepedu.com>
"""
from pyircbot.modulebase import ModuleBase, hook
from time import sleep
from threading import Thread
class Rejoin(ModuleBase):
def __init__(self, bot, moduleName):
ModuleBase.__init__(self, bot, moduleName)
try:
self.services = self.bot.getmodulesbyservice("services").pop()
except KeyError as ke:
raise Exception("No services service provider found") from ke
@hook("KICK")
def kicked(self, msg, cmd):
channel, who = msg.args
if who == self.services.nick():
Thread(target=self.rejoin, args=(self.config.get("delay", 30), channel)).start()
def rejoin(self, delay, channel):
sleep(delay)
self.bot.act_JOIN(channel)
Loading…
Cancel
Save