rate limit so we don't get kicked

This commit is contained in:
Ryan Huber 2014-12-02 18:34:52 -08:00
parent ec6a3dc90e
commit e129b0c0d9

View file

@ -42,10 +42,15 @@ class RtmBot(object):
plugin.do(function_name, data)
def output(self):
for plugin in self.bot_plugins:
limiter = False
for output in plugin.do_output():
channel = self.slack_client.server.channels.find(output[0])
if channel != None:
if channel != None and output[1] != None:
if limiter == True:
time.sleep(1)
limiter = False
channel.send_message("{}".format(output[1]))
limiter = True
else:
raise UnknownChannel
def crons(self):