Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const nameMap = new Map<string, `${number}`>([
// 運営
["KOBAYASHI Yuki / 小林", "502798784959479808"],
["Yasumura Takuya / 安村拓也", "1225332719068643424"],
["SHIBAYAMAKeiichiro", "660420646261489674"],
["MANABEKaichi", "1119186793099710514"],
["Ryuhei TAKANAKA", "905761740665528370"],
["Hiroki Oya / 大矢宏輝", "735679928007131213"],
["中村渉吾 (Shogo Nakamura)", "703588743738687488"],

// 運営ではないけど運営タスクに名前のある人
["川端 悠斗", "943071631167860756"],
]);
25 changes: 19 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as v from "valibot";
import { nameMap } from "./data.ts";
import { queryNotion, retry, webhook } from "./io.ts";
import { NotionFetchResponse, type Task } from "./validator.ts";

Expand Down Expand Up @@ -36,19 +37,31 @@ const query = {
],
};

function formatTask(task: Task) {
function formatTask(task: Task): string {
const due = task.properties.期日?.date.start;
const title = task.properties.タイトル?.title.map((title) => title.plain_text).join("");
const assignee = task.properties.担当者?.people.map((person) => person.name).join(" / @");
const assignees = task.properties.担当者?.people.map(
(person): { success: true; id: string } | { success: false; display: string } => {
if (!person.name) return { success: false, display: "-" };
const d_id = nameMap.get(person.name);
if (!d_id) return { success: false, display: person.name };
return { success: true, id: d_id };
},
);

const assignee = assignees
?.map((a) => {
if (a.success) return `<@${a.id}>`;
return `@${a.display}`;
})
.join(" ");

if (!assignee) {
return `・【${due}】${title} (担当者不在)`;
}
return `・【${due}】${title} @${assignee}`;
return `・【${due}】${title} ${assignee}`;
}
/**
- @throws on NetworkError and ParseError
*/

async function main() {
const res = await queryNotion(query);
const json = v.parse(NotionFetchResponse, await res.json());
Expand Down