mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-18 03:34:20 +00:00
feat: add support for slack
This commit is contained in:
@@ -16,11 +16,9 @@ class SlackEvent(dict):
|
||||
for el in elements:
|
||||
if el.get("type") == "text":
|
||||
return el.get("text", "")
|
||||
|
||||
if self.get("event",{}).get("channel_type") == "channel":
|
||||
elements = self["event"]["blocks"][0]["elements"][0]["elements"]
|
||||
text_result = next((el["text"] for el in elements if el["type"] == "text"), "")
|
||||
return text_result
|
||||
if self.get("event",{}).get("channel_type") == 'channel':
|
||||
message_text = next((el["text"] for block in self.get("event", {}).get("blocks", []) if block.get("type") == "rich_text" for element in block.get("elements", []) if element.get("type") == "rich_text_section" for el in element.get("elements", []) if el.get("type") == "text"), "")
|
||||
return message_text
|
||||
|
||||
|
||||
return ""
|
||||
@@ -49,7 +47,7 @@ class SlackEvent(dict):
|
||||
files = self.get("event", {}).get("files", [])
|
||||
if files:
|
||||
return files[0].get("url_private", "")
|
||||
return ""
|
||||
return None
|
||||
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user