INNER CODE UNIT · Python
handler_shortcuts
meetbryce/open-source-slack-ai · ossai/handlers.py:49
async def handler_shortcuts(
slack_context: SlackContext, is_private: bool, payload, say, user_id: str
):
client = slack_context.client
channel_id = (
payload["channel"]["id"] if payload["channel"]["id"] else payload["channel_id"]
)
dm_channel_id = await slack_context.get_direct_message_channel_id(user_id)
channel_id_for_say = dm_channel_id if is_private else channel_id
await say(channel=channel_id_for_say, text="...")
response = slack_context.client.conversations_replies(
channel=channel_id, ts=payload["message_ts"]
)
if response["ok"]:
messages = response["messages"]
original_message = messages[0]["text"]
workspace_name = slack_context.get_workspace_name()