diff --git a/slack/__init__.py b/slack/__init__.py index 4ec27e9..6a50cb7 100644 --- a/slack/__init__.py +++ b/slack/__init__.py @@ -27,12 +27,16 @@ __auth = auth.test() if __auth == None: sys.exit(1) __TEAM = __auth["team"] +__URL = __auth["url"].rstrip("/") __USER = users.info(__auth["user_id"]) def team(): return __TEAM +def url(): + return __URL + def user(): return __USER diff --git a/slack/threads.py b/slack/threads.py index 723daf0..eb13144 100644 --- a/slack/threads.py +++ b/slack/threads.py @@ -42,6 +42,9 @@ class Thread: def name(self): return self.__name + def url(self, base): + return "%s/messages/%s/" % (base, self.__name) + def read(self): if self.__last_ts == None: self.fetch_info() diff --git a/slackmail.py b/slackmail.py index 9fd5b6c..8c3bece 100644 --- a/slackmail.py +++ b/slackmail.py @@ -21,6 +21,7 @@ def mail_thread(thread): text = [ header, "" ] for message in thread.read(): text += [ str(message) ] + text += [ "\n", thread.url(slack.url()) ] print("\n".join(text)) print()