From bd4e444d1c9a1c49d10e7d73655a7a91737c1bf9 Mon Sep 17 00:00:00 2001 From: Tomas Zijdemans Date: Thu, 28 Sep 2023 10:42:31 +0200 Subject: [PATCH] update triggers with new types --- triggers/display_leaderboard_trigger.ts | 7 ++++--- triggers/display_weekly_stats.ts | 7 ++++--- triggers/log_run_trigger.ts | 9 +++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/triggers/display_leaderboard_trigger.ts b/triggers/display_leaderboard_trigger.ts index 37a51b7..4f949b1 100644 --- a/triggers/display_leaderboard_trigger.ts +++ b/triggers/display_leaderboard_trigger.ts @@ -1,19 +1,20 @@ import { Trigger } from "deno-slack-sdk/types.ts"; +import { TriggerContextData, TriggerTypes } from "deno-slack-api/mod.ts"; import DisplayLeaderboardWorkflow from "../workflows/display_leaderboard_workflow.ts"; const DisplayLeaderboardTrigger: Trigger< typeof DisplayLeaderboardWorkflow.definition > = { - type: "shortcut", + type: TriggerTypes.Shortcut, name: "Display the leaderboard", description: "Show stats for the team and individual runners", workflow: `#/workflows/${DisplayLeaderboardWorkflow.definition.callback_id}`, inputs: { interactivity: { - value: "{{data.interactivity}}", + value: TriggerContextData.Shortcut.interactivity, }, channel: { - value: "{{data.channel_id}}", + value: TriggerContextData.Shortcut.channel_id, }, }, }; diff --git a/triggers/display_weekly_stats.ts b/triggers/display_weekly_stats.ts index c0c6e43..920698e 100644 --- a/triggers/display_weekly_stats.ts +++ b/triggers/display_weekly_stats.ts @@ -1,19 +1,20 @@ import { Trigger } from "deno-slack-sdk/types.ts"; +import { TriggerContextData, TriggerTypes } from "deno-slack-api/mod.ts"; import DisplayLeaderboardWorkflow from "../workflows/display_leaderboard_workflow.ts"; const DisplayWeeklyStats: Trigger< typeof DisplayLeaderboardWorkflow.definition > = { - type: "scheduled", + type: TriggerTypes.Scheduled, name: "Display weekly stats", description: "Display weekly running stats on a schedule", workflow: `#/workflows/${DisplayLeaderboardWorkflow.definition.callback_id}`, inputs: { interactivity: { - value: "{{data.interactivity}}", + value: TriggerContextData.Shortcut.interactivity, }, channel: { - value: "{{data.channel_id}}", + value: TriggerContextData.Shortcut.channel_id, }, }, schedule: { diff --git a/triggers/log_run_trigger.ts b/triggers/log_run_trigger.ts index c1ea410..a1ae153 100644 --- a/triggers/log_run_trigger.ts +++ b/triggers/log_run_trigger.ts @@ -1,20 +1,21 @@ import { Trigger } from "deno-slack-sdk/types.ts"; +import { TriggerContextData, TriggerTypes } from "deno-slack-api/mod.ts"; import LogRunWorkflow from "../workflows/log_run_workflow.ts"; const LogRunTrigger: Trigger = { - type: "shortcut", + type: TriggerTypes.Shortcut, name: "Log a run", description: "Save the details of a recent run", workflow: `#/workflows/${LogRunWorkflow.definition.callback_id}`, inputs: { interactivity: { - value: "{{data.interactivity}}", + value: TriggerContextData.Shortcut.interactivity, }, channel: { - value: "{{data.channel_id}}", + value: TriggerContextData.Shortcut.channel_id, }, user_id: { - value: "{{data.user_id}}", + value: TriggerContextData.Shortcut.user_id, }, }, };