diff --git a/slack/chat.py b/slack/chat.py index fe28216..7a510e5 100644 --- a/slack/chat.py +++ b/slack/chat.py @@ -3,9 +3,7 @@ # from . import api from . import auth -from urllib import request def postMessage(channel, text): - post = request.quote(text) api.call("chat.postMessage", token = auth.token(), channel = channel, - text = post, as_user = True, parse = "full") + text = text, as_user = True, parse = "full") diff --git a/slackpost.py b/slackpost.py index 641f6f2..f671de1 100755 --- a/slackpost.py +++ b/slackpost.py @@ -25,5 +25,13 @@ for c in slack.channels.list(): if channel == None: sys.exit(1) -text = headers.get_payload().split("\n")[0] +lines = headers.get_payload().strip().split("\n") + +# Strip out quoted text +if lines[-1][0] == ">": + while lines[-1][0] == ">": + lines.pop(-1) + lines.pop(-1) + +text = ' '.join(lines).strip() channel.post(text)