-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.ts
30 lines (28 loc) · 890 Bytes
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { readLocalConfig } from "./config-reader.ts";
import { Client, writeTextToClipboard } from "./deps.ts";
import { formatOFTMessage } from "./format.ts";
import {
extractFromTasks,
getPropsFromDB,
getCompletedTasks,
} from "./notion.ts";
async function generateMessage() {
const { key, databaseId } = readLocalConfig();
const notion = new Client({ auth: key });
const {
titleProp,
statusProp: [statusPropKey, completedStatuses],
linkProp,
} = await getPropsFromDB(notion, databaseId);
const completedTasks = await getCompletedTasks(
notion,
databaseId,
statusPropKey,
completedStatuses
);
const tasksMetadata = extractFromTasks(completedTasks, titleProp, linkProp);
const slackMsg = formatOFTMessage(tasksMetadata);
writeTextToClipboard(slackMsg);
console.log("Out for Today message copied to clipboard.");
}
generateMessage();