aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorKeith Smiley <keithbsmiley@gmail.com>2015-12-22 20:53:37 -0800
committerKeith Smiley <keithbsmiley@gmail.com>2015-12-23 12:03:58 -0800
commit7ca433bfc981fdbd4cf54e79f1ecf9dec7bcd867 (patch)
tree167139a720c64bd4edaf1e75e04c413741675511 /wee_slack.py
parent24b5d143282f9d210b4aea8c9b18f3a65029dea1 (diff)
downloadwee-slack-7ca433bfc981fdbd4cf54e79f1ecf9dec7bcd867.tar.gz
Add mpdm channel
This adds a new channel type for mpdms which formats as "#first,second,third" This includes the current user's username, which we may want to exclude.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index c8d24ee..44ae072 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -291,7 +291,10 @@ class SlackServer(object):
if "last_read" not in item:
item["last_read"] = 0
if not item["is_archived"]:
- self.add_channel(GroupChannel(self, item["name"], item["id"], item["is_open"], item["last_read"], "#", item["members"], item["topic"]["value"]))
+ if item["name"].startswith("mpdm-"):
+ self.add_channel(MpdmChannel(self, item["name"], item["id"], item["is_open"], item["last_read"], "#", item["members"], item["topic"]["value"]))
+ else:
+ self.add_channel(GroupChannel(self, item["name"], item["id"], item["is_open"], item["last_read"], "#", item["members"], item["topic"]["value"]))
for item in data["ims"]:
if "last_read" not in item:
item["last_read"] = 0
@@ -723,6 +726,12 @@ class GroupChannel(Channel):
super(GroupChannel, self).__init__(server, name, identifier, active, last_read, prepend_name, members, topic)
self.type = "group"
+class MpdmChannel(Channel):
+
+ def __init__(self, server, name, identifier, active, last_read=0, prepend_name="", members=[], topic=""):
+ name = ",".join("-".join(name.split("-")[1:-1]).split("--"))
+ super(MpdmChannel, self).__init__(server, name, identifier, active, last_read, prepend_name, members, topic)
+ self.type = "group"
class DmChannel(Channel):