diff options
author | Ryan Huber <rhuber@gmail.com> | 2015-06-01 11:30:31 -0700 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2015-06-01 11:30:31 -0700 |
commit | 32b784d7ef362b7866e174a578fc27010c06bddb (patch) | |
tree | 724c723775bc73ab1060411ded6d864de2ebe67f | |
parent | ecb64c892250bdfa9e72440b6d65c20122b0dc60 (diff) | |
download | wee-slack-32b784d7ef362b7866e174a578fc27010c06bddb.tar.gz |
handle archived channels + make "@" work
-rw-r--r-- | wee_slack.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index ba6b934..a0a38d6 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -470,7 +470,7 @@ class Channel(SlackThing): def linkify_text(self, message): message = message.split(' ') for item in enumerate(message): - if item[1].startswith('@'): + if item[1].startswith('@') and len(item[1]) > 1: named = re.match('.*[@#](\w+)(\W*)', item[1]).groups() if named[0] in ["group", "channel"]: message[item[0]] = "<!{}>".format(named[0]) @@ -1115,6 +1115,11 @@ def process_channel_leave(message_json): channel.user_leave(message_json["user"]) +def process_channel_archive(message_json): + channel = server.channels.find(message_json["channel"]) + channel.detach_buffer() + + def process_group_left(message_json): server = servers.find(message_json["myserver"]) server.channels.find(message_json["channel"]).close(False) @@ -1129,6 +1134,11 @@ def process_group_joined(message_json): server.channels.append(GroupChannel(server, item["name"], item["id"], item["is_open"], item["last_read"], "#", item["members"], item["topic"]["value"])) +def process_group_archive(message_json): + channel = server.channels.find(message_json["channel"]) + channel.detach_buffer() + + def process_im_close(message_json): server = servers.find(message_json["myserver"]) server.channels.find(message_json["channel"]).close(False) |