INNER CODE UNIT · Python
handler_action_summarize_since_date
meetbryce/open-source-slack-ai · ossai/handlers.py:205
async def handler_action_summarize_since_date(slack_context: SlackContext, ack, body):
"""
Provide a message summary of the channel since a given date.
"""
await ack()
client = slack_context.client
channel_name = body["channel"]["name"]
channel_id = body["channel"]["id"]
user_id = body["user"]["id"]
feature_name = body["actions"][0]["action_id"]
# todo: make util function for testability
# todo: account for the user's timezone :melt:
if feature_name == "summarize_since_preset":
since_datetime: datetime = datetime.fromtimestamp(
int(body["actions"][0]["selected_option"]["value"])
).date()
else: