tickflow-assist 0.2.2 → 0.2.3
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.
|
@@ -319,13 +319,14 @@ async function discoverConfiguredChannels(configPath) {
|
|
|
319
319
|
}
|
|
320
320
|
async function promptSelect(rl, label, choices, defaultValue) {
|
|
321
321
|
const defaultIndex = Math.max(0, choices.findIndex((c) => c.value === defaultValue));
|
|
322
|
-
|
|
322
|
+
let promptText = `\n ${label}\n`;
|
|
323
323
|
for (let i = 0; i < choices.length; i++) {
|
|
324
324
|
const marker = i === defaultIndex ? " (默认)" : "";
|
|
325
|
-
|
|
325
|
+
promptText += ` ${i + 1}) ${choices[i].label}${marker}\n`;
|
|
326
326
|
}
|
|
327
|
+
promptText += ` 请选择 (1-${choices.length}) [${defaultIndex + 1}]: `;
|
|
327
328
|
while (true) {
|
|
328
|
-
const answer = (await rl.question(
|
|
329
|
+
const answer = (await rl.question(promptText)).trim();
|
|
329
330
|
if (!answer) {
|
|
330
331
|
return choices[defaultIndex].value;
|
|
331
332
|
}
|
|
@@ -340,13 +341,12 @@ async function promptAlertChannel(rl, configPath, defaultChannel) {
|
|
|
340
341
|
const configured = await discoverConfiguredChannels(configPath);
|
|
341
342
|
let selectedChannel = defaultChannel;
|
|
342
343
|
if (configured.length > 0) {
|
|
343
|
-
console.log(" 检测到 openclaw.json 中已有通道配置:");
|
|
344
344
|
const choices = configured.map((c) => {
|
|
345
345
|
const acctLabel = c.accounts.length > 0 ? ` (accounts: ${c.accounts.join(", ")})` : "";
|
|
346
346
|
return { value: c.channel, label: `${c.channel}${acctLabel}` };
|
|
347
347
|
});
|
|
348
348
|
choices.push({ value: "__manual__", label: "手动输入其他通道" });
|
|
349
|
-
selectedChannel = await promptSelect(rl, "
|
|
349
|
+
selectedChannel = await promptSelect(rl, "检测到 openclaw.json 中已有配置,请选择推送通道", choices, defaultChannel);
|
|
350
350
|
if (selectedChannel === "__manual__") {
|
|
351
351
|
selectedChannel = await promptString(rl, "Alert Channel", defaultChannel, true);
|
|
352
352
|
}
|
|
@@ -354,6 +354,7 @@ async function promptAlertChannel(rl, configPath, defaultChannel) {
|
|
|
354
354
|
else {
|
|
355
355
|
const knownChannels = [
|
|
356
356
|
{ value: "telegram", label: "telegram" },
|
|
357
|
+
{ value: "discord", label: "discord" },
|
|
357
358
|
{ value: "qqbot", label: "qqbot" },
|
|
358
359
|
{ value: "wecom", label: "wecom" },
|
|
359
360
|
];
|
|
@@ -434,11 +435,14 @@ async function promptForConfig(options, existing, pluginDir, configPath) {
|
|
|
434
435
|
const alertResult = await promptAlertChannel(rl, configPath, seed.alertChannel);
|
|
435
436
|
seed.alertChannel = alertResult.channel;
|
|
436
437
|
seed.alertAccount = alertResult.account;
|
|
437
|
-
|
|
438
|
+
let targetLabel = "Alert Target";
|
|
438
439
|
if (seed.alertAccount) {
|
|
439
|
-
|
|
440
|
+
targetLabel = `已选通道 [${seed.alertChannel}] 及账号 [${seed.alertAccount}],请输入 Alert Target`;
|
|
440
441
|
}
|
|
441
|
-
|
|
442
|
+
else {
|
|
443
|
+
targetLabel = `已选通道 [${seed.alertChannel}],请输入 Alert Target`;
|
|
444
|
+
}
|
|
445
|
+
seed.alertTarget = await promptString(rl, targetLabel, seed.alertTarget, true);
|
|
442
446
|
seed.requestInterval = await promptInteger(rl, "Request Interval (seconds)", seed.requestInterval, 5);
|
|
443
447
|
seed.dailyUpdateNotify = await promptBoolean(rl, "Daily Update Notify", seed.dailyUpdateNotify);
|
|
444
448
|
}
|
package/openclaw.plugin.json
CHANGED