Skip to content

Commit a09ac34

Browse files
fix: derive highlight key from report name instead of hardcoded map
1 parent 54aa86e commit a09ac34

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/notify-vi.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ const LABELS: Record<string, string> = {
3030
"ai-monthly-vi": "AI Tools Monthly",
3131
};
3232

33-
const HIGHLIGHT_KEY: Record<string, string> = {
34-
"ai-cli-vi": "ai-cli",
35-
"ai-agents-vi": "ai-agents",
36-
"ai-web-vi": "ai-web",
37-
"ai-trending-vi": "ai-trending",
38-
"ai-hn-vi": "ai-hn",
39-
};
40-
4133
async function sendTelegram(text: string): Promise<void> {
4234
const BOT_TOKEN = process.env["TELEGRAM_BOT_TOKEN"] ?? "";
4335
const CHAT_ID = process.env["TELEGRAM_CHAT_ID"] ?? "";
@@ -103,8 +95,8 @@ function buildMessage(date: string, reports: string[]): string {
10395
lines.push("");
10496
lines.push(`• <a href="${url}">${label}</a>`);
10597

106-
const hKey = HIGHLIGHT_KEY[r];
107-
const items = hKey ? highlights[hKey] : undefined;
98+
const hKey = r.replace(/-vi$/, "");
99+
const items = highlights[hKey];
108100
if (items?.length) {
109101
for (const h of items) {
110102
lines.push(` ◦ ${h}`);

0 commit comments

Comments
 (0)