We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 82106de commit fa6e0e1Copy full SHA for fa6e0e1
rtmbot.py
@@ -19,6 +19,7 @@ def dbg(debug_string):
19
20
class RtmBot(object):
21
def __init__(self, token):
22
+ self.last_ping = 0
23
self.token = token
24
self.bot_plugins = []
25
self.slack_client = None
@@ -34,7 +35,15 @@ def start(self):
34
35
self.input(reply)
36
self.crons()
37
self.output()
38
+ self.autoping()
39
time.sleep(.1)
40
+ def autoping(self):
41
+ #hardcode the interval to 3 seconds
42
+ now = int(time.time())
43
+ if now > self.last_ping + 3:
44
+ print 'ping'
45
+ self.slack_client.server.ping()
46
+ self.last_ping = now
47
def input(self, data):
48
if "type" in data:
49
function_name = "process_" + data["type"]
0 commit comments