diff options
author | Tollef Fog Heen <tfheen@err.no> | 2018-03-09 19:40:32 +0100 |
---|---|---|
committer | Tollef Fog Heen <tfheen@err.no> | 2018-03-09 19:40:32 +0100 |
commit | 2c24613266668c68c95ce775dd26a398beaab638 (patch) | |
tree | 2f4990ba16cd571e057ba03f0647cb9f382e868f /wee_slack.py | |
parent | b78cea92bfff82358da6289bb6e69e8c6b0ecf88 (diff) | |
download | wee-slack-2c24613266668c68c95ce775dd26a398beaab638.tar.gz |
Drop is_bot and format bot messages as such again
is_bot seems to no longer be a thing, so drop that setting. For
messages from bots with username set in the message, use that
username, but mark it as a bot message.
Fixes #519
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/wee_slack.py b/wee_slack.py index 582c5c2..a344be6 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2009,14 +2009,16 @@ class SlackMessage(object): name_plain = self.team.users[self.team.myidentifier].name elif self.message_json['user'] in self.team.users: u = self.team.users[self.message_json['user']] - if u.is_bot: - name = "{} :]".format(u.formatted_name()) - else: - name = "{}".format(u.formatted_name()) + name = "{}".format(u.formatted_name()) name_plain = "{}".format(u.formatted_name(enable_color=False)) elif 'username' in self.message_json: - name = "-{}-".format(self.message_json["username"]) - name_plain = "{}".format(self.message_json["username"]) + u = self.message_json["username"] + if self.message_json.get("subtype") == "bot_message": + name = "{} :]".format(u) + name_plain = "{}".format(u) + else: + name = "-{}-".format(u) + name_plain = "{}".format(u) elif 'service_name' in self.message_json: name = "-{}-".format(self.message_json["service_name"]) name_plain = "{}".format(self.message_json["service_name"]) |