From a6b4e3c30e27cd847e56edf18a32a3f460bc0052 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 18 Aug 2016 19:43:14 -0600 Subject: try to fix the timeout detection hack --- README.org | 4 ++-- warmachine/connections/slack.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index b317e13..b9dba73 100644 --- a/README.org +++ b/README.org @@ -34,7 +34,7 @@ tasks to be run later. The directory to store any configuration files and other junk in. ** ~self.log~ This is a logger that you should use when logging messages. -** ~recv_msg(channel, message)~ +** ~self.recv_msg(channel, message)~ ~recv_msg~ is the only required method for a plugin. It is called for every plugin every time a connection receives a message. It takes the arguments ~connection~ and ~message~. ~connection~ is the Connection object which allows @@ -71,7 +71,7 @@ async def recv_msg(connection, message): # Repeat the remainder of the received message await connection.say(msg_to_repeat, message['channel']) #+END_SRC -** ~on_connect(connection)~ +** ~self.on_connect(connection)~ This method is called when a connection successfully connects and takes the single argument ~connection~. Use this method to do any start up initialization you may want to do such as create configuration files that don't exist yet. diff --git a/warmachine/connections/slack.py b/warmachine/connections/slack.py index 07e026c..10b6354 100644 --- a/warmachine/connections/slack.py +++ b/warmachine/connections/slack.py @@ -58,8 +58,8 @@ class SlackWS(Connection): try: message = json.loads(await self.ws.recv()) except websockets.ConnectionClosed as e: - self.log.error('Connection Closed: {}'.format(e)) - while not self.connect(): + self.log.error('{}'.format(e)) + while not await self.connect(): self.error('Trying to reconnect...') await asyncio.sleep(300) return -- cgit v1.2.1