diff options
Diffstat (limited to 'warmachine/connections')
| -rw-r--r-- | warmachine/connections/slack.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/warmachine/connections/slack.py b/warmachine/connections/slack.py index 0cc69d4..8ae52da 100644 --- a/warmachine/connections/slack.py +++ b/warmachine/connections/slack.py | |||
| @@ -8,7 +8,7 @@ import urllib.request | |||
| 8 | import websockets | 8 | import websockets |
| 9 | 9 | ||
| 10 | from .base import Connection, INITALIZED, CONNECTED | 10 | from .base import Connection, INITALIZED, CONNECTED |
| 11 | 11 | from ..utils.decorators import memoize | |
| 12 | 12 | ||
| 13 | #: Define slack as a config section prefix | 13 | #: Define slack as a config section prefix |
| 14 | __config_prefix__ = 'slack' | 14 | __config_prefix__ = 'slack' |
| @@ -36,6 +36,12 @@ class SlackWS(Connection): | |||
| 36 | 36 | ||
| 37 | self.status = INITALIZED | 37 | self.status = INITALIZED |
| 38 | 38 | ||
| 39 | @property | ||
| 40 | @memoize | ||
| 41 | def id(self): | ||
| 42 | from hashlib import md5 | ||
| 43 | return md5(self.token.encode()).hexdigest() | ||
| 44 | |||
| 39 | async def connect(self): | 45 | async def connect(self): |
| 40 | self.host = self.authenticate() | 46 | self.host = self.authenticate() |
| 41 | self.log.info('Connecting to {}'.format(self.host)) | 47 | self.log.info('Connecting to {}'.format(self.host)) |