diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2018-08-19 19:11:19 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2018-08-19 19:11:19 +0200 |
commit | 0cdf3b42cbd2f6f4127fa587a024d7227a594663 (patch) | |
tree | 85b6c3378f8415adb8cc4ad9ffb2f3b0afd2c85b | |
parent | 71a2e61e21c869e49c45549bf9176cdc63bb1e80 (diff) | |
download | wee-slack-0cdf3b42cbd2f6f4127fa587a024d7227a594663.tar.gz |
Keep nick when actions (/me messages) are edited
Fixes #463
-rw-r--r-- | wee_slack.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py index e53076f..c47ecc3 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2101,20 +2101,21 @@ class SlackMessage(object): if text and text.startswith('_') and text.endswith('_') and 'subtype' not in message_json: message_json['text'] = text[1:-1] message_json['subtype'] = 'me_message' - if message_json.get('subtype') == 'me_message' and not message_json['text'].startswith(self.sender): - message_json['text'] = self.sender + ' ' + self.message_json['text'] def __hash__(self): return hash(self.ts) def render(self, force=False): text = render(self.message_json, self.team, self.channel, force) + if (self.message_json.get('subtype') == 'me_message' and + not self.message_json['text'].startswith(self.sender)): + text = "{} {}".format(self.sender, text) if len(self.submessages) > 0: - thread_text = "{}[ Thread: {} Replies: {} ]".format( + text = "{} {}[ Thread: {} Replies: {} ]".format( + text, w.color(config.thread_suffix_color), self.hash or self.ts, len(self.submessages)) - return "{} {}".format(text, thread_text) return text def change_text(self, new_text): |