Send status report directly via Telegram for proper markdown rendering
Previously status.mjs relied on OpenClaw relaying stdout, which sent as plain text. Now sends via sendTelegram() directly when Telegram config is present, matching how all other scripts send notifications. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
14
status.mjs
14
status.mjs
@@ -3,6 +3,7 @@
|
||||
* status.mjs — claw-apply status report
|
||||
* Outputs structured JSON for agent formatting
|
||||
* Run: node status.mjs [--json]
|
||||
* Sends formatted status to Telegram if configured, and prints to stdout.
|
||||
*/
|
||||
import { readFileSync, existsSync } from 'fs';
|
||||
import { dirname, resolve } from 'path';
|
||||
@@ -259,17 +260,16 @@ function formatReport(s) {
|
||||
import { loadConfig } from './lib/queue.mjs';
|
||||
import { sendTelegram } from './lib/notify.mjs';
|
||||
|
||||
const telegramMode = process.argv.includes('--telegram');
|
||||
const status = buildStatus();
|
||||
|
||||
if (jsonMode) {
|
||||
console.log(JSON.stringify(status, null, 2));
|
||||
} else if (telegramMode) {
|
||||
} else {
|
||||
const report = formatReport(status);
|
||||
const settings = loadConfig(resolve(__dir, 'config/settings.json'));
|
||||
await sendTelegram(settings, report);
|
||||
console.log('Status sent to Telegram');
|
||||
} else {
|
||||
// Console output keeps markdown * for agents that relay stdout to Telegram
|
||||
console.log(formatReport(status));
|
||||
// Always send via Telegram directly if configured (so markdown renders)
|
||||
if (settings.notifications?.bot_token && settings.notifications?.telegram_user_id) {
|
||||
await sendTelegram(settings, report);
|
||||
}
|
||||
console.log(report);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user