@goodnesshq/opencode-notification 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/notify-init.mjs +17 -11
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ const DEFAULTS = {
|
|
|
37
37
|
topic: "",
|
|
38
38
|
},
|
|
39
39
|
telegram: {
|
|
40
|
-
enabled:
|
|
40
|
+
enabled: true,
|
|
41
41
|
token: "",
|
|
42
42
|
chatId: "",
|
|
43
43
|
},
|
|
@@ -551,17 +551,10 @@ async function main() {
|
|
|
551
551
|
? await promptConfirm("Enable ntfy notifications?", true)
|
|
552
552
|
: yesNo(await rl.question("Enable ntfy notifications? (Y/n) [Y] "), true);
|
|
553
553
|
|
|
554
|
-
const telegramEnabled = interactive
|
|
555
|
-
? await promptConfirm("Enable Telegram notifications?", false)
|
|
556
|
-
: yesNo(await rl.question("Enable Telegram notifications? (y/N) [N] "), false);
|
|
557
|
-
|
|
558
554
|
let globalConfig = await readJson(GLOBAL_CONFIG_PATH);
|
|
559
555
|
if (!globalConfig) globalConfig = {};
|
|
560
556
|
if (!globalConfig.ntfy) globalConfig.ntfy = {};
|
|
561
557
|
|
|
562
|
-
let telegramToken = "";
|
|
563
|
-
let telegramChatId = "";
|
|
564
|
-
|
|
565
558
|
if (ntfyEnabled) {
|
|
566
559
|
const serverInput = interactive
|
|
567
560
|
? await promptInput(
|
|
@@ -583,14 +576,27 @@ async function main() {
|
|
|
583
576
|
if (topicInput.trim()) globalConfig.ntfy.topic = topicInput.trim();
|
|
584
577
|
}
|
|
585
578
|
|
|
579
|
+
const telegramEnabled = interactive
|
|
580
|
+
? await promptConfirm("Enable Telegram notifications?", true)
|
|
581
|
+
: yesNo(await rl.question("Enable Telegram notifications? (Y/n) [Y] "), true);
|
|
582
|
+
|
|
583
|
+
let telegramToken = "";
|
|
584
|
+
let telegramChatId = "";
|
|
585
|
+
|
|
586
586
|
if (telegramEnabled) {
|
|
587
587
|
const tokenInput = interactive
|
|
588
588
|
? await promptInput("Telegram bot token: ")
|
|
589
589
|
: await rl.question("Telegram bot token: ");
|
|
590
|
-
const chatIdInput = interactive
|
|
591
|
-
? await promptInput("Telegram chat ID (see docs/telegram-chat-id.md): ")
|
|
592
|
-
: await rl.question("Telegram chat ID (see docs/telegram-chat-id.md): ");
|
|
593
590
|
telegramToken = tokenInput.trim();
|
|
591
|
+
if (telegramToken) {
|
|
592
|
+
console.log("\nFind your Telegram chat ID:");
|
|
593
|
+
console.log(" - In Telegram, open the chat info and copy the Peer ID.");
|
|
594
|
+
console.log(" - For 1:1 chats, the chat ID is the Peer ID.");
|
|
595
|
+
console.log(" - For groups, prefix the Peer ID with '-'.\n");
|
|
596
|
+
}
|
|
597
|
+
const chatIdInput = interactive
|
|
598
|
+
? await promptInput("Telegram chat ID: ")
|
|
599
|
+
: await rl.question("Telegram chat ID: ");
|
|
594
600
|
telegramChatId = chatIdInput.trim();
|
|
595
601
|
}
|
|
596
602
|
|