aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2017-02-01 11:14:06 -0800
committerRyan Huber <rhuber@gmail.com>2017-02-01 11:14:06 -0800
commitbcc2ac1bb5cf2750f27d73348888f60098ca3291 (patch)
tree3d707498b0013327906d030de14c75709cb376ac
parent47607a88c578f804d76c25dd2d68386556255b21 (diff)
downloadwee-slack-bcc2ac1bb5cf2750f27d73348888f60098ca3291.tar.gz
recorded test data added
-rw-r--r--_pytest/data/websocket/1485975367.79-reconnect_url.json1
-rw-r--r--_pytest/data/websocket/1485975408.19-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485975412.74-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485975420.36-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485975421.33-message.json1
-rw-r--r--_pytest/data/websocket/1485975421.42-desktop_notification.json1
-rw-r--r--_pytest/data/websocket/1485975426.55-reaction_added.json1
-rw-r--r--_pytest/data/websocket/1485975428.76-reaction_removed.json1
-rw-r--r--_pytest/data/websocket/1485975458.35-channel_created.json1
-rw-r--r--_pytest/data/websocket/1485975458.87-channel_joined.json1
-rw-r--r--_pytest/data/websocket/1485975458.87-message.json1
-rw-r--r--_pytest/data/websocket/1485975462.62-update_thread_state.json1
-rw-r--r--_pytest/data/websocket/1485975462.62-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485975476.62-channel_deleted.json1
-rw-r--r--_pytest/data/websocket/1485975476.86-group_join.json1
-rw-r--r--_pytest/data/websocket/1485975476.86-group_joined.json1
-rw-r--r--_pytest/data/websocket/1485975487.69-group_history_changed.json1
-rw-r--r--_pytest/data/websocket/1485975487.69-group_join.json1
-rw-r--r--_pytest/data/websocket/1485975493.19-group_joined.json1
-rw-r--r--_pytest/data/websocket/1485975493.23-message.json1
-rw-r--r--_pytest/data/websocket/1485975547.75-message.json1
-rw-r--r--_pytest/data/websocket/1485975547.75-update_thread_state.json1
-rw-r--r--_pytest/data/websocket/1485975547.83-reconnect_url.json1
-rw-r--r--_pytest/data/websocket/1485975606.59-team_join.json1
-rw-r--r--_pytest/data/websocket/1485975606.67-message.json1
-rw-r--r--_pytest/data/websocket/1485975606.75-im_created.json1
-rw-r--r--_pytest/data/websocket/1485975606.75-im_open.json1
-rw-r--r--_pytest/data/websocket/1485975611.29-presence_change.json1
-rw-r--r--_pytest/data/websocket/1485975640.5-user_change.json1
-rw-r--r--_pytest/data/websocket/1485975669.14-user_change.json1
-rw-r--r--_pytest/data/websocket/1485975675.81-presence_change.json1
-rw-r--r--_pytest/data/websocket/1485975690.59-mpim_joined.json1
-rw-r--r--_pytest/data/websocket/1485975690.67-group_joined.json1
-rw-r--r--_pytest/data/websocket/1485975690.67-update_thread_state.json1
-rw-r--r--_pytest/data/websocket/1485975697.58-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485975698.45-message.json1
-rw-r--r--_pytest/data/websocket/1485975701.72-reaction_added.json1
-rw-r--r--_pytest/data/websocket/1485975703.22-reaction_removed.json1
-rw-r--r--_pytest/data/websocket/1485975715.79-message.json1
-rw-r--r--_pytest/data/websocket/1485975715.87-file_shared.json1
-rw-r--r--_pytest/data/websocket/1485975723.85-message.json1
-rw-r--r--_pytest/data/websocket/1485975727.84-reconnect_url.json1
-rw-r--r--_pytest/data/websocket/1485975735.91-group_archive.json1
-rw-r--r--_pytest/data/websocket/1485975735.99-message.json1
-rw-r--r--_pytest/data/websocket/1485975736.08-message.json1
-rw-r--r--_pytest/data/websocket/1485975738.1-desktop_notification.json1
-rw-r--r--_pytest/data/websocket/1485975747.17-channel_created.json1
-rw-r--r--_pytest/data/websocket/1485975757.63-channel_rename.json1
-rw-r--r--_pytest/data/websocket/1485975771.6-presence_change.json1
-rw-r--r--_pytest/data/websocket/1485975774.62-presence_change.json1
-rw-r--r--_pytest/data/websocket/1485975822.17-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485975824.48-message.json1
-rw-r--r--_pytest/data/websocket/1485975836.23-message.json1
-rw-r--r--_pytest/data/websocket/1485975836.31-message.json1
-rw-r--r--_pytest/data/websocket/1485975842.1-message.json1
-rw-r--r--_pytest/data/websocket/1485975842.18-message.json1
-rw-r--r--_pytest/data/websocket/1485975850.32-mpim_open.json1
-rw-r--r--_pytest/data/websocket/1485975850.45-group_open.json1
-rw-r--r--_pytest/data/websocket/1485975858.56-reaction_added.json1
-rw-r--r--_pytest/data/websocket/1485975890.7-bot_added.json1
-rw-r--r--_pytest/data/websocket/1485975890.78-message.json1
-rw-r--r--_pytest/data/websocket/1485975896.16-message.json1
-rw-r--r--_pytest/data/websocket/1485975907.84-reconnect_url.json1
-rw-r--r--_pytest/data/websocket/1485975926.59-user_change.json1
-rw-r--r--_pytest/data/websocket/1485975930.81-user_change.json1
-rw-r--r--_pytest/data/websocket/1485975956.38-file_public.json1
-rw-r--r--_pytest/data/websocket/1485975956.47-file_shared.json1
-rw-r--r--_pytest/data/websocket/1485975956.47-message.json1
-rw-r--r--_pytest/data/websocket/1485975978.79-message.json1
-rw-r--r--_pytest/data/websocket/1485975978.91-file_public.json1
-rw-r--r--_pytest/data/websocket/1485975978.91-file_shared.json1
-rw-r--r--_pytest/data/websocket/1485975995.98-file_change.json1
-rw-r--r--_pytest/data/websocket/1485975998.13-file_change.json1
-rw-r--r--_pytest/data/websocket/1485976002.57-file_deleted.json1
-rw-r--r--_pytest/data/websocket/1485976002.66-message.json1
-rw-r--r--_pytest/data/websocket/1485976024.46-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976028.31-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976039.32-reaction_added.json1
-rw-r--r--_pytest/data/websocket/1485976040.8-reaction_removed.json1
-rw-r--r--_pytest/data/websocket/1485976087.84-reconnect_url.json1
-rw-r--r--_pytest/data/websocket/1485976107.57-channel_created.json1
-rw-r--r--_pytest/data/websocket/1485976114.72-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976117.99-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976124.9-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976124.98-message.json1
-rw-r--r--_pytest/data/websocket/1485976125.06-desktop_notification.json1
-rw-r--r--_pytest/data/websocket/1485976125.95-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976129.49-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976133.0-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976137.51-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976137.95-message.json1
-rw-r--r--_pytest/data/websocket/1485976138.73-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976141.79-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976145.8-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976149.89-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976151.6-message.json1
-rw-r--r--_pytest/data/websocket/1485976157.18-message.json1
-rw-r--r--_pytest/data/websocket/1485976157.8-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976161.29-user_typing.json1
-rw-r--r--_pytest/data/websocket/1485976161.75-message.json1
-rw-r--r--_pytest/data/websocket/1485976182.59-channel_archive.json1
-rw-r--r--_pytest/data/websocket/1485976186.62-channel_unarchive.json1
-rw-r--r--_pytest/data/websocket/1485976236.58-message.json1
-rw-r--r--_pytest/data/websocket/1485976236.67-file_comment_added.json1
-rw-r--r--_pytest/data/websocket/1485976248.57-message.json1
-rw-r--r--_pytest/data/websocket/1485976248.65-file_comment_edited.json1
-rw-r--r--_pytest/data/websocket/1485976267.81-reconnect_url.json1
-rw-r--r--wee_slack.py604
108 files changed, 561 insertions, 150 deletions
diff --git a/_pytest/data/websocket/1485975367.79-reconnect_url.json b/_pytest/data/websocket/1485975367.79-reconnect_url.json
new file mode 100644
index 0000000..4b53a4e
--- /dev/null
+++ b/_pytest/data/websocket/1485975367.79-reconnect_url.json
@@ -0,0 +1 @@
+{u'url': u'wss://mpmulti-gvop.slack-msgs.com/websocket/tamYoLuX4lU-WBS7cFe2RCh8kqeO86F0Mi1RKFVfk7FM-QNu1KD7HiMBStfdLkwkKHmtyTACNE6SONtoQRTbnC0q9fAoLHPl76Y7y9IhCve6VKs2KNLmRH37WutXTBsj3b9HvF79VySlPgAwVXZeH0lgfDDk_RAY9l_dJ8u-jSs=', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reconnect_url'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975408.19-user_typing.json b/_pytest/data/websocket/1485975408.19-user_typing.json
new file mode 100644
index 0000000..572b0fd
--- /dev/null
+++ b/_pytest/data/websocket/1485975408.19-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'D3ZEQULHZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975412.74-user_typing.json b/_pytest/data/websocket/1485975412.74-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485975412.74-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975420.36-user_typing.json b/_pytest/data/websocket/1485975420.36-user_typing.json
new file mode 100644
index 0000000..572b0fd
--- /dev/null
+++ b/_pytest/data/websocket/1485975420.36-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'D3ZEQULHZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975421.33-message.json b/_pytest/data/websocket/1485975421.33-message.json
new file mode 100644
index 0000000..5dd2924
--- /dev/null
+++ b/_pytest/data/websocket/1485975421.33-message.json
@@ -0,0 +1 @@
+{u'text': u'hi bob', u'ts': u'1485975421.000002', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'D3ZEQULHZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975421.42-desktop_notification.json b/_pytest/data/websocket/1485975421.42-desktop_notification.json
new file mode 100644
index 0000000..fedda07
--- /dev/null
+++ b/_pytest/data/websocket/1485975421.42-desktop_notification.json
@@ -0,0 +1 @@
+{u'launchUri': u'slack://channel?id=D3ZEQULHZ&message=1485975421000002&team=T3YS5EAL9', u'subtitle': u'alice', u'is_shared': False, u'title': u'weeslacktest', u'ssbFilename': u'knock_brush.mp3', u'avatarImage': u'https://secure.gravatar.com/avatar/fd0ce7a168dc2235d21c53c2c1cfee0c.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0024-192.png', u'imageUri': None, u'content': u'hi bob', u'event_ts': u'1485975421.875655', u'msg': u'1485975421.000002', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'desktop_notification', u'channel': u'D3ZEQULHZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975426.55-reaction_added.json b/_pytest/data/websocket/1485975426.55-reaction_added.json
new file mode 100644
index 0000000..2a1347c
--- /dev/null
+++ b/_pytest/data/websocket/1485975426.55-reaction_added.json
@@ -0,0 +1 @@
+{u'reaction': u'grinning', u'event_ts': u'1485975426.875724', u'ts': u'1485975426.000003', u'item': {u'type': u'message', u'ts': u'1485975421.000002', u'channel': u'D3ZEQULHZ'}, u'user': u'U407ABLLW', u'item_user': u'U407ABLLW', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reaction_added'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975428.76-reaction_removed.json b/_pytest/data/websocket/1485975428.76-reaction_removed.json
new file mode 100644
index 0000000..efa1605
--- /dev/null
+++ b/_pytest/data/websocket/1485975428.76-reaction_removed.json
@@ -0,0 +1 @@
+{u'reaction': u'grinning', u'event_ts': u'1485975428.875759', u'ts': u'1485975428.000004', u'item': {u'type': u'message', u'ts': u'1485975421.000002', u'channel': u'D3ZEQULHZ'}, u'user': u'U407ABLLW', u'item_user': u'U407ABLLW', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reaction_removed'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975458.35-channel_created.json b/_pytest/data/websocket/1485975458.35-channel_created.json
new file mode 100644
index 0000000..bd197df
--- /dev/null
+++ b/_pytest/data/websocket/1485975458.35-channel_created.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975458.876318', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'channel_created', u'channel': {u'is_shared': False, u'is_channel': True, u'created': 1485975458, u'creator': u'U407ABLLW', u'is_org_shared': False, u'id': u'C3ZJKCGTU', u'name': u'some-channel'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975458.87-channel_joined.json b/_pytest/data/websocket/1485975458.87-channel_joined.json
new file mode 100644
index 0000000..fffa5c5
--- /dev/null
+++ b/_pytest/data/websocket/1485975458.87-channel_joined.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975458.876336', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'channel_joined', u'channel': {u'topic': {u'last_set': 0, u'value': u'', u'creator': u''}, u'is_general': False, u'name': u'some-channel', u'is_channel': True, u'created': 1485975458, u'is_member': True, u'is_archived': False, u'creator': u'U407ABLLW', u'members': [u'U3ZKBBDL5', u'U407ABLLW'], u'unread_count': 0, u'previous_names': [], u'purpose': {u'last_set': 1485975458, u'value': u'who knows?', u'creator': u'U407ABLLW'}, u'unread_count_display': 0, u'last_read': u'1485975458.000003', u'id': u'C3ZJKCGTU', u'latest': {u'text': u'<@U407ABLLW|alice> set the channel purpose: who knows?', u'ts': u'1485975458.000003', u'subtype': u'channel_purpose', u'user': u'U407ABLLW', u'type': u'message', u'purpose': u'who knows?'}}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975458.87-message.json b/_pytest/data/websocket/1485975458.87-message.json
new file mode 100644
index 0000000..80e961f
--- /dev/null
+++ b/_pytest/data/websocket/1485975458.87-message.json
@@ -0,0 +1 @@
+{u'user_profile': {u'avatar_hash': u'g6f7a5bf7eb7', u'first_name': u'Second', u'real_name': u'Second Testuser', u'name': u'bob', u'image_72': u'https://secure.gravatar.com/avatar/6f7a5bf7eb782853afb1d33f28ca9ae7.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0019-72.png'}, u'inviter': u'U407ABLLW', u'ts': u'1485975458.000004', u'subtype': u'channel_join', u'text': u'<@U3ZKBBDL5|bob> has joined the channel', u'user': u'U3ZKBBDL5', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C3ZJKCGTU'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975462.62-update_thread_state.json b/_pytest/data/websocket/1485975462.62-update_thread_state.json
new file mode 100644
index 0000000..6a74d95
--- /dev/null
+++ b/_pytest/data/websocket/1485975462.62-update_thread_state.json
@@ -0,0 +1 @@
+{u'mention_count': 0, u'event_ts': u'1485975458.876340', u'timestamp': u'1485975458.741354', u'has_unreads': False, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'update_thread_state'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975462.62-user_typing.json b/_pytest/data/websocket/1485975462.62-user_typing.json
new file mode 100644
index 0000000..5169af3
--- /dev/null
+++ b/_pytest/data/websocket/1485975462.62-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C3ZJKCGTU'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975476.62-channel_deleted.json b/_pytest/data/websocket/1485975476.62-channel_deleted.json
new file mode 100644
index 0000000..fe1ad9e
--- /dev/null
+++ b/_pytest/data/websocket/1485975476.62-channel_deleted.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975476.876638', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'channel_deleted', u'channel': u'C3ZJKCGTU'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975476.86-group_join.json b/_pytest/data/websocket/1485975476.86-group_join.json
new file mode 100644
index 0000000..fdc6878
--- /dev/null
+++ b/_pytest/data/websocket/1485975476.86-group_join.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'group_join', u'user': u'U407ABLLW', u'channel': u'G409GKN9M', u'ts': u'1485975476.000002'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975476.86-group_joined.json b/_pytest/data/websocket/1485975476.86-group_joined.json
new file mode 100644
index 0000000..b4316f3
--- /dev/null
+++ b/_pytest/data/websocket/1485975476.86-group_joined.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975476.876646', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'group_joined', u'channel': {u'name': u'some-channel', u'creator': u'U407ABLLW', u'is_mpim': False, u'is_archived': False, u'created': 1485975458, u'is_group': True, u'topic': {u'last_set': 1485975476, u'value': u'', u'creator': u'U407ABLLW'}, u'purpose': {u'last_set': 1485975476, u'value': u'who knows?', u'creator': u'U407ABLLW'}, u'members': [u'U407ABLLW', u'U3ZKBBDL5'], u'is_starred': False, u'id': u'G409GKN9M'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975487.69-group_history_changed.json b/_pytest/data/websocket/1485975487.69-group_history_changed.json
new file mode 100644
index 0000000..8eabb23
--- /dev/null
+++ b/_pytest/data/websocket/1485975487.69-group_history_changed.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975476.876650', u'is_mpim': False, u'ts': u'1485975476.000004', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'group_history_changed', u'channel': u'G409GKN9M', u'latest': u'1485975476.876632'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975487.69-group_join.json b/_pytest/data/websocket/1485975487.69-group_join.json
new file mode 100644
index 0000000..4732dd4
--- /dev/null
+++ b/_pytest/data/websocket/1485975487.69-group_join.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'group_join', u'user': u'U3ZKBBDL5', u'channel': u'G409GKN9M', u'ts': u'1485975476.000003'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975493.19-group_joined.json b/_pytest/data/websocket/1485975493.19-group_joined.json
new file mode 100644
index 0000000..b4431c2
--- /dev/null
+++ b/_pytest/data/websocket/1485975493.19-group_joined.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975492.876964', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'group_joined', u'channel': {u'topic': {u'last_set': 0, u'value': u'', u'creator': u''}, u'name': u'some-private-channel', u'last_read': u'1485975492.000002', u'creator': u'U407ABLLW', u'is_mpim': False, u'is_archived': False, u'created': 1485975492, u'is_group': True, u'members': [u'U3ZKBBDL5', u'U407ABLLW'], u'unread_count': 0, u'is_open': True, u'purpose': {u'last_set': 0, u'value': u'', u'creator': u''}, u'unread_count_display': 0, u'id': u'G3ZJKP7GA', u'latest': {u'text': u'<@U407ABLLW|alice> has joined the group', u'type': u'message', u'user': u'U407ABLLW', u'ts': u'1485975492.000002', u'subtype': u'group_join'}}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975493.23-message.json b/_pytest/data/websocket/1485975493.23-message.json
new file mode 100644
index 0000000..e82d057
--- /dev/null
+++ b/_pytest/data/websocket/1485975493.23-message.json
@@ -0,0 +1 @@
+{u'user_profile': {u'avatar_hash': u'g6f7a5bf7eb7', u'first_name': u'Second', u'real_name': u'Second Testuser', u'name': u'bob', u'image_72': u'https://secure.gravatar.com/avatar/6f7a5bf7eb782853afb1d33f28ca9ae7.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0019-72.png'}, u'inviter': u'U407ABLLW', u'ts': u'1485975492.000003', u'subtype': u'group_join', u'text': u'<@U3ZKBBDL5|bob> has joined the group', u'user': u'U3ZKBBDL5', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'G3ZJKP7GA'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975547.75-message.json b/_pytest/data/websocket/1485975547.75-message.json
new file mode 100644
index 0000000..80b233b
--- /dev/null
+++ b/_pytest/data/websocket/1485975547.75-message.json
@@ -0,0 +1 @@
+{u'user_profile': {u'avatar_hash': u'gfd0ce7a168d', u'first_name': u'First', u'real_name': u'First Testuser', u'name': u'alice', u'image_72': u'https://secure.gravatar.com/avatar/fd0ce7a168dc2235d21c53c2c1cfee0c.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0024-72.png'}, u'text': u"<@U407ABLLW|alice> set the channel's purpose: seekret", u'ts': u'1485975492.000004', u'subtype': u'group_purpose', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'G3ZJKP7GA', u'purpose': u'seekret'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975547.75-update_thread_state.json b/_pytest/data/websocket/1485975547.75-update_thread_state.json
new file mode 100644
index 0000000..08de51c
--- /dev/null
+++ b/_pytest/data/websocket/1485975547.75-update_thread_state.json
@@ -0,0 +1 @@
+{u'mention_count': 0, u'event_ts': u'1485975492.876967', u'timestamp': u'1485975493.013414', u'has_unreads': False, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'update_thread_state'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975547.83-reconnect_url.json b/_pytest/data/websocket/1485975547.83-reconnect_url.json
new file mode 100644
index 0000000..f8ec065
--- /dev/null
+++ b/_pytest/data/websocket/1485975547.83-reconnect_url.json
@@ -0,0 +1 @@
+{u'url': u'wss://mpmulti-t63z.slack-msgs.com/websocket/I4VgKhpT11zUwKt_Wajw_phIbuzM7xTy0V0DVLb6dyPDkqGU5-497Jn3bOGncotPX4QhfZepKVtlUkrSWCqMcbjH_vjRo91HBvzvk4nJoScjn6KJatZ6vpzokG44Ee-vNMsxXLeedcbraFAzCrLlODGRqvdqxUQDQFMVES0XHP8=', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reconnect_url'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975606.59-team_join.json b/_pytest/data/websocket/1485975606.59-team_join.json
new file mode 100644
index 0000000..23f780f
--- /dev/null
+++ b/_pytest/data/websocket/1485975606.59-team_join.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975606.879253', u'cache_ts': 1485975606, u'type': u'team_join', u'user': {u'status': None, u'profile': {u'first_name': u'Chuck', u'last_name': u'Testuser', u'fields': None, u'real_name': u'Chuck Testuser', u'image_24': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-24.png', u'real_name_normalized': u'Chuck Testuser', u'image_512': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0010-512.png', u'image_32': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-32.png', u'image_48': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-48.png', u'image_72': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-72.png', u'avatar_hash': u'g7f87f7015f8', u'image_192': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0010-192.png'}, u'tz': u'America/Los_Angeles', u'name': u'chuck', u'presence': u'away', u'deleted': False, u'is_bot': False, u'tz_label': u'Pacific Standard Time', u'real_name': u'Chuck Testuser', u'color': u'e7392d', u'team_id': u'T3YS5EAL9', u'is_admin': False, u'is_ultra_restricted': False, u'is_restricted': False, u'is_owner': False, u'tz_offset': -28800, u'id': u'U4096CBHC', u'is_primary_owner': False}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975606.67-message.json b/_pytest/data/websocket/1485975606.67-message.json
new file mode 100644
index 0000000..8aec187
--- /dev/null
+++ b/_pytest/data/websocket/1485975606.67-message.json
@@ -0,0 +1 @@
+{u'user_profile': {u'avatar_hash': u'g7f87f7015f8', u'first_name': u'Chuck', u'real_name': u'Chuck Testuser', u'name': u'chuck', u'image_72': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-72.png'}, u'text': u'<@U4096CBHC|chuck> has joined the channel', u'ts': u'1485975606.000003', u'subtype': u'channel_join', u'user': u'U4096CBHC', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975606.75-im_created.json b/_pytest/data/websocket/1485975606.75-im_created.json
new file mode 100644
index 0000000..295929f
--- /dev/null
+++ b/_pytest/data/websocket/1485975606.75-im_created.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975606.879278', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'im_created', u'user': u'U4096CBHC', u'channel': {u'last_read': u'0000000000.000000', u'created': 1485975606, u'is_org_shared': False, u'unread_count': 0, u'is_open': False, u'user': u'U4096CBHC', u'unread_count_display': 0, u'is_im': True, u'id': u'D409J34CF', u'latest': None}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975606.75-im_open.json b/_pytest/data/websocket/1485975606.75-im_open.json
new file mode 100644
index 0000000..883a9ee
--- /dev/null
+++ b/_pytest/data/websocket/1485975606.75-im_open.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975606.879280', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'im_open', u'user': u'U4096CBHC', u'channel': u'D409J34CF'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975611.29-presence_change.json b/_pytest/data/websocket/1485975611.29-presence_change.json
new file mode 100644
index 0000000..2395dc0
--- /dev/null
+++ b/_pytest/data/websocket/1485975611.29-presence_change.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'presence_change', u'user': u'U4096CBHC', u'presence': u'active'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975640.5-user_change.json b/_pytest/data/websocket/1485975640.5-user_change.json
new file mode 100644
index 0000000..a722cfc
--- /dev/null
+++ b/_pytest/data/websocket/1485975640.5-user_change.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975640.879906', u'cache_ts': 1485975640, u'type': u'user_change', u'user': {u'status': None, u'profile': {u'first_name': u'Charles', u'last_name': u'Testuser', u'fields': [], u'real_name': u'Charles Testuser', u'image_24': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-24.png', u'real_name_normalized': u'Charles Testuser', u'image_512': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0010-512.png', u'image_32': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-32.png', u'image_48': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-48.png', u'image_72': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-72.png', u'avatar_hash': u'g7f87f7015f8', u'image_192': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0010-192.png'}, u'tz': u'America/Los_Angeles', u'name': u'chuck', u'deleted': False, u'is_bot': False, u'tz_label': u'Pacific Standard Time', u'real_name': u'Charles Testuser', u'color': u'e7392d', u'team_id': u'T3YS5EAL9', u'is_admin': False, u'is_ultra_restricted': False, u'is_restricted': False, u'is_owner': False, u'tz_offset': -28800, u'id': u'U4096CBHC', u'is_primary_owner': False}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975669.14-user_change.json b/_pytest/data/websocket/1485975669.14-user_change.json
new file mode 100644
index 0000000..2faf007
--- /dev/null
+++ b/_pytest/data/websocket/1485975669.14-user_change.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975668.880329', u'cache_ts': 1485975669, u'type': u'user_change', u'user': {u'status': None, u'profile': {u'first_name': u'Charles', u'last_name': u'Testuser', u'fields': [], u'real_name': u'Charles Testuser', u'image_24': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-24.png', u'real_name_normalized': u'Charles Testuser', u'image_512': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0010-512.png', u'image_32': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-32.png', u'image_48': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-48.png', u'image_72': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0010-72.png', u'avatar_hash': u'g7f87f7015f8', u'image_192': u'https://secure.gravatar.com/avatar/7f87f7015f8e5081190ece053e41b11e.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0010-192.png'}, u'tz': u'America/Los_Angeles', u'name': u'charles', u'deleted': False, u'is_bot': False, u'tz_label': u'Pacific Standard Time', u'real_name': u'Charles Testuser', u'color': u'e7392d', u'team_id': u'T3YS5EAL9', u'is_admin': False, u'is_ultra_restricted': False, u'is_restricted': False, u'is_owner': False, u'tz_offset': -28800, u'id': u'U4096CBHC', u'is_primary_owner': False}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975675.81-presence_change.json b/_pytest/data/websocket/1485975675.81-presence_change.json
new file mode 100644
index 0000000..2395dc0
--- /dev/null
+++ b/_pytest/data/websocket/1485975675.81-presence_change.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'presence_change', u'user': u'U4096CBHC', u'presence': u'active'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975690.59-mpim_joined.json b/_pytest/data/websocket/1485975690.59-mpim_joined.json
new file mode 100644
index 0000000..c4e0bc0
--- /dev/null
+++ b/_pytest/data/websocket/1485975690.59-mpim_joined.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975690.880722', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'mpim_joined', u'channel': {u'topic': {u'last_set': 1485975690, u'value': u'Group messaging', u'creator': u'U407ABLLW'}, u'name': u'mpdm-bob--alice--charles-1', u'last_read': u'0000000000.000000', u'creator': u'U407ABLLW', u'is_mpim': True, u'is_archived': False, u'created': 1485975690, u'is_group': True, u'members': [u'U407ABLLW', u'U3ZKBBDL5', u'U4096CBHC'], u'unread_count': 0, u'is_open': False, u'purpose': {u'last_set': 1485975690, u'value': u'Group messaging with: @bob @alice @charles', u'creator': u'U407ABLLW'}, u'unread_count_display': 0, u'id': u'G3ZGMF4RZ', u'latest': None}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975690.67-group_joined.json b/_pytest/data/websocket/1485975690.67-group_joined.json
new file mode 100644
index 0000000..3968cc3
--- /dev/null
+++ b/_pytest/data/websocket/1485975690.67-group_joined.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975690.880723', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'group_joined', u'channel': {u'topic': {u'last_set': 1485975690, u'value': u'Group messaging', u'creator': u'U407ABLLW'}, u'name': u'mpdm-bob--alice--charles-1', u'last_read': u'0000000000.000000', u'creator': u'U407ABLLW', u'is_mpim': True, u'is_archived': False, u'created': 1485975690, u'is_group': True, u'members': [u'U407ABLLW', u'U3ZKBBDL5', u'U4096CBHC'], u'unread_count': 0, u'is_open': False, u'purpose': {u'last_set': 1485975690, u'value': u'Group messaging with: @bob @alice @charles', u'creator': u'U407ABLLW'}, u'unread_count_display': 0, u'id': u'G3ZGMF4RZ', u'latest': None}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975690.67-update_thread_state.json b/_pytest/data/websocket/1485975690.67-update_thread_state.json
new file mode 100644
index 0000000..c9ba02a
--- /dev/null
+++ b/_pytest/data/websocket/1485975690.67-update_thread_state.json
@@ -0,0 +1 @@
+{u'mention_count': 0, u'event_ts': u'1485975690.880724', u'timestamp': u'1485975690.537094', u'has_unreads': False, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'update_thread_state'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975697.58-user_typing.json b/_pytest/data/websocket/1485975697.58-user_typing.json
new file mode 100644
index 0000000..b909fa3
--- /dev/null
+++ b/_pytest/data/websocket/1485975697.58-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'G3ZGMF4RZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975698.45-message.json b/_pytest/data/websocket/1485975698.45-message.json
new file mode 100644
index 0000000..777d55f
--- /dev/null
+++ b/_pytest/data/websocket/1485975698.45-message.json
@@ -0,0 +1 @@
+{u'text': u'surely', u'ts': u'1485975698.000002', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'G3ZGMF4RZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975701.72-reaction_added.json b/_pytest/data/websocket/1485975701.72-reaction_added.json
new file mode 100644
index 0000000..e9328c7
--- /dev/null
+++ b/_pytest/data/websocket/1485975701.72-reaction_added.json
@@ -0,0 +1 @@
+{u'reaction': u'unamused', u'event_ts': u'1485975701.880957', u'ts': u'1485975701.000003', u'item': {u'type': u'message', u'ts': u'1485975698.000002', u'channel': u'G3ZGMF4RZ'}, u'user': u'U407ABLLW', u'item_user': u'U407ABLLW', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reaction_added'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975703.22-reaction_removed.json b/_pytest/data/websocket/1485975703.22-reaction_removed.json
new file mode 100644
index 0000000..1e0e0df
--- /dev/null
+++ b/_pytest/data/websocket/1485975703.22-reaction_removed.json
@@ -0,0 +1 @@
+{u'reaction': u'unamused', u'event_ts': u'1485975703.880979', u'ts': u'1485975703.000004', u'item': {u'type': u'message', u'ts': u'1485975698.000002', u'channel': u'G3ZGMF4RZ'}, u'user': u'U407ABLLW', u'item_user': u'U407ABLLW', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reaction_removed'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975715.79-message.json b/_pytest/data/websocket/1485975715.79-message.json
new file mode 100644
index 0000000..2668055
--- /dev/null
+++ b/_pytest/data/websocket/1485975715.79-message.json
@@ -0,0 +1 @@
+{u'username': u'<@U407ABLLW|alice>', u'source_team': u'T3YS5EAL9', u'display_as_bot': False, u'text': u'<@U407ABLLW|alice> uploaded a file: <https://weeslacktest.slack.com/files/alice/F3ZLY6K5J/-.txt|Untitled>', u'channel': u'G3ZGMF4RZ', u'user_profile': {u'avatar_hash': u'gfd0ce7a168d', u'first_name': u'First', u'real_name': u'First Testuser', u'name': u'alice', u'image_72': u'https://secure.gravatar.com/avatar/fd0ce7a168dc2235d21c53c2c1cfee0c.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0024-72.png'}, u'upload': True, u'ts': u'1485975715.000005', u'subtype': u'file_share', u'user': u'U407ABLLW', u'file': {u'filetype': u'text', u'lines_more': 0, u'channels': [], u'display_as_bot': False, u'id': u'F3ZLY6K5J', u'size': 14, u'title': u'Untitled', u'url_private': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZLY6K5J/-.txt', u'ims': [], u'preview': u'some code here', u'external_type': u'', u'edit_link': u'https://weeslacktest.slack.com/files/alice/F3ZLY6K5J/-.txt/edit', u'username': u'', u'timestamp': 1485975715, u'public_url_shared': False, u'editable': True, u'preview_is_truncated': False, u'url_private_download': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZLY6K5J/download/-.txt', u'user': u'U407ABLLW', u'groups': [], u'is_public': False, u'pretty_type': u'Plain Text', u'name': u'-.txt', u'mimetype': u'text/plain', u'permalink_public': u'https://slack-files.com/T3YS5EAL9-F3ZLY6K5J-39c2c4f739', u'permalink': u'https://weeslacktest.slack.com/files/alice/F3ZLY6K5J/-.txt', u'is_external': False, u'created': 1485975715, u'lines': 1, u'comments_count': 0, u'mode': u'snippet', u'preview_highlight': u'<div class="CodeMirror cm-s-default CodeMirrorServer" oncopy="if(event.clipboardData){event.clipboardData.setData(\'text/plain\',window.getSelection().toString().replace(/\\u200b/g,\'\'));event.preventDefault();event.stopPropagation();}">\n<div class="CodeMirror-code">\n<div><pre>some code here</pre></div>\n</div>\n</div>\n'}, u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'user_team': u'T3YS5EAL9', u'bot_id': None} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975715.87-file_shared.json b/_pytest/data/websocket/1485975715.87-file_shared.json
new file mode 100644
index 0000000..2149f8c
--- /dev/null
+++ b/_pytest/data/websocket/1485975715.87-file_shared.json
@@ -0,0 +1 @@
+{u'user_id': u'U407ABLLW', u'event_ts': u'1485975715.881302', u'file_id': u'F3ZLY6K5J', u'file': {u'id': u'F3ZLY6K5J'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_shared'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975723.85-message.json b/_pytest/data/websocket/1485975723.85-message.json
new file mode 100644
index 0000000..0e52b67
--- /dev/null
+++ b/_pytest/data/websocket/1485975723.85-message.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975723.881563', u'ts': u'1485975723.000006', u'subtype': u'message_deleted', u'hidden': True, u'deleted_ts': u'1485975698.000002', u'type': u'message', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'channel': u'G3ZGMF4RZ', u'previous_message': {u'text': u'surely', u'type': u'message', u'user': u'U407ABLLW', u'ts': u'1485975698.000002'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975727.84-reconnect_url.json b/_pytest/data/websocket/1485975727.84-reconnect_url.json
new file mode 100644
index 0000000..d1417e2
--- /dev/null
+++ b/_pytest/data/websocket/1485975727.84-reconnect_url.json
@@ -0,0 +1 @@
+{u'url': u'wss://mpmulti-824w.slack-msgs.com/websocket/Pl7CWLLi3w1S0gHESj79_JySeV0ho6vZRl1usylFoDVBWTj332mKkaLBR6OdrDqRDlYPnwwnh9TqlqOMVajfyHMH_Q02oVU14YJS_ao5_nEJBBd58vDB3XkKfGdPRZNgP2Id05xTpEy9izt9EF_BdDaDaTU9nGc5c2ggnuS9gos=', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reconnect_url'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975735.91-group_archive.json b/_pytest/data/websocket/1485975735.91-group_archive.json
new file mode 100644
index 0000000..05dd53e
--- /dev/null
+++ b/_pytest/data/websocket/1485975735.91-group_archive.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975735.881780', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'group_archive', u'ts': u'1485975735.000005', u'channel': u'G409GKN9M'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975735.99-message.json b/_pytest/data/websocket/1485975735.99-message.json
new file mode 100644
index 0000000..3ca5b71
--- /dev/null
+++ b/_pytest/data/websocket/1485975735.99-message.json
@@ -0,0 +1 @@
+{u'user_profile': {u'avatar_hash': u'gfd0ce7a168d', u'first_name': u'First', u'real_name': u'First Testuser', u'name': u'alice', u'image_72': u'https://secure.gravatar.com/avatar/fd0ce7a168dc2235d21c53c2c1cfee0c.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0024-72.png'}, u'text': u'<@U407ABLLW|alice> archived the private channel', u'ts': u'1485975735.000006', u'subtype': u'group_archive', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'G409GKN9M'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975736.08-message.json b/_pytest/data/websocket/1485975736.08-message.json
new file mode 100644
index 0000000..172f553
--- /dev/null
+++ b/_pytest/data/websocket/1485975736.08-message.json
@@ -0,0 +1 @@
+{u'text': u'<@U407ABLLW|alice> archived the private channel <https://weeslacktest.slack.com/archives/some-channel|some-channel>', u'ts': u'1485975735.000002', u'user': u'USLACKBOT', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'D3ZK1D8JY'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975738.1-desktop_notification.json b/_pytest/data/websocket/1485975738.1-desktop_notification.json
new file mode 100644
index 0000000..56e72f9
--- /dev/null
+++ b/_pytest/data/websocket/1485975738.1-desktop_notification.json
@@ -0,0 +1 @@
+{u'launchUri': u'slack://channel?id=D3ZK1D8JY&message=1485975735000002&team=T3YS5EAL9', u'subtitle': u'slackbot', u'is_shared': False, u'title': u'weeslacktest', u'ssbFilename': u'knock_brush.mp3', u'avatarImage': u'https://a.slack-edge.com/66f9/img/slackbot_192.png', u'imageUri': None, u'content': u'@alice archived the private channel some-channel', u'event_ts': u'1485975737.881829', u'msg': u'1485975735.000002', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'desktop_notification', u'channel': u'D3ZK1D8JY'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975747.17-channel_created.json b/_pytest/data/websocket/1485975747.17-channel_created.json
new file mode 100644
index 0000000..453552d
--- /dev/null
+++ b/_pytest/data/websocket/1485975747.17-channel_created.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975746.882009', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'channel_created', u'channel': {u'is_shared': False, u'is_channel': True, u'created': 1485975747, u'creator': u'U407ABLLW', u'is_org_shared': False, u'id': u'C3ZM8JTD3', u'name': u'some-channel2'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975757.63-channel_rename.json b/_pytest/data/websocket/1485975757.63-channel_rename.json
new file mode 100644
index 0000000..ff5e537
--- /dev/null
+++ b/_pytest/data/websocket/1485975757.63-channel_rename.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975757.882178', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'channel_rename', u'channel': {u'created': u'1485975747', u'id': u'C3ZM8JTD3', u'is_channel': True, u'name': u'some-channel2-renamed'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975771.6-presence_change.json b/_pytest/data/websocket/1485975771.6-presence_change.json
new file mode 100644
index 0000000..e7252bc
--- /dev/null
+++ b/_pytest/data/websocket/1485975771.6-presence_change.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'presence_change', u'user': u'U407ABLLW', u'presence': u'away'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975774.62-presence_change.json b/_pytest/data/websocket/1485975774.62-presence_change.json
new file mode 100644
index 0000000..a180d76
--- /dev/null
+++ b/_pytest/data/websocket/1485975774.62-presence_change.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'presence_change', u'user': u'U407ABLLW', u'presence': u'active'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975822.17-user_typing.json b/_pytest/data/websocket/1485975822.17-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485975822.17-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975824.48-message.json b/_pytest/data/websocket/1485975824.48-message.json
new file mode 100644
index 0000000..bdcee99
--- /dev/null
+++ b/_pytest/data/websocket/1485975824.48-message.json
@@ -0,0 +1 @@
+{u'text': u'generally, yep!', u'ts': u'1485975824.000004', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975836.23-message.json b/_pytest/data/websocket/1485975836.23-message.json
new file mode 100644
index 0000000..5ac0bac
--- /dev/null
+++ b/_pytest/data/websocket/1485975836.23-message.json
@@ -0,0 +1 @@
+{u'thread_ts': u'1485975824.000004', u'text': u'have you met my friend threads?', u'ts': u'1485975835.000005', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975836.31-message.json b/_pytest/data/websocket/1485975836.31-message.json
new file mode 100644
index 0000000..a90ce8b
--- /dev/null
+++ b/_pytest/data/websocket/1485975836.31-message.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975835.883772', u'ts': u'1485975835.000006', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'subtype': u'message_replied', u'message': {u'thread_ts': u'1485975824.000004', u'text': u'generally, yep!', u'ts': u'1485975824.000004', u'reply_count': 1, u'user': u'U407ABLLW', u'replies': [{u'user': u'U407ABLLW', u'ts': u'1485975835.000005'}], u'type': u'message'}, u'type': u'message', u'hidden': True, u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975842.1-message.json b/_pytest/data/websocket/1485975842.1-message.json
new file mode 100644
index 0000000..c8b202b
--- /dev/null
+++ b/_pytest/data/websocket/1485975842.1-message.json
@@ -0,0 +1 @@
+{u'thread_ts': u'1485975824.000004', u'text': u'react if yes', u'ts': u'1485975841.000007', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975842.18-message.json b/_pytest/data/websocket/1485975842.18-message.json
new file mode 100644
index 0000000..d77fd22
--- /dev/null
+++ b/_pytest/data/websocket/1485975842.18-message.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975841.883922', u'ts': u'1485975841.000008', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'subtype': u'message_replied', u'message': {u'thread_ts': u'1485975824.000004', u'text': u'generally, yep!', u'ts': u'1485975824.000004', u'reply_count': 2, u'user': u'U407ABLLW', u'replies': [{u'user': u'U407ABLLW', u'ts': u'1485975835.000005'}, {u'user': u'U407ABLLW', u'ts': u'1485975841.000007'}], u'type': u'message'}, u'type': u'message', u'hidden': True, u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975850.32-mpim_open.json b/_pytest/data/websocket/1485975850.32-mpim_open.json
new file mode 100644
index 0000000..908ee49
--- /dev/null
+++ b/_pytest/data/websocket/1485975850.32-mpim_open.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975849.884091', u'is_mpim': True, u'user': u'U3ZKBBDL5', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'mpim_open', u'channel': u'G3ZGMF4RZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975850.45-group_open.json b/_pytest/data/websocket/1485975850.45-group_open.json
new file mode 100644
index 0000000..60dd1d4
--- /dev/null
+++ b/_pytest/data/websocket/1485975850.45-group_open.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975849.884092', u'is_mpim': True, u'user': u'U3ZKBBDL5', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'group_open', u'channel': u'G3ZGMF4RZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975858.56-reaction_added.json b/_pytest/data/websocket/1485975858.56-reaction_added.json
new file mode 100644
index 0000000..6b10607
--- /dev/null
+++ b/_pytest/data/websocket/1485975858.56-reaction_added.json
@@ -0,0 +1 @@
+{u'reaction': u'stuck_out_tongue', u'event_ts': u'1485975858.884268', u'item': {u'type': u'message', u'ts': u'1485975841.000007', u'channel': u'C407ABS94'}, u'user': u'U4096CBHC', u'item_user': u'U407ABLLW', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reaction_added'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975890.7-bot_added.json b/_pytest/data/websocket/1485975890.7-bot_added.json
new file mode 100644
index 0000000..8ca953b
--- /dev/null
+++ b/_pytest/data/websocket/1485975890.7-bot_added.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975890.885679', u'bot': {u'deleted': False, u'icons': {u'image_36': u'https://a.slack-edge.com/12b5a/plugins/tester/assets/service_36.png', u'image_48': u'https://a.slack-edge.com/12b5a/plugins/tester/assets/service_48.png', u'image_72': u'https://a.slack-edge.com/12b5a/plugins/tester/assets/service_72.png'}, u'app_id': u'A0F7XDUAZ', u'id': u'B3YTBU6L8', u'name': u'incoming-webhook'}, u'cache_ts': 1485975890, u'type': u'bot_added', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975890.78-message.json b/_pytest/data/websocket/1485975890.78-message.json
new file mode 100644
index 0000000..414f544
--- /dev/null
+++ b/_pytest/data/websocket/1485975890.78-message.json
@@ -0,0 +1 @@
+{u'text': u'added an integration to this channel: <https://weeslacktest.slack.com/services/B3YTBU6L8|incoming-webhook>', u'ts': u'1485975890.000009', u'subtype': u'bot_add', u'user': u'U4096CBHC', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94', u'bot_id': u'B3YTBU6L8'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975896.16-message.json b/_pytest/data/websocket/1485975896.16-message.json
new file mode 100644
index 0000000..2d0499f
--- /dev/null
+++ b/_pytest/data/websocket/1485975896.16-message.json
@@ -0,0 +1 @@
+{u'text': u'disabled an integration in this channel: <https://weeslacktest.slack.com/services/B3YTBU6L8|incoming-webhook>', u'ts': u'1485975896.000010', u'subtype': u'bot_disable', u'user': u'U4096CBHC', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94', u'bot_id': u'B3YTBU6L8'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975907.84-reconnect_url.json b/_pytest/data/websocket/1485975907.84-reconnect_url.json
new file mode 100644
index 0000000..f26d883
--- /dev/null
+++ b/_pytest/data/websocket/1485975907.84-reconnect_url.json
@@ -0,0 +1 @@
+{u'url': u'wss://mpmulti-1r8c.slack-msgs.com/websocket/8atJCMnYZ10YaqNai-zwEaNMfkwh85XwRpc0MYVVOzAojnPcrx8SboF-NBWeep6Hy7arytqEffr_Fh7mPrDagwEGwbOeX-OH3OLlubVjpC2cCLWwm2jN3rEZcq8A4j0tpPP56GZ84jbLn4BKvDhKkkKhRXQhuYtC7kskaXXLTbk=', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reconnect_url'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975926.59-user_change.json b/_pytest/data/websocket/1485975926.59-user_change.json
new file mode 100644
index 0000000..f3ef251
--- /dev/null
+++ b/_pytest/data/websocket/1485975926.59-user_change.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975926.886492', u'cache_ts': 1485975926, u'type': u'user_change', u'user': {u'status': None, u'profile': {u'first_name': u'Charles', u'last_name': u'Testuser', u'fields': [], u'real_name': u'Charles Testuser', u'image_24': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_original': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_original.png', u'real_name_normalized': u'Charles Testuser', u'image_512': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_32': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_48': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_72': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'avatar_hash': u'5af404f7d4b7', u'image_1024': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_192': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png'}, u'tz': u'America/Los_Angeles', u'name': u'charles', u'deleted': False, u'is_bot': False, u'tz_label': u'Pacific Standard Time', u'real_name': u'Charles Testuser', u'color': u'e7392d', u'team_id': u'T3YS5EAL9', u'is_admin': False, u'is_ultra_restricted': False, u'is_restricted': False, u'is_owner': False, u'tz_offset': -28800, u'id': u'U4096CBHC', u'is_primary_owner': False}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975930.81-user_change.json b/_pytest/data/websocket/1485975930.81-user_change.json
new file mode 100644
index 0000000..40ed3da
--- /dev/null
+++ b/_pytest/data/websocket/1485975930.81-user_change.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485975930.886576', u'cache_ts': 1485975930, u'type': u'user_change', u'user': {u'status': None, u'profile': {u'first_name': u'Charles', u'last_name': u'Testuser', u'fields': [], u'real_name': u'Charles Testuser', u'image_24': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_original': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_original.png', u'real_name_normalized': u'Charles Testuser', u'image_512': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_32': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_48': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_72': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'avatar_hash': u'5af404f7d4b7', u'image_1024': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png', u'image_192': u'https://avatars.slack-edge.com/2017-02-01/135714629508_5af404f7d4b7728d10c0_24.png'}, u'tz': u'America/Los_Angeles', u'name': u'charles', u'deleted': False, u'is_bot': False, u'tz_label': u'Pacific Standard Time', u'real_name': u'Charles Testuser', u'color': u'e7392d', u'team_id': u'T3YS5EAL9', u'is_admin': False, u'is_ultra_restricted': False, u'is_restricted': False, u'is_owner': False, u'tz_offset': -28800, u'id': u'U4096CBHC', u'is_primary_owner': False}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975956.38-file_public.json b/_pytest/data/websocket/1485975956.38-file_public.json
new file mode 100644
index 0000000..3f44646
--- /dev/null
+++ b/_pytest/data/websocket/1485975956.38-file_public.json
@@ -0,0 +1 @@
+{u'user_id': u'U407ABLLW', u'event_ts': u'1485975956.887078', u'file_id': u'F3ZJQTA66', u'file': {u'id': u'F3ZJQTA66'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_public'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975956.47-file_shared.json b/_pytest/data/websocket/1485975956.47-file_shared.json
new file mode 100644
index 0000000..53296ba
--- /dev/null
+++ b/_pytest/data/websocket/1485975956.47-file_shared.json
@@ -0,0 +1 @@
+{u'user_id': u'U407ABLLW', u'event_ts': u'1485975956.887081', u'file_id': u'F3ZJQTA66', u'file': {u'id': u'F3ZJQTA66'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_shared'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975956.47-message.json b/_pytest/data/websocket/1485975956.47-message.json
new file mode 100644
index 0000000..03047f4
--- /dev/null
+++ b/_pytest/data/websocket/1485975956.47-message.json
@@ -0,0 +1 @@
+{u'username': u'<@U407ABLLW|alice>', u'source_team': u'T3YS5EAL9', u'display_as_bot': False, u'text': u'<@U407ABLLW|alice> uploaded a file: <https://weeslacktest.slack.com/files/alice/F3ZJQTA66/1x1.png|1x1.png>', u'channel': u'C407ABS94', u'user_profile': {u'avatar_hash': u'gfd0ce7a168d', u'first_name': u'First', u'real_name': u'First Testuser', u'name': u'alice', u'image_72': u'https://secure.gravatar.com/avatar/fd0ce7a168dc2235d21c53c2c1cfee0c.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0024-72.png'}, u'upload': True, u'ts': u'1485975956.000011', u'subtype': u'file_share', u'user': u'U407ABLLW', u'file': {u'groups': [], u'filetype': u'png', u'channels': [u'C407ABS94'], u'display_as_bot': False, u'thumb_64': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_64.png', u'size': 68, u'original_h': 1, u'thumb_360_w': 1, u'title': u'1x1.png', u'url_private': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZJQTA66/1x1.png', u'thumb_360': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_360.png', u'id': u'F3ZJQTA66', u'ims': [], u'thumb_80': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_80.png', u'thumb_360_h': 1, u'external_type': u'', u'username': u'', u'timestamp': 1485975955, u'public_url_shared': False, u'editable': False, u'thumb_160': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_160.png', u'url_private_download': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZJQTA66/download/1x1.png', u'user': u'U407ABLLW', u'image_exif_rotation': 1, u'is_public': True, u'pretty_type': u'PNG', u'name': u'1x1.png', u'mimetype': u'image/png', u'permalink_public': u'https://slack-files.com/T3YS5EAL9-F3ZJQTA66-5d747593d2', u'permalink': u'https://weeslacktest.slack.com/files/alice/F3ZJQTA66/1x1.png', u'is_external': False, u'created': 1485975955, u'original_w': 1, u'comments_count': 0, u'mode': u'hosted'}, u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'user_team': u'T3YS5EAL9', u'bot_id': None} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975978.79-message.json b/_pytest/data/websocket/1485975978.79-message.json
new file mode 100644
index 0000000..339504c
--- /dev/null
+++ b/_pytest/data/websocket/1485975978.79-message.json
@@ -0,0 +1 @@
+{u'username': u'<@U407ABLLW|alice>', u'display_as_bot': False, u'text': u'<@U407ABLLW|alice> shared a file: <https://weeslacktest.slack.com/files/alice/F3YTCL8TA/some_post_here|some post here>', u'upload': False, u'ts': u'1485975978.000012', u'subtype': u'file_share', u'user': u'U407ABLLW', u'file': {u'filetype': u'space', u'channels': [u'C407ABS94'], u'display_as_bot': False, u'id': u'F3YTCL8TA', u'size': 73, u'title': u'some post here', u'url_private': u'https://files.slack.com/files-pri/T3YS5EAL9-F3YTCL8TA/some_post_here', u'ims': [], u'state': u'locked', u'editor': u'U407ABLLW', u'preview': None, u'external_type': u'', u'username': u'', u'updated': 1485975959, u'timestamp': 1485975967, u'public_url_shared': False, u'editable': True, u'url_private_download': u'https://files.slack.com/files-pri/T3YS5EAL9-F3YTCL8TA/download/some_post_here', u'user': u'U407ABLLW', u'groups': [], u'is_public': False, u'last_editor': u'U407ABLLW', u'pretty_type': u'Post', u'name': u'some_post_here', u'mimetype': u'text/plain', u'permalink_public': u'https://slack-files.com/T3YS5EAL9-F3YTCL8TA-9d9391a713', u'permalink': u'https://weeslacktest.slack.com/files/alice/F3YTCL8TA/some_post_here', u'is_external': False, u'created': 1485975959, u'comments_count': 0, u'mode': u'space'}, u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94', u'bot_id': None} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975978.91-file_public.json b/_pytest/data/websocket/1485975978.91-file_public.json
new file mode 100644
index 0000000..39ad780
--- /dev/null
+++ b/_pytest/data/websocket/1485975978.91-file_public.json
@@ -0,0 +1 @@
+{u'user_id': u'U407ABLLW', u'event_ts': u'1485975978.887563', u'file_id': u'F3YTCL8TA', u'file': {u'id': u'F3YTCL8TA'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_public'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975978.91-file_shared.json b/_pytest/data/websocket/1485975978.91-file_shared.json
new file mode 100644
index 0000000..e41c2be
--- /dev/null
+++ b/_pytest/data/websocket/1485975978.91-file_shared.json
@@ -0,0 +1 @@
+{u'user_id': u'U407ABLLW', u'event_ts': u'1485975978.887560', u'file_id': u'F3YTCL8TA', u'file': {u'id': u'F3YTCL8TA'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_shared'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975995.98-file_change.json b/_pytest/data/websocket/1485975995.98-file_change.json
new file mode 100644
index 0000000..ff4ea71
--- /dev/null
+++ b/_pytest/data/websocket/1485975995.98-file_change.json
@@ -0,0 +1 @@
+{u'user_id': u'U407ABLLW', u'event_ts': u'1485975995.887846', u'file_id': u'F3YTCL8TA', u'file': {u'id': u'F3YTCL8TA'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_change'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485975998.13-file_change.json b/_pytest/data/websocket/1485975998.13-file_change.json
new file mode 100644
index 0000000..bbbc4ec
--- /dev/null
+++ b/_pytest/data/websocket/1485975998.13-file_change.json
@@ -0,0 +1 @@
+{u'user_id': u'U407ABLLW', u'event_ts': u'1485975998.887906', u'file_id': u'F3YTCL8TA', u'file': {u'id': u'F3YTCL8TA'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_change'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976002.57-file_deleted.json b/_pytest/data/websocket/1485976002.57-file_deleted.json
new file mode 100644
index 0000000..a4f4c71
--- /dev/null
+++ b/_pytest/data/websocket/1485976002.57-file_deleted.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485976002.888005', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_deleted', u'file_id': u'F3YTCL8TA'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976002.66-message.json b/_pytest/data/websocket/1485976002.66-message.json
new file mode 100644
index 0000000..b32f31a
--- /dev/null
+++ b/_pytest/data/websocket/1485976002.66-message.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485976002.888006', u'ts': u'1485976002.000013', u'subtype': u'message_deleted', u'hidden': True, u'deleted_ts': u'1485975978.000012', u'type': u'message', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'channel': u'C407ABS94', u'previous_message': {u'username': u'<@U407ABLLW|alice>', u'display_as_bot': False, u'text': u'<@U407ABLLW|alice> shared a file: <https://weeslacktest.slack.com/files/alice/F3YTCL8TA/some_post_here|some post here>', u'upload': False, u'ts': u'1485975978.000012', u'subtype': u'file_share', u'user': u'U407ABLLW', u'file': {u'filetype': u'space', u'channels': [], u'display_as_bot': False, u'id': u'F3YTCL8TA', u'size': 73, u'title': u'some post here', u'url_private': u'https://files.slack.com/files-pri/T3YS5EAL9-F3YTCL8TA/some_post_here', u'ims': [], u'state': u'locked', u'editor': u'U407ABLLW', u'preview': None, u'external_type': u'', u'username': u'', u'updated': 1485975959, u'timestamp': 1485975967, u'public_url_shared': False, u'editable': True, u'url_private_download': u'https://files.slack.com/files-pri/T3YS5EAL9-F3YTCL8TA/download/some_post_here', u'user': u'U407ABLLW', u'groups': [], u'is_public': True, u'last_editor': u'U407ABLLW', u'pretty_type': u'Post', u'name': u'some_post_here', u'mimetype': u'text/plain', u'permalink_public': u'https://slack-files.com/T3YS5EAL9-F3YTCL8TA-9d9391a713', u'permalink': u'https://weeslacktest.slack.com/files/alice/F3YTCL8TA/some_post_here', u'is_external': False, u'created': 1485975959, u'comments_count': 0, u'mode': u'space'}, u'type': u'message', u'bot_id': None}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976024.46-user_typing.json b/_pytest/data/websocket/1485976024.46-user_typing.json
new file mode 100644
index 0000000..b909fa3
--- /dev/null
+++ b/_pytest/data/websocket/1485976024.46-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'G3ZGMF4RZ'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976028.31-user_typing.json b/_pytest/data/websocket/1485976028.31-user_typing.json
new file mode 100644
index 0000000..b7f65a8
--- /dev/null
+++ b/_pytest/data/websocket/1485976028.31-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'G3ZJKP7GA'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976039.32-reaction_added.json b/_pytest/data/websocket/1485976039.32-reaction_added.json
new file mode 100644
index 0000000..acccc65
--- /dev/null
+++ b/_pytest/data/websocket/1485976039.32-reaction_added.json
@@ -0,0 +1 @@
+{u'reaction': u'unamused', u'event_ts': u'1485976039.888795', u'item': {u'type': u'message', u'ts': u'1485975841.000007', u'channel': u'C407ABS94'}, u'user': u'U407ABLLW', u'item_user': u'U407ABLLW', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reaction_added'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976040.8-reaction_removed.json b/_pytest/data/websocket/1485976040.8-reaction_removed.json
new file mode 100644
index 0000000..2f39d43
--- /dev/null
+++ b/_pytest/data/websocket/1485976040.8-reaction_removed.json
@@ -0,0 +1 @@
+{u'reaction': u'unamused', u'event_ts': u'1485976040.888829', u'item': {u'type': u'message', u'ts': u'1485975841.000007', u'channel': u'C407ABS94'}, u'user': u'U407ABLLW', u'item_user': u'U407ABLLW', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reaction_removed'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976087.84-reconnect_url.json b/_pytest/data/websocket/1485976087.84-reconnect_url.json
new file mode 100644
index 0000000..018c2c5
--- /dev/null
+++ b/_pytest/data/websocket/1485976087.84-reconnect_url.json
@@ -0,0 +1 @@
+{u'url': u'wss://mpmulti-clcz.slack-msgs.com/websocket/ZwLc8-LUIYLyvEwRO5WKs99SLtxBN9Cyu1W5qmqkre0AtWFl_H8xTE7HbF0E9LUvgI4bNkIRG8WgPxIzfr5gLJsU6vg8By36_mUUZYfH0TV65y_h2vV7NQe6s3A6WJdKRoJAe_EI2AN5L-VeL9rK1Ygc0nw3ngmuL78G6cm48xw=', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reconnect_url'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976107.57-channel_created.json b/_pytest/data/websocket/1485976107.57-channel_created.json
new file mode 100644
index 0000000..fed2059
--- /dev/null
+++ b/_pytest/data/websocket/1485976107.57-channel_created.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485976107.890695', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'channel_created', u'channel': {u'is_shared': False, u'is_channel': True, u'created': 1485976107, u'creator': u'U407ABLLW', u'is_org_shared': False, u'id': u'C3ZM2GMGU', u'name': u'made-to-be-archived'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976114.72-user_typing.json b/_pytest/data/websocket/1485976114.72-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976114.72-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976117.99-user_typing.json b/_pytest/data/websocket/1485976117.99-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976117.99-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976124.9-user_typing.json b/_pytest/data/websocket/1485976124.9-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976124.9-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976124.98-message.json b/_pytest/data/websocket/1485976124.98-message.json
new file mode 100644
index 0000000..95a8d77
--- /dev/null
+++ b/_pytest/data/websocket/1485976124.98-message.json
@@ -0,0 +1 @@
+{u'text': u'referencing someong by <@U3ZKBBDL5> name', u'ts': u'1485976124.000014', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976125.06-desktop_notification.json b/_pytest/data/websocket/1485976125.06-desktop_notification.json
new file mode 100644
index 0000000..3a57bc0
--- /dev/null
+++ b/_pytest/data/websocket/1485976125.06-desktop_notification.json
@@ -0,0 +1 @@
+{u'launchUri': u'slack://channel?id=C407ABS94&message=1485976124000014&team=T3YS5EAL9', u'subtitle': u'#general', u'is_shared': False, u'title': u'weeslacktest', u'ssbFilename': u'knock_brush.mp3', u'avatarImage': u'https://secure.gravatar.com/avatar/fd0ce7a168dc2235d21c53c2c1cfee0c.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0024-192.png', u'imageUri': None, u'content': u'alice: referencing someong by @bob name', u'event_ts': u'1485976124.891186', u'msg': u'1485976124.000014', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'desktop_notification', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976125.95-user_typing.json b/_pytest/data/websocket/1485976125.95-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976125.95-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976129.49-user_typing.json b/_pytest/data/websocket/1485976129.49-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976129.49-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976133.0-user_typing.json b/_pytest/data/websocket/1485976133.0-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976133.0-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976137.51-user_typing.json b/_pytest/data/websocket/1485976137.51-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976137.51-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976137.95-message.json b/_pytest/data/websocket/1485976137.95-message.json
new file mode 100644
index 0000000..715e4e4
--- /dev/null
+++ b/_pytest/data/websocket/1485976137.95-message.json
@@ -0,0 +1 @@
+{u'text': u'referencing someone else by <@U407ABLLW> name', u'ts': u'1485976137.000015', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976138.73-user_typing.json b/_pytest/data/websocket/1485976138.73-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976138.73-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976141.79-user_typing.json b/_pytest/data/websocket/1485976141.79-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976141.79-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976145.8-user_typing.json b/_pytest/data/websocket/1485976145.8-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976145.8-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976149.89-user_typing.json b/_pytest/data/websocket/1485976149.89-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976149.89-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976151.6-message.json b/_pytest/data/websocket/1485976151.6-message.json
new file mode 100644
index 0000000..a2f431e
--- /dev/null
+++ b/_pytest/data/websocket/1485976151.6-message.json
@@ -0,0 +1 @@
+{u'text': u'referencing a #channel-that-doesnt-exist', u'ts': u'1485976151.000016', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976157.18-message.json b/_pytest/data/websocket/1485976157.18-message.json
new file mode 100644
index 0000000..96c82f6
--- /dev/null
+++ b/_pytest/data/websocket/1485976157.18-message.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485976156.891735', u'ts': u'1485976156.000017', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'subtype': u'message_changed', u'message': {u'text': u'referencing a <#C407ABS94|general>', u'type': u'message', u'user': u'U407ABLLW', u'ts': u'1485976151.000016', u'edited': {u'user': u'U407ABLLW', u'ts': u'1485976157.000000'}}, u'type': u'message', u'hidden': True, u'channel': u'C407ABS94', u'previous_message': {u'text': u'referencing a #channel-that-doesnt-exist', u'type': u'message', u'user': u'U407ABLLW', u'ts': u'1485976151.000016'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976157.8-user_typing.json b/_pytest/data/websocket/1485976157.8-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976157.8-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976161.29-user_typing.json b/_pytest/data/websocket/1485976161.29-user_typing.json
new file mode 100644
index 0000000..4e53cd4
--- /dev/null
+++ b/_pytest/data/websocket/1485976161.29-user_typing.json
@@ -0,0 +1 @@
+{'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'user_typing', u'user': u'U407ABLLW', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976161.75-message.json b/_pytest/data/websocket/1485976161.75-message.json
new file mode 100644
index 0000000..9ed97d2
--- /dev/null
+++ b/_pytest/data/websocket/1485976161.75-message.json
@@ -0,0 +1 @@
+{u'text': u'referencing <#C3ZM8JTD3|some-channel2-renamed>', u'ts': u'1485976161.000018', u'user': u'U407ABLLW', u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976182.59-channel_archive.json b/_pytest/data/websocket/1485976182.59-channel_archive.json
new file mode 100644
index 0000000..66ce021
--- /dev/null
+++ b/_pytest/data/websocket/1485976182.59-channel_archive.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485976182.892242', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'channel_archive', u'user': u'U407ABLLW', u'channel': u'C3ZM2GMGU'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976186.62-channel_unarchive.json b/_pytest/data/websocket/1485976186.62-channel_unarchive.json
new file mode 100644
index 0000000..67f15d7
--- /dev/null
+++ b/_pytest/data/websocket/1485976186.62-channel_unarchive.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485976186.892309', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'channel_unarchive', u'user': u'U407ABLLW', u'channel': u'C3ZM2GMGU'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976236.58-message.json b/_pytest/data/websocket/1485976236.58-message.json
new file mode 100644
index 0000000..ea7ecef
--- /dev/null
+++ b/_pytest/data/websocket/1485976236.58-message.json
@@ -0,0 +1 @@
+{u'comment': {u'comment': u'first comment!', u'created': 1485976236, u'timestamp': 1485976236, u'is_intro': False, u'user': u'U407ABLLW', u'id': u'Fc3ZMDRQLV', u'channel': u''}, u'text': u'<@U407ABLLW|alice> commented on <@U407ABLLW|alice>\u2019s file <https://weeslacktest.slack.com/files/alice/F3ZJQTA66/1x1.png|1x1.png>: first comment!', u'ts': u'1485976236.000019', u'subtype': u'file_comment', u'is_intro': False, u'file': {u'groups': [], u'filetype': u'png', u'channels': [u'C407ABS94'], u'display_as_bot': False, u'thumb_64': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_64.png', u'size': 68, u'original_h': 1, u'thumb_360_w': 1, u'title': u'1x1.png', u'url_private': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZJQTA66/1x1.png', u'thumb_360': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_360.png', u'id': u'F3ZJQTA66', u'ims': [], u'thumb_80': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_80.png', u'thumb_360_h': 1, u'external_type': u'', u'username': u'', u'timestamp': 1485975955, u'public_url_shared': False, u'editable': False, u'thumb_160': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_160.png', u'url_private_download': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZJQTA66/download/1x1.png', u'user': u'U407ABLLW', u'image_exif_rotation': 1, u'is_public': True, u'pretty_type': u'PNG', u'name': u'1x1.png', u'mimetype': u'image/png', u'permalink_public': u'https://slack-files.com/T3YS5EAL9-F3ZJQTA66-5d747593d2', u'permalink': u'https://weeslacktest.slack.com/files/alice/F3ZJQTA66/1x1.png', u'is_external': False, u'created': 1485975955, u'original_w': 1, u'comments_count': 1, u'mode': u'hosted'}, u'team': u'T3YS5EAL9', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'message', u'channel': u'C407ABS94'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976236.67-file_comment_added.json b/_pytest/data/websocket/1485976236.67-file_comment_added.json
new file mode 100644
index 0000000..13272a8
--- /dev/null
+++ b/_pytest/data/websocket/1485976236.67-file_comment_added.json
@@ -0,0 +1 @@
+{u'comment': {u'comment': u'first comment!', u'created': 1485976236, u'timestamp': 1485976236, u'is_intro': False, u'user': u'U407ABLLW', u'id': u'Fc3ZMDRQLV', u'channel': u''}, u'user_id': u'U407ABLLW', u'event_ts': u'1485976236.893560', u'file_id': u'F3ZJQTA66', u'file': {u'id': u'F3ZJQTA66'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_comment_added'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976248.57-message.json b/_pytest/data/websocket/1485976248.57-message.json
new file mode 100644
index 0000000..797e0dc
--- /dev/null
+++ b/_pytest/data/websocket/1485976248.57-message.json
@@ -0,0 +1 @@
+{u'event_ts': u'1485976248.893799', u'ts': u'1485976248.000020', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'subtype': u'message_changed', u'message': {u'comment': {u'comment': u'first comment! now i edited it.', u'created': 1485976236, u'timestamp': 1485976236, u'is_intro': False, u'user': u'U407ABLLW', u'id': u'Fc3ZMDRQLV', u'channel': u''}, u'text': u'<@U407ABLLW|alice> commented on <@U407ABLLW|alice>\u2019s file <https://weeslacktest.slack.com/files/alice/F3ZJQTA66/1x1.png|1x1.png>: first comment! now i edited it.', u'ts': u'1485976236.000019', u'subtype': u'file_comment', u'is_intro': False, u'file': {u'groups': [], u'filetype': u'png', u'channels': [u'C407ABS94'], u'display_as_bot': False, u'thumb_64': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_64.png', u'size': 68, u'original_h': 1, u'thumb_360_w': 1, u'title': u'1x1.png', u'url_private': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZJQTA66/1x1.png', u'thumb_360': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_360.png', u'id': u'F3ZJQTA66', u'ims': [], u'thumb_80': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_80.png', u'thumb_360_h': 1, u'external_type': u'', u'username': u'', u'timestamp': 1485975955, u'public_url_shared': False, u'editable': False, u'thumb_160': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_160.png', u'url_private_download': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZJQTA66/download/1x1.png', u'user': u'U407ABLLW', u'image_exif_rotation': 1, u'is_public': True, u'pretty_type': u'PNG', u'name': u'1x1.png', u'mimetype': u'image/png', u'permalink_public': u'https://slack-files.com/T3YS5EAL9-F3ZJQTA66-5d747593d2', u'permalink': u'https://weeslacktest.slack.com/files/alice/F3ZJQTA66/1x1.png', u'is_external': False, u'created': 1485975955, u'original_w': 1, u'comments_count': 1, u'mode': u'hosted'}, u'type': u'message'}, u'type': u'message', u'hidden': True, u'channel': u'C407ABS94', u'previous_message': {u'comment': {u'comment': u'first comment! now i edited it.', u'created': 1485976236, u'timestamp': 1485976236, u'is_intro': False, u'user': u'U407ABLLW', u'id': u'Fc3ZMDRQLV', u'channel': u''}, u'text': u'<@U407ABLLW|alice> commented on <@U407ABLLW|alice>\u2019s file <https://weeslacktest.slack.com/files/alice/F3ZJQTA66/1x1.png|1x1.png>: first comment! now i edited it.', u'ts': u'1485976236.000019', u'subtype': u'file_comment', u'is_intro': False, u'file': {u'groups': [], u'filetype': u'png', u'channels': [u'C407ABS94'], u'display_as_bot': False, u'thumb_64': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_64.png', u'size': 68, u'original_h': 1, u'thumb_360_w': 1, u'title': u'1x1.png', u'url_private': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZJQTA66/1x1.png', u'thumb_360': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_360.png', u'id': u'F3ZJQTA66', u'ims': [], u'thumb_80': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_80.png', u'thumb_360_h': 1, u'external_type': u'', u'username': u'', u'timestamp': 1485975955, u'public_url_shared': False, u'editable': False, u'thumb_160': u'https://files.slack.com/files-tmb/T3YS5EAL9-F3ZJQTA66-8ab528dd77/1x1_160.png', u'url_private_download': u'https://files.slack.com/files-pri/T3YS5EAL9-F3ZJQTA66/download/1x1.png', u'user': u'U407ABLLW', u'image_exif_rotation': 1, u'is_public': True, u'pretty_type': u'PNG', u'name': u'1x1.png', u'mimetype': u'image/png', u'permalink_public': u'https://slack-files.com/T3YS5EAL9-F3ZJQTA66-5d747593d2', u'permalink': u'https://weeslacktest.slack.com/files/alice/F3ZJQTA66/1x1.png', u'is_external': False, u'created': 1485975955, u'original_w': 1, u'comments_count': 1, u'mode': u'hosted'}, u'type': u'message'}} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976248.65-file_comment_edited.json b/_pytest/data/websocket/1485976248.65-file_comment_edited.json
new file mode 100644
index 0000000..f944ede
--- /dev/null
+++ b/_pytest/data/websocket/1485976248.65-file_comment_edited.json
@@ -0,0 +1 @@
+{u'comment': {u'comment': u'first comment! now i edited it.', u'created': 1485976236, u'timestamp': 1485976236, u'is_intro': False, u'user': u'U407ABLLW', u'id': u'Fc3ZMDRQLV', u'channel': u''}, u'user_id': u'U407ABLLW', u'event_ts': u'1485976248.893801', u'file_id': u'F3ZJQTA66', u'file': {u'id': u'F3ZJQTA66'}, 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'file_comment_edited'} \ No newline at end of file
diff --git a/_pytest/data/websocket/1485976267.81-reconnect_url.json b/_pytest/data/websocket/1485976267.81-reconnect_url.json
new file mode 100644
index 0000000..c373cbc
--- /dev/null
+++ b/_pytest/data/websocket/1485976267.81-reconnect_url.json
@@ -0,0 +1 @@
+{u'url': u'wss://mpmulti-m00z.slack-msgs.com/websocket/fZI1FV2ZuMYXeQLMKi1SrH2j69xL6m_6hC38CVCr0ugPFpMS1IBxlCvHJYbSrH-fMhSuLmbkEd1te_ND5Q-EyVVX-w06mn5NLZM9GaX_mWb9A3w79sThYzEgnnQ8onoeFM2CWgFNxWM_3XS4HJaWXeee-_sNh_booNbby8jm9mg=', 'wee_slack_metadata': {'team': 'd80c2b6c3127dbb1991917394ed219e8212a2606'}, u'type': u'reconnect_url'} \ No newline at end of file
diff --git a/wee_slack.py b/wee_slack.py
index aed88e9..51c12b6 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -32,6 +32,8 @@ SCROLLBACK_SIZE = 500
CACHE_VERSION = "4"
+RECORD_DIR = "/tmp/weeslack-debug"
+
SLACK_API_TRANSLATOR = {
"channel": {
"history": "channels.history",
@@ -76,6 +78,7 @@ if hasattr(ssl, "get_default_verify_paths") and callable(ssl.get_default_verify_
IGNORED_EVENTS = [
"reconnect_url",
"hello",
+ "pref_change",
]
###### New central Event router
@@ -92,6 +95,19 @@ class EventRouter(object):
self.proc = {k[8:]: v for k, v in globals().items() if k.startswith("process_")}
self.handlers = {k[7:]: v for k, v in globals().items() if k.startswith("handle_")}
self.local_proc = {k[14:]: v for k, v in globals().items() if k.startswith("local_process_")}
+ self.shutting_down = False
+ self.recording = False
+ self.recording_path = "/tmp"
+
+ def record(self):
+ self.recording = not self.recording
+ if self.recording:
+ import os
+ if not os.path.exists(RECORD_DIR):
+ os.makedirs(RECORD_DIR)
+
+ def shutdown(self):
+ self.shutting_down = not self.shutting_down
def register_team(self, team):
"""
@@ -111,13 +127,15 @@ class EventRouter(object):
else:
raise InvalidType(type(buffer_ptr))
- def unregister_weechat_buffer(self, buffer_ptr):
+ def unregister_weechat_buffer(self, buffer_ptr, update_remote=False, close_buffer=False):
"""
Adds a weechat buffer to the list of handled buffers for this EventRouter
"""
if isinstance(buffer_ptr, str):
try:
- self.weechat_buffers[buffer_ptr].destroy_buffer()
+ self.weechat_buffers[buffer_ptr].destroy_buffer(update_remote)
+ if close_buffer:
+ w.buffer_close(buffer_ptr)
del self.weechat_buffers[buffer_ptr]
except:
dbg("Tried to close unknown buffer")
@@ -144,6 +162,12 @@ class EventRouter(object):
#print self.teams[team_hash].domain
message_json["wee_slack_metadata"] = metadata
#print message_json
+ if self.recording:
+ now = time.time()
+ mtype = message_json.get('type', 'unknown')
+ f = open('{}/{}-{}.json'.format(RECORD_DIR, now, mtype), 'w')
+ f.write("{}".format(message_json))
+ f.close()
self.receive_json(json.dumps(message_json))
except WebSocketConnectionClosedException:
#TODO: handle reconnect here
@@ -182,10 +206,8 @@ class EventRouter(object):
self.reply_buffer[request_metadata.response_id] += out
def receive_json(self, data):
- dbg("RECEIVED JSON")
- dbg(str(data))
+ dbg("RECEIVED JSON of len {}".format(len(data)))
message_json = json.loads(data)
- dbg(message_json)
#print message_json.keys()
self.queue.append(message_json)
def receive(self, dataobj):
@@ -216,16 +238,20 @@ class EventRouter(object):
function_name = "unknown"
# Here we are passing the actual objects. No more lookups.
- if "wee_slack_metadata" in j:
-
- if isinstance(j["wee_slack_metadata"], str):
- dbg("string of metadata")
- if "team" in j["wee_slack_metadata"]:
- kwargs["team"] = self.teams[j["wee_slack_metadata"]["team"]]
- if "user" in j:
- kwargs["user"] = self.teams[j["wee_slack_metadata"]["team"]].users[j["user"]]
- if "channel" in j:
- kwargs["channel"] = self.teams[j["wee_slack_metadata"]["team"]].channels[j["channel"]]
+ meta = j.get("wee_slack_metadata", None)
+ if meta:
+ try:
+ if isinstance(meta, str):
+ dbg("string of metadata")
+ team = meta.get("team", None)
+ if team:
+ kwargs["team"] = self.teams[team]
+ if "user" in j:
+ kwargs["user"] = self.teams[team].users[j["user"]]
+ if "channel" in j:
+ kwargs["channel"] = self.teams[team].channels[j["channel"]]
+ except:
+ dbg("metadata failure")
if function_name not in IGNORED_EVENTS:
dbg("running {}".format(function_name))
@@ -248,11 +274,13 @@ def local_process_async_slack_api_request(request, event_router):
"""
Sends an API request to Slack. You'll need to give this a well formed SlackRequest object.
"""
- weechat_request = 'url:{}'.format(request.request_string())
- params = {'useragent': 'wee_slack {}'.format(SCRIPT_VERSION)}
- request.tried()
- context = pickle.dumps(request)
- w.hook_process_hashtable(weechat_request, params, config.slack_timeout, "receive_httprequest_callback", context)
+ if not event_router.shutting_down:
+ weechat_request = 'url:{}'.format(request.request_string())
+ print weechat_request
+ params = {'useragent': 'wee_slack {}'.format(SCRIPT_VERSION)}
+ request.tried()
+ context = pickle.dumps(request)
+ w.hook_process_hashtable(weechat_request, params, config.slack_timeout, "receive_httprequest_callback", context)
###### New Callbacks
@@ -274,26 +302,21 @@ def receive_ws_callback(*args):
return w.WEECHAT_RC_OK
def buffer_closing_callback(signal, sig_type, data):
- eval(signal).unregister_weechat_buffer(data)
+ eval(signal).unregister_weechat_buffer(data, True, False)
return w.WEECHAT_RC_OK
def buffer_input_callback(signal, buffer_ptr, data):
eventrouter = eval(signal)
-
- dbg(signal, True)
- dbg(data, True)
- dbg(buffer_ptr, True)
channel = eventrouter.weechat_buffers[buffer_ptr]
- print channel
if not channel:
return w.WEECHAT_RC_OK_EAT
-# reaction = re.match("^\s*(\d*)(\+|-):(.*):\s*$", data)
-# if reaction:
-# if reaction.group(2) == "+":
-# channel.send_add_reaction(int(reaction.group(1) or 1), reaction.group(3))
-# elif reaction.group(2) == "-":
-# channel.send_remove_reaction(int(reaction.group(1) or 1), reaction.group(3))
+ reaction = re.match("^\s*(\d*)(\+|-):(.*):\s*$", data)
+ if reaction:
+ if reaction.group(2) == "+":
+ channel.send_add_reaction(int(reaction.group(1) or 1), reaction.group(3))
+ elif reaction.group(2) == "-":
+ channel.send_remove_reaction(int(reaction.group(1) or 1), reaction.group(3))
# elif data.startswith('s/'):
# try:
# old, new, flags = re.split(r'(?<!\\)/', data)[1:]
@@ -328,6 +351,39 @@ def buffer_switch_callback(signal, sig_type, data):
eventrouter.previous_buffer = data
return w.WEECHAT_RC_OK
+def buffer_list_update_callback(data, somecount):
+ eventrouter = eval(data)
+ global buffer_list_update
+
+ buffer_list_update = True
+ now = time.time()
+ if buffer_list_update and previous_buffer_list_update + 1 < now:
+ # gray_check = False
+ # if len(servers) > 1:
+ # gray_check = True
+ for b in eventrouter.weechat_buffers:
+ #print b
+ eventrouter.weechat_buffers[b].rename()
+ buffer_list_update = False
+ return w.WEECHAT_RC_OK
+
+def quit_notification_callback(signal, sig_type, data):
+ stop_talking_to_slack()
+
+def script_unloaded():
+ stop_talking_to_slack()
+ return w.WEECHAT_RC_OK
+
+def stop_talking_to_slack():
+ """
+ Prevents a race condition where quitting closes buffers
+ which triggers leaving the channel because of how close
+ buffer is handled
+ """
+ EVENTROUTER.shutdown()
+ return w.WEECHAT_RC_OK
+
+
##### New Classes
class SlackRequest(object):
@@ -360,11 +416,12 @@ class SlackRequest(object):
return self.tries < 3
class SlackTeam(object):
- def __init__(self, token, team, nick, myidentifier, users, channels):
+ def __init__(self, eventrouter, token, team, nick, myidentifier, users, bots, channels):
self.connected = False
self.ws = None
self.ws_counter = 0
self.ws_replies = {}
+ self.eventrouter = eventrouter
self.token = token
self.team = team
self.domain = team + ".slack.com"
@@ -372,11 +429,18 @@ class SlackTeam(object):
self.myidentifier = myidentifier
self.channels = channels
self.users = users
+ self.bots = bots
self.team_hash = str(sha.sha("{}{}".format(self.nick, self.team)).hexdigest())
+ self.name = self.domain
+ self.server_buffer = None
+ self.got_history = True
+ self.create_buffer()
for c in self.channels.keys():
channels[c].set_related_server(self)
channels[c].open_if_we_should()
# self.channel_set_related_server(c)
+ # Last step is to make sure my nickname is the set color
+ self.users[self.myidentifier].force_color(w.config_string(w.config_get('weechat.color.chat_nick_self')))
def __eq__(self, compare_str):
if compare_str == self.token:
return True
@@ -387,8 +451,21 @@ class SlackTeam(object):
channel.set_related_server(self)
# def connect_request_generate(self):
# return SlackRequest(self.token, 'rtm.start', {})
+ def create_buffer(self):
+ if not self.server_buffer:
+ self.server_buffer = w.buffer_new("{}".format(self.domain), "buffer_input_callback", "EVENTROUTER", "", "")
+ self.eventrouter.register_weechat_buffer(self.server_buffer, self)
+ w.buffer_set(self.server_buffer, "localvar_set_type", 'channel')
+ w.buffer_set(self.server_buffer, "localvar_set_channel", self.name)
+ w.buffer_set(self.server_buffer, "short_name", self.name)
+ def get_channel_map(self):
+ return {v.slack_name: k for k, v in self.channels.iteritems()}
+ def get_username_map(self):
+ return {v.name: k for k, v in self.users.iteritems()}
def get_team_hash(self):
return self.team_hash
+ def rename(self):
+ pass
def attach_websocket(self, ws):
self.ws = ws
def set_connected(self):
@@ -421,8 +498,8 @@ class SlackChannel(object):
# We require these two things for a vaid object,
# the rest we can just learn from slack
self.eventrouter = eventrouter
+ self.slack_name = kwargs["name"]
self.identifier = kwargs["id"]
- self.name = kwargs["name"]
self.channel_buffer = None
self.team = None
self.got_history = False
@@ -430,28 +507,41 @@ class SlackChannel(object):
self.type = 'channel'
for key, value in kwargs.items():
setattr(self, key, value)
+ self.set_name(self.slack_name)
def __repr__(self):
return "Name:{} Identifier:{}".format(self.name, self.identifier)
- def open_if_we_should(self):
- for reason in ["is_member", "is_open", "unread_count"]:
- try:
- if eval("self." + reason):
- self.create_buffer()
- except:
- pass
+ def set_name(self, slack_name):
+ self.name = "#" + slack_name
+ def rename(self):
pass
+ #self.name = "?" + self.slack_name
+ #w.buffer_set(self.channel_buffer, "short_name", self.name)
+ def formatted_name(self):
+ return self.name
+ def update_from_message_json(self, message_json):
+ for key, value in message_json.items():
+ setattr(self, key, value)
+ def open_if_we_should(self, force=False):
+ if force:
+ self.create_buffer()
+ else:
+ for reason in ["is_member", "is_open", "unread_count"]:
+ try:
+ if eval("self." + reason):
+ self.create_buffer()
+ except:
+ pass
def set_related_server(self, team):
self.team = team
def create_buffer(self):
if not self.channel_buffer:
- print self.team
self.channel_buffer = w.buffer_new("{}.{}".format(self.team.domain, self.name), "buffer_input_callback", "EVENTROUTER", "", "")
self.eventrouter.register_weechat_buffer(self.channel_buffer, self)
#dbg(self.channel_buffer, True)
w.buffer_set(self.channel_buffer, "localvar_set_type", 'channel')
w.buffer_set(self.channel_buffer, "localvar_set_channel", self.name)
- w.buffer_set(self.channel_buffer, "short_name", self.name)
+ w.buffer_set(self.channel_buffer, "short_name", self.formatted_name())
# if self.server.alias:
# w.buffer_set(self.channel_buffer, "localvar_set_server", self.server.alias)
# else:
@@ -459,16 +549,27 @@ class SlackChannel(object):
# buffer_list_update_next()
# if self.unread_count != 0 and not self.muted:
# w.buffer_set(self.channel_buffer, "hotlist", "1")
- def destroy_buffer(self):
- if self.channel_buffer:
+ def destroy_buffer(self, update_remote):
+ if self.channel_buffer is not None:
self.channel_buffer = None
+ self.got_history = False
+ #if update_remote and not eventrouter.shutting_down:
+ if update_remote and not self.eventrouter.shutting_down:
+ s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["leave"], {"channel": self.identifier}, team_hash=self.team.team_hash, channel_identifier=self.identifier)
+ EVENTROUTER.receive(s)
def buffer_prnt(self, nick, text, timestamp, *args):
+ t, time_id = timestamp.split('.', 1)
+ time_int = int(t)
if self.channel_buffer:
- w.prnt(self.channel_buffer, "{}\t{}".format(nick, text))
+ #w.prnt(self.channel_buffer, "{}\t{}".format(nick, text))
+ tags = ''
+ data = "{}\t{}".format(nick, text)
+ w.prnt_date_tags(self.channel_buffer, time_int, tags, data)
+ modify_print_time(self.channel_buffer, time_id, time_int)
#dbg("should buffer print {} {}".format(nick, text), True)
def send_message(self, message):
#team = self.eventrouter.teams[self.team]
- #message = self.linkify_text(message)
+ message = linkify_text(message, self.team, self)
dbg(message)
print self.team
request = {"type": "message", "channel": self.identifier, "text": message, "_team": self.team.team_hash, "user": self.team.myidentifier}
@@ -483,16 +584,17 @@ class SlackChannel(object):
mk.sort()
for k in mk[:SCROLLBACK_SIZE]:
del self.messages[k]
- def change_message(self, ts, text=None, suffix=''):
- #print "should have changed"
+ def change_message(self, ts, text=None, suffix=None):
if ts in self.messages:
m = self.messages[ts]
- m.change_text(text)
- #m = self.get_message(ts)
- #text = m[2].render(force=True)
- #timestamp, time_id = ts.split(".", 2)
- #timestamp = int(timestamp)
- #modify_buffer_line(self.channel_buffer, text + suffix, timestamp, time_id)
+ if text:
+ m.change_text(text)
+ if suffix:
+ m.change_suffix(suffix)
+ text = m.render(force=True)
+ timestamp, time_id = ts.split(".", 2)
+ timestamp = int(timestamp)
+ modify_buffer_line(self.channel_buffer, text, timestamp, time_id)
return True
def get_history(self):
#if config.cache_messages:
@@ -502,6 +604,16 @@ class SlackChannel(object):
EVENTROUTER.receive(s)
#async_slack_api_request(self.server.domain, self.server.token, SLACK_API_TRANSLATOR[self.type]["history"], {"channel": self.identifier, "count": BACKLOG_SIZE})
self.got_history = True
+ def send_add_reaction(self, msg_number, reaction):
+ self.send_change_reaction("reactions.add", msg_number, reaction)
+ def send_remove_reaction(self, msg_number, reaction):
+ self.send_change_reaction("reactions.remove", msg_number, reaction)
+ def send_change_reaction(self, method, msg_number, reaction):
+ if 0 < msg_number < len(self.messages):
+ timestamp = self.sorted_message_keys()[-msg_number]
+ data = {"channel": self.identifier, "timestamp": timestamp, "name": reaction}
+ s = SlackRequest(self.team.token, method, data)
+ self.eventrouter.receive(s)
def sorted_message_keys(self):
return sorted(self.messages)
@@ -512,15 +624,38 @@ class SlackDMChannel(SlackChannel):
kwargs["name"] = users[dmuser].name
super(SlackDMChannel, self).__init__(eventrouter, **kwargs)
self.type = 'im'
+ self.update_color()
+ self.set_name(self.slack_name)
+ #self.name = self.formatted_name(" ")
+ def set_name(self, slack_name):
+ self.name = slack_name
def create_buffer(self):
if not self.channel_buffer:
super(SlackDMChannel, self).create_buffer()
w.buffer_set(self.channel_buffer, "localvar_set_type", 'private')
+ def update_color(self):
+ if config.colorize_nicks:
+ self.color_name = w.info_get('irc_nick_color_name', self.name.encode('utf-8'))
+ self.color = w.color(self.color_name)
+ else:
+ self.color = ""
+ self.color_name = ""
+ def formatted_name(self, prepend="", enable_color=True):
+ if config.colorize_nicks and enable_color:
+ print_color = self.color
+ else:
+ print_color = ""
+ return print_color + prepend + self.name
+
class SlackGroupChannel(SlackChannel):
def __init__(self, eventrouter, **kwargs):
super(SlackGroupChannel, self).__init__(eventrouter, **kwargs)
+ self.name = "#" + kwargs['name']
self.type = "group"
+ self.set_name(self.slack_name)
+ def set_name(self, slack_name):
+ self.name = "#" + slack_name
class SlackMPDMChannel(SlackChannel):
"""
@@ -528,10 +663,11 @@ class SlackMPDMChannel(SlackChannel):
We change the name to look less terrible in weechat.
"""
def __init__(self, eventrouter, **kwargs):
- n = kwargs.get('name')
- name = "|".join("-".join(n.split("-")[1:-1]).split("--"))
- kwargs["name"] = name
super(SlackMPDMChannel, self).__init__(eventrouter, **kwargs)
+ n = kwargs.get('name')
+ self.set_name(n)
+ def set_name(self, n):
+ self.name = "|".join("-".join(n.split("-")[1:-1]).split("--"))
self.type = "group"
class SlackUser(object):
@@ -545,8 +681,19 @@ class SlackUser(object):
self.name = kwargs["name"]
for key, value in kwargs.items():
setattr(self, key, value)
+ self.update_color()
def __repr__(self):
return "Name:{} Identifier:{}".format(self.name, self.identifier)
+ def force_color(self, color_name):
+ self.color_name = color_name
+ self.color = w.color(self.color_name)
+ def update_color(self):
+ if config.colorize_nicks:
+ self.color_name = w.info_get('irc_nick_color_name', self.name.encode('utf-8'))
+ self.color = w.color(self.color_name)
+ else:
+ self.color = ""
+ self.color_name = ""
def formatted_name(self, prepend="", enable_color=True):
if config.colorize_nicks and enable_color:
print_color = self.color
@@ -554,28 +701,39 @@ class SlackUser(object):
print_color = ""
return print_color + prepend + self.name
+class SlackBot(SlackUser):
+ def __init__(self, **kwargs):
+ super(SlackBot, self).__init__(**kwargs)
+
class SlackMessage(object):
def __init__(self, message_json, team, channel):
self.team = team
self.channel = channel
self.message_json = message_json
self.sender = self.get_sender()
+ self.suffix = ''
self.ts = message_json['ts']
- def render(self):
- return render(self.message_json, self.team, self.channel)
+ def render(self, force=False):
+ return render(self.message_json, self.team, self.channel, force) + self.suffix
def change_text(self, new_text):
- dbg("should change text to {}".format(new_text), True)
- return "meh"
+ self.message_json["text"] = new_text
+ dbg(self.message_json, True)
+ def change_suffix(self, new_suffix):
+ self.suffix = new_suffix
+ dbg(self.message_json, True)
def get_sender(self, utf8=True):
+ name = u""
if 'bot_id' in self.message_json and self.message_json['bot_id'] is not None:
- name = u"{} :]".format(self.server.bots.find(self.message_json["bot_id"]).formatted_name())
+ name = u"{} :]".format(self.team.bots[self.message_json["bot_id"]].formatted_name())
elif 'user' in self.message_json:
- if self.message_json['user'] in self.team.users:
+ if self.message_json['user'] == self.team.myidentifier:
+ name = self.team.users[self.team.myidentifier].name
+ elif self.message_json['user'] in self.team.users:
u = self.team.users[self.message_json['user']]
- if u.is_bot:
- name = u"{} :]".format(u.formatted_name())
- else:
- name = u.name
+ if u.is_bot:
+ name = u"{} :]".format(u.formatted_name())
+ else:
+ name = u"{}".format(u.formatted_name())
elif 'username' in self.message_json:
name = u"-{}-".format(self.message_json["username"])
elif 'service_name' in self.message_json:
@@ -586,6 +744,27 @@ class SlackMessage(object):
return name.encode('utf-8')
else:
return name
+ def add_reaction(self, reaction, user):
+ m = self.message_json.get('reactions', None)
+ if m:
+ found = False
+ for r in m:
+ if r["name"] == reaction and user not in r["users"]:
+ r["users"].append(user)
+ found = True
+ if not found:
+ self.message_json["reactions"].append({u"name": reaction, u"users": [user]})
+ else:
+ self.message_json["reactions"] = [{u"name": reaction, u"users": [user]}]
+ def remove_reaction(self, reaction, user):
+ m = self.message_json.get('reactions', None)
+ if m:
+ for r in m:
+ if r["name"] == reaction and user in r["users"]:
+ r["users"].remove(user)
+ else:
+ pass
+
class WeeSlackMetadata(object):
def __init__(self, meta):
@@ -607,6 +786,10 @@ def handle_rtmstart(login_data, eventrouter):
users[item["id"]] = SlackUser(**item)
#users.append(SlackUser(**item))
+ bots = {}
+ for item in login_data["bots"]:
+ bots[item["id"]] = SlackBot(**item)
+
channels = {}
for item in login_data["channels"]:
channels[item["id"]] = SlackChannel(eventrouter, **item)
@@ -621,11 +804,13 @@ def handle_rtmstart(login_data, eventrouter):
channels[item["id"]] = SlackGroupChannel(eventrouter, **item)
t = SlackTeam(
+ eventrouter,
metadata.token,
login_data["team"]["domain"],
login_data["self"]["name"],
login_data["self"]["id"],
users,
+ bots,
channels,
)
eventrouter.register_team(t)
@@ -659,7 +844,7 @@ def handle_history(message_json, eventrouter, **kwargs):
request_metadata = pickle.loads(message_json["wee_slack_request_metadata"])
kwargs['team'] = eventrouter.teams[request_metadata.team_hash]
kwargs['channel'] = kwargs['team'].channels[request_metadata.channel_identifier]
- for message in message_json["messages"]:
+ for message in reversed(message_json["messages"]):
process_message(message, eventrouter, **kwargs)
###### New/converted process_ and subprocess_ methods
@@ -683,8 +868,8 @@ def process_message(message_json, eventrouter, store=True, **kwargs):
known_subtypes = [
#'thread_message',
#'message_replied',
- #'message_changed',
- #'message_deleted',
+ 'message_changed',
+ 'message_deleted',
#'channel_join',
#'channel_leave',
#'channel_topic',
@@ -693,10 +878,10 @@ def process_message(message_json, eventrouter, store=True, **kwargs):
]
if "thread_ts" in message_json and "reply_count" not in message_json:
message_json["subtype"] = "thread_message"
- if "subtype" in message_json:
- if message_json["subtype"] in known_subtypes:
- f = eval('subprocess_' + message_json["subtype"])
- f(message_json, eventrouter, channel, team)
+ subtype = message_json.get("subtype", None)
+ if subtype and subtype in known_subtypes:
+ f = eval('subprocess_' + subtype)
+ f(message_json, eventrouter, channel, team)
else:
message = SlackMessage(message_json, team, channel)
@@ -743,32 +928,37 @@ def subprocess_thread_message(message_json, eventrouter, channel, team):
def subprocess_message_changed(message_json, eventrouter, channel, team):
- m = message_json["message"]
- if "message" in message_json:
- if "attachments" in m:
- message_json["attachments"] = m["attachments"]
- if "text" in m:
- if "text" in message_json:
- message_json["text"] += m["text"]
- dbg("added text!")
- else:
- message_json["text"] = m["text"]
- if "fallback" in m:
- if "fallback" in message_json:
- message_json["fallback"] += m["fallback"]
- else:
- message_json["fallback"] = m["fallback"]
-
- text_before = (len(m['text']) > 0)
- m["text"] += unwrap_attachments(message_json, text_before)
- if "edited" in m:
- channel.change_message(m["ts"], m["text"], ' (edited)')
+ m = message_json.get("message", None)
+ if m:
+ new_message = m
+ #message = SlackMessage(new_message, team, channel)
+ #if "attachments" in m:
+ # message_json["attachments"] = m["attachments"]
+ #if "text" in m:
+ # if "text" in message_json:
+ # message_json["text"] += m["text"]
+ # dbg("added text!")
+ # else:
+ # message_json["text"] = m["text"]
+ #if "fallback" in m:
+ # if "fallback" in message_json:
+ # message_json["fallback"] += m["fallback"]
+ # else:
+ # message_json["fallback"] = m["fallback"]
+
+ text_before = (len(new_message['text']) > 0)
+ new_message["text"] += unwrap_attachments(message_json, text_before)
+ if "edited" in new_message:
+ channel.change_message(new_message["ts"], new_message["text"], ' (edited)')
else:
- channel.change_message(m["ts"], m["text"])
+ channel.change_message(new_message["ts"], new_message["text"])
+
+def subprocess_message_deleted(message_json, eventrouter, channel, team):
+ channel.change_message(message_json["deleted_ts"], "(deleted)", '')
def process_reply(message_json, eventrouter, **kwargs):
dbg('processing reply')
- dbg(message_json, True)
+ #dbg(message_json, True)
team = kwargs["team"]
identifier = message_json["reply_to"]
try:
@@ -779,8 +969,8 @@ def process_reply(message_json, eventrouter, **kwargs):
else:
dbg("no reply ts {}".format(message_json))
- if "channel" in original_message_json:
- channel = team.channels[original_message_json["channel"]]
+ c = original_message_json.get('channel', None)
+ channel = team.channels[c]
m = SlackMessage(original_message_json, team, channel)
# m = Message(message_json, server=server)
dbg(m, True)
@@ -803,14 +993,44 @@ def process_channel_marked(message_json, eventrouter, **kwargs):
#w.buffer_set(channel.channel_buffer, "hotlist", "-1")
def process_channel_joined(message_json, eventrouter, **kwargs):
- print message_json
- print kwargs
-# server = servers.find(message_json["_server"])
-# channel = server.channels.find(message_json["channel"])
-# text = unfurl_refs(message_json["text"], ignore_alt_text=False)
-# channel.buffer_prnt(w.prefix("join").rstrip(), text, message_json["ts"])
-# channel.user_join(message_json["user"])
+ item = message_json["channel"]
+ kwargs['team'].channels[item["id"]].update_from_message_json(item)
+ kwargs['team'].channels[item["id"]].open_if_we_should()
+
+def process_channel_created(message_json, eventrouter, **kwargs):
+ item = message_json["channel"]
+ c = SlackChannel(eventrouter, team=kwargs["team"], **item)
+ kwargs['team'].channels[item["id"]] = c
+
+def process_im_open(message_json, eventrouter, **kwargs):
+ item = message_json
+ kwargs['team'].channels[item["channel"]].open_if_we_should(True)
+
+def process_im_close(message_json, eventrouter, **kwargs):
+ item = message_json
+ cbuf = kwargs['team'].channels[item["channel"]].channel_buffer
+ print cbuf
+ eventrouter.unregister_weechat_buffer(cbuf, False, True)
+
+def process_reaction_added(message_json, eventrouter, **kwargs):
+ channel = kwargs['team'].channels[message_json["item"]["channel"]]
+ if message_json["item"].get("type") == "message":
+ ts = message_json['item']["ts"]
+
+ channel.messages[ts].add_reaction(message_json["reaction"], message_json["user"])
+ channel.change_message(ts)
+ else:
+ dbg("reaction to item type not supported: " + str(message_json))
+def process_reaction_removed(message_json, eventrouter, **kwargs):
+ channel = kwargs['team'].channels[message_json["item"]["channel"]]
+ if message_json["item"].get("type") == "message":
+ ts = message_json['item']["ts"]
+
+ channel.messages[ts].remove_reaction(message_json["reaction"], message_json["user"])
+ channel.change_message(ts)
+ else:
+ dbg("Reaction to item type not supported: " + str(message_json))
###### New module/global methods
@@ -847,27 +1067,39 @@ def render(message_json, team, channel, force=False):
# text += " [Replies: {} Thread ID: {} ] ".format(len(self.threads), self.thread_id)
# #for thread in self.threads:
- if "reactions" in message_json:
- text += create_reaction_string(message_json["reactions"])
+ text += create_reaction_string(message_json.get("reactions", ""))
message_json["_rendered_text"] = text
return text
-def linkify_text(message):
+def linkify_text(message, team, channel):
+ # The get_username_map function is a bit heavy, but this whole
+ # function is only called on message send..
+ usernames = team.get_username_map()
+ channels = team.get_channel_map()
message = message.split(' ')
for item in enumerate(message):
- targets = re.match('.*([@#])([\w.]+\w)(\W*)', item[1])
+ targets = re.match('.*([@#])([\w.-]+[\w. -])(\W*)', item[1])
+ print targets
if targets and targets.groups()[0] == '@':
+ print targets.groups()
named = targets.groups()
if named[1] in ["group", "channel", "here"]:
message[item[0]] = "<!{}>".format(named[1])
- if self.server.users.find(named[1]):
- message[item[0]] = "<@{}>{}".format(self.server.users.find(named[1]).identifier, named[2])
+ try:
+ if usernames[named[1]]:
+ message[item[0]] = "<@{}>{}".format(usernames[named[1]], named[2])
+ except:
+ message[item[0]] = "@{}{}".format(named[1], named[2])
if targets and targets.groups()[0] == '#':
named = targets.groups()
- if self.server.channels.find(named[1]):
- message[item[0]] = "<#{}|{}>{}".format(self.server.channels.find(named[1]).identifier, named[1], named[2])
- dbg(message)
+ try:
+ if channels[named[1]]:
+ message[item[0]] = "<#{}|{}>{}".format(channels[named[1]], named[1], named[2])
+ except:
+ message[item[0]] = "#{}{}".format(named[1], named[2])
+
+ #dbg(message)
return " ".join(message)
def unfurl_refs(text, ignore_alt_text=False):
@@ -904,10 +1136,11 @@ def unfurl_ref(ref, ignore_alt_text=False):
def unwrap_attachments(message_json, text_before):
attachment_text = ''
- if "attachments" in message_json:
+ a = message_json.get("attachments", None)
+ if a:
if text_before:
attachment_text = u'\n'
- for attachment in message_json["attachments"]:
+ for attachment in a:
# Attachments should be rendered roughly like:
#
# $pretext
@@ -920,26 +1153,31 @@ def unwrap_attachments(message_json, text_before):
prepend_title_text = attachment['author_name'] + ": "
if 'pretext' in attachment:
t.append(attachment['pretext'])
- if "title" in attachment:
- if 'title_link' in attachment:
- t.append('%s%s (%s)' % (prepend_title_text, attachment["title"], attachment["title_link"],))
- else:
- t.append(prepend_title_text + attachment["title"])
+ title = attachment.get('title', None)
+ title_link = attachment.get('title_link', None)
+ if title and title_link:
+ t.append('%s%s (%s)' % (prepend_title_text, title, title_link,))
+ prepend_title_text = ''
+ elif title and not title_link:
+ t.append(prepend_title_text + title)
prepend_title_text = ''
- elif "from_url" in attachment:
- t.append(attachment["from_url"])
- if "text" in attachment:
- tx = re.sub(r' *\n[\n ]+', '\n', attachment["text"])
+ t.append(attachment.get("from_url", ""))
+
+ atext = attachment.get("text", None)
+ if atext:
+ tx = re.sub(r' *\n[\n ]+', '\n', atext)
t.append(prepend_title_text + tx)
prepend_title_text = ''
- if 'fields' in attachment:
- for f in attachment['fields']:
+ fields = attachment.get("fields", None)
+ if fields:
+ for f in fields:
if f['title'] != '':
t.append('%s %s' % (f['title'], f['value'],))
else:
t.append(f['value'])
- if t == [] and "fallback" in attachment:
- t.append(attachment["fallback"])
+ fallback = attachment.get("fallback", None)
+ if t == [] and fallback:
+ t.append(fallback)
attachment_text += "\n".join([x.strip() for x in t if x])
return attachment_text
@@ -988,6 +1226,73 @@ def create_reaction_string(reactions):
reaction_string = ''
return reaction_string
+def modify_buffer_line(buffer, new_line, timestamp, time_id):
+ # get a pointer to this buffer's lines
+ own_lines = w.hdata_pointer(w.hdata_get('buffer'), buffer, 'own_lines')
+ if own_lines:
+ # get a pointer to the last line
+ line_pointer = w.hdata_pointer(w.hdata_get('lines'), own_lines, 'last_line')
+ # hold the structure of a line and of line data
+ struct_hdata_line = w.hdata_get('line')
+ struct_hdata_line_data = w.hdata_get('line_data')
+
+ while line_pointer:
+ # get a pointer to the data in line_pointer via layout of struct_hdata_line
+ data = w.hdata_pointer(struct_hdata_line, line_pointer, 'data')
+ if data:
+ line_timestamp = w.hdata_time(struct_hdata_line_data, data, 'date')
+ line_time_id = w.hdata_integer(struct_hdata_line_data, data, 'date_printed')
+ # prefix = w.hdata_string(struct_hdata_line_data, data, 'prefix')
+
+ if timestamp == int(line_timestamp) and int(time_id) == line_time_id:
+ # w.prnt("", "found matching time date is {}, time is {} ".format(timestamp, line_timestamp))
+ w.hdata_update(struct_hdata_line_data, data, {"message": new_line})
+ break
+ else:
+ pass
+ # move backwards one line and try again - exit the while if you hit the end
+ line_pointer = w.hdata_move(struct_hdata_line, line_pointer, -1)
+ return w.WEECHAT_RC_OK
+
+
+def modify_print_time(buffer, new_id, time):
+ """
+ This overloads the time printed field to let us store the slack
+ per message unique id that comes after the "." in a slack ts
+ """
+ # get a pointer to this buffer's lines
+ own_lines = w.hdata_pointer(w.hdata_get('buffer'), buffer, 'own_lines')
+ if own_lines:
+ # get a pointer to the last line
+ line_pointer = w.hdata_pointer(w.hdata_get('lines'), own_lines, 'last_line')
+ # hold the structure of a line and of line data
+ struct_hdata_line = w.hdata_get('line')
+ struct_hdata_line_data = w.hdata_get('line_data')
+
+ # get a pointer to the data in line_pointer via layout of struct_hdata_line
+ data = w.hdata_pointer(struct_hdata_line, line_pointer, 'data')
+ if data:
+ w.hdata_update(struct_hdata_line_data, data, {"date_printed": new_id})
+
+ return w.WEECHAT_RC_OK
+
+###### New/converted command_ commands
+
+def slack_command_cb(data, current_buffer, args):
+ a = args.split(' ', 1)
+ if len(a) > 1:
+ function_name, args = a[0], " ".join(a[1:])
+ else:
+ function_name, args = a[0], None
+
+ try:
+ cmds[function_name](current_buffer, args)
+ except KeyError:
+ w.prnt("", "Command not found: " + function_name)
+ return w.WEECHAT_RC_OK
+
+def command_p(current_buffer, args):
+ w.prnt("", "{}".format(eval(args)))
###### NEW EXCEPTIONS
@@ -1040,11 +1345,11 @@ def dbg(message, main_buffer=False, fout=False):
if fout:
file('/tmp/debug.log', 'a+').writelines(message + '\n')
if main_buffer:
- w.prnt("", "---------")
+ #w.prnt("", "---------")
w.prnt("", "slack: " + message)
else:
if slack_debug and (not debug_string or debug_string in message):
- w.prnt(slack_debug, "---------")
+ #w.prnt(slack_debug, "---------")
w.prnt(slack_debug, message)
@@ -1170,30 +1475,31 @@ if __name__ == "__main__":
# attach to the weechat hooks we need
#w.hook_timer(1000, 0, 0, "typing_update_cb", "")
- #w.hook_timer(1000, 0, 0, "buffer_list_update_cb", "")
+ w.hook_timer(1000, 0, 0, "buffer_list_update_callback", "EVENTROUTER")
w.hook_timer(1000 * 60 * 29, 0, 0, "slack_never_away_cb", "")
w.hook_timer(1000 * 60 * 5, 0, 0, "cache_write_cb", "")
w.hook_signal('buffer_closing', "buffer_closing_callback", "EVENTROUTER")
- w.hook_signal('buffer_opened', "buffer_opened_cb", "")
+ #w.hook_signal('buffer_opened', "buffer_opened_cb", "")
w.hook_signal('buffer_switch', "buffer_switch_callback", "EVENTROUTER")
w.hook_signal('window_switch', "buffer_switch_callback", "EVENTROUTER")
#w.hook_signal('input_text_changed', "typing_notification_cb", "")
w.hook_signal('quit', "quit_notification_cb", "")
w.hook_signal('window_scrolled', "scrolled_cb", "")
- #w.hook_command(
- # # Command name and description
- # 'slack', 'Plugin to allow typing notification and sync of read markers for slack.com',
- # # Usage
- # '[command] [command options]',
- # # Description of arguments
- # 'Commands:\n' +
- # '\n'.join(cmds.keys()) +
- # '\nUse /slack help [command] to find out more\n',
- # # Completions
- # '|'.join(cmds.keys()),
- # # Function name
- # 'slack_command_cb', '')
- # w.hook_command('me', 'me_command_cb', '')
+ cmds = {k[8:]: v for k, v in globals().items() if k.startswith("command_")}
+ w.hook_command(
+ # Command name and description
+ 'slack', 'Plugin to allow typing notification and sync of read markers for slack.com',
+ # Usage
+ '[command] [command options]',
+ # Description of arguments
+ 'Commands:\n' +
+ '\n'.join(cmds.keys()) +
+ '\nUse /slack help [command] to find out more\n',
+ # Completions
+ '|'.join(cmds.keys()),
+ # Function name
+ 'slack_command_cb', '')
+ w.hook_command('me', 'me_command_cb', '')
w.hook_command('me', '', 'stuff', 'stuff2', '', 'me_command_cb', '')
w.hook_command_run('/query', 'join_command_cb', '')
w.hook_command_run('/join', 'join_command_cb', '')
@@ -1210,8 +1516,6 @@ if __name__ == "__main__":
tok = config.slack_api_token.split(',')[0]
s = SlackRequest(tok, 'rtm.start', {})
- #async_slack_api_request("slack.com", self.token, "rtm.start", {"ts": t})
- #s = SlackRequest('xoxoxoxox', "blah.get", {"meh": "blah"})
global EVENTROUTER
EVENTROUTER = EventRouter()
EVENTROUTER.receive(s)