From 1bc6d1064f663dba3603c3586224abba09aba796 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Thu, 28 May 2015 14:05:27 -0400 Subject: [PATCH] Put channel id on same line as "Reply above this line" Signed-off-by: Anna Schumaker --- slackmail.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/slackmail.py b/slackmail.py index c7ee2ef..c693c5d 100644 --- a/slackmail.py +++ b/slackmail.py @@ -4,9 +4,12 @@ import slack import smtplib from email.mime.text import MIMEText +import textwrap s = smtplib.SMTP("localhost") +repl = "--- Reply above this line ---".ljust(40) + for channel in slack.channels.list(): @@ -15,11 +18,12 @@ for channel in slack.channels.list(): if channel.unread_count() == 0 or channel.unread_count() == None: continue - text = [ str(channel) ] + [ "" ] + chan = ("channel=%s" % channel.id()).rjust(40) + text = [ "", "%s%s" % (repl, chan), ""] + text += [ str(channel) ] + [ "" ] for message in channel.read(): text += [ str(message) ] - text += [ "", "--- Reply above this line ---", "channel=%s" % channel.id() ] print("\n".join(text)) print()