slackmail/slack/threads.py

21 lines
600 B
Python

#
# Copyright 2015 (c) Anna Schumaker.
#
class Thread:
def __init__(self, json):
self.__id = json.get("id", 0)
self.__name = json.get("name", "").title()
self.__topic = json["topic"].get("value", "").encode("utf-8").decode("latin-1")
self.__purpose = json["purpose"].get("value", "").encode("utf-8").decode("latin-1")
def __str__(self):
topic=""
if self.__topic != "":
topic = "\nTopic: %s" % self.__topic
return "%s: %s%s" % (self.__name, self.__purpose, topic)
def name(self):
return self.__name