Skip to content

Commit

Permalink
Merge pull request #2 from agudipaolo/reconnect
Browse files Browse the repository at this point in the history
auto_reconnect option added
  • Loading branch information
agudipaolo authored Jan 17, 2019
2 parents 92ef637 + b0c8867 commit 67e8896
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions paperbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def post(self, text):
# instantiate Slack & Twilio clients
slack_client = SlackClient(SLACK_BOT_TOKEN)

if slack_client.rtm_connect():
if slack_client.rtm_connect(auto_reconnect=True):
print("paperbot connected and running!")
bot_id = slack_client.api_call("auth.test")["user_id"]
prev2num = time_as_int(time.strftime("%H-%M-%S"))-1
Expand All @@ -396,7 +396,7 @@ def post(self, text):
time.sleep(READ_WEBSOCKET_DELAY)
except WebSocketConnectionClosedException:
print("Lost connection to Slack. Reconnecting...")
if not slack_client.rtm_connect():
if not slack_client.rtm_connect(auto_reconnect=True):
print("Failed to reconnect to Slack")
time.sleep(0.5)
else:
Expand Down

0 comments on commit 67e8896

Please sign in to comment.