Use team name instead of [SlackMail] for temporary file paths
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
fdc2c9970e
commit
0892ec28e7
11
slackmail.py
11
slackmail.py
|
@ -37,8 +37,10 @@ def call_method_auth(method, args = dict()):
|
||||||
#
|
#
|
||||||
if call_method("api.test")["ok"] == False:
|
if call_method("api.test")["ok"] == False:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if call_method_auth("auth.test")["ok"] == False:
|
auth = call_method_auth("auth.test")
|
||||||
|
if auth["ok"] == False:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
team = auth["team"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,15 +86,18 @@ def write_message(fout, message):
|
||||||
_write_message(fout, name, message)
|
_write_message(fout, name, message)
|
||||||
|
|
||||||
|
|
||||||
|
tmp_dir = "/tmp/%s" % team
|
||||||
|
if not os.path.exists(tmp_dir):
|
||||||
|
os.mkdir(tmp_dir)
|
||||||
|
|
||||||
os.mkdir("/tmp/slackmail/")
|
|
||||||
for id in list_channel_ids():
|
for id in list_channel_ids():
|
||||||
channel = find_channel_info(id)
|
channel = find_channel_info(id)
|
||||||
if not channel["is_member"]:
|
if not channel["is_member"]:
|
||||||
continue
|
continue
|
||||||
if channel["unread_count"] == 0:
|
if channel["unread_count"] == 0:
|
||||||
continue
|
continue
|
||||||
fout = open("/tmp/slackmail/%s" % channel["name"], 'w')
|
|
||||||
|
fout = open("%s/%s" % (tmp_dir, channel["name"]), 'w')
|
||||||
fout.write(channel["purpose"]["value"].encode("utf-8").decode("latin-1"))
|
fout.write(channel["purpose"]["value"].encode("utf-8").decode("latin-1"))
|
||||||
fout.write("\n")
|
fout.write("\n")
|
||||||
for message in read_channel(id, channel["last_read"]):
|
for message in read_channel(id, channel["last_read"]):
|
||||||
|
|
Loading…
Reference in New Issue