Slack: Support private channels

This commit is contained in:
Felipe M 2021-02-02 12:55:26 +01:00
parent 8e7c6eedba
commit 7f6830e377
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
1 changed files with 16 additions and 3 deletions

View File

@ -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