diff --git a/butterrobot/platforms/slack.py b/butterrobot/platforms/slack.py index f8a615e..aa1b133 100644 --- a/butterrobot/platforms/slack.py +++ b/butterrobot/platforms/slack.py @@ -76,11 +76,16 @@ class SlackPlatform(Platform): logger.debug("Discarding message", data=data) return - if data["event"]["type"] != "message": + logger.debug("Parsing message", platform=cls.ID, data=data) + + if data["event"]["type"] not in ("message", "message.groups"): return - logger.debug("Parsing message", platform=cls.ID, data=data) - return Message( + # Surprisingly, this *can* happen. + if "text" not in data["event"]: + return + + message = Message( id=data["event"].get("thread_ts", data["event"]["ts"]), author=data["event"].get("user"), from_bot="bot_id" in data["event"], @@ -90,3 +95,11 @@ class SlackPlatform(Platform): channel=cls.parse_channel_from_message(data), raw=data, ) + + logger.info( + "New message", + platform=message.channel.platform, + channel=cls.parse_channel_name_from_raw(message.channel.channel_raw), + ) + + return message