diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-09-19 01:08:32 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:54 +0100 |
commit | d094323c212587c8bdb68fda7dac2f053143ad32 (patch) | |
tree | dc22c4f9a72bffd49d008bcdc33c54db88a4a20b /slack/slack_conversation.py | |
parent | 15d222cfe645e0f7b62738077cce534285f0169e (diff) | |
download | wee-slack-d094323c212587c8bdb68fda7dac2f053143ad32.tar.gz |
If a message has a user, use that even though it's a bot_message
Messages from Slackbot apparently have both a user and a bot_id, and
sometimes have the subtype bot_message, other times not. However, the
bot_id is B01 which gives bot_not_found when trying to look it up. I see
that the web client shows it with the user profile, and doesn't show the
message as a bot message, so do that here as well to match it and avoid
the invalid bot_id.
Diffstat (limited to 'slack/slack_conversation.py')
-rw-r--r-- | slack/slack_conversation.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py index fefcdfa..5ccd85d 100644 --- a/slack/slack_conversation.py +++ b/slack/slack_conversation.py @@ -302,7 +302,11 @@ class SlackConversation(SlackBuffer): sender_user_ids = [m.sender_user_id for m in messages if m.sender_user_id] self.workspace.users.initialize_items(sender_user_ids) - sender_bot_ids = [m.sender_bot_id for m in messages if m.sender_bot_id] + sender_bot_ids = [ + m.sender_bot_id + for m in messages + if m.sender_bot_id and not m.sender_user_id + ] self.workspace.bots.initialize_items(sender_bot_ids) await gather(*(message.render(self.context) for message in messages)) |