aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2015-08-29 00:39:30 +0200
committerTollef Fog Heen <tfheen@err.no>2015-08-29 00:39:30 +0200
commit27144891f1d9280821c5fa99fe4665c2b9b5b682 (patch)
tree50cccc7de6b0bf46e03f7017b6e0a33716f90d0b
parenta37787d8b18dba4864f14611ec48a08cdef67c98 (diff)
downloadwee-slack-27144891f1d9280821c5fa99fe4665c2b9b5b682.tar.gz
Render _foo bar baz_ as action messages
The slack client (and we) change `/me foo bar baz` into a `_foo bar baz_` message. Translate those messages back into actions when displaying them. Fixes: #61
-rw-r--r--wee_slack.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index eae2e1d..a5b4c9e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1428,6 +1428,11 @@ def process_message(message_json, cache=True):
channel.buffer_prnt(w.prefix("join").rstrip(), text, time)
elif message_json.get("subtype", "") == "channel_topic":
channel.buffer_prnt(w.prefix("network").rstrip(), text, time)
+ elif text.startswith("_") and text.endswith("_"):
+ text = text[1:-1]
+ if name != channel.server.nick:
+ text = name + " " + text
+ channel.buffer_prnt(w.prefix("action").rstrip(), text, time)
else:
channel.buffer_prnt(name, text, time)