rate limit so we don't get kicked
This commit is contained in:
parent
ec6a3dc90e
commit
e129b0c0d9
1 changed files with 6 additions and 1 deletions
|
@ -42,10 +42,15 @@ class RtmBot(object):
|
||||||
plugin.do(function_name, data)
|
plugin.do(function_name, data)
|
||||||
def output(self):
|
def output(self):
|
||||||
for plugin in self.bot_plugins:
|
for plugin in self.bot_plugins:
|
||||||
|
limiter = False
|
||||||
for output in plugin.do_output():
|
for output in plugin.do_output():
|
||||||
channel = self.slack_client.server.channels.find(output[0])
|
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]))
|
channel.send_message("{}".format(output[1]))
|
||||||
|
limiter = True
|
||||||
else:
|
else:
|
||||||
raise UnknownChannel
|
raise UnknownChannel
|
||||||
def crons(self):
|
def crons(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue