diff --git a/bot.py b/bot.py index 256560c..96c9306 100644 --- a/bot.py +++ b/bot.py @@ -10,6 +10,7 @@ class Bot: def __init__(self): + self._messageCount = 0 self.commandList = {} self.config = { @@ -19,14 +20,13 @@ def __init__(self): self.permissions = { "tuckismad": 3, - "TyrantWarship": 1 + "TyrantWarship": 1, + "hcwool": 2 } self.timedEvents = { 'livestreamChecker': [self.CheckLiveStreams, time(), 10], - 'hangoutsAnnoucenment': [ - lambda: - self.Send(self.channel, "24/7 Hangouts room, check it out here! http://goo.gl/HkFFqg"), time(), 3600] + 'hangoutsAnnoucenment': [self.HangoutsNotify, time(), 3600] } self.host = "irc.freenode.net" @@ -47,6 +47,11 @@ def __init__(self): self.AddModules() + def HangoutsNotify(self): + if self._messageCount > 10: + self.Send(self.channel, "24/7 Hangouts room, check it out here! http://goo.gl/HkFFqg") + self._messageCount = 0 + def Send(self, target, message): ''' Send(String target, String message) @@ -130,6 +135,7 @@ def Run(self): while True: try: data = self.irc.recv(4096).decode("UTF-8", "replace") + self._messageCount += 1 except: pass if(data.find("PING") != -1):