@delt/claude-alarm 0.6.13 → 0.6.15
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/dist/cli.js +12 -2
- package/dist/cli.js.map +1 -1
- package/dist/hub/server.js +12 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -329,8 +329,8 @@ var init_telegram = __esm({
|
|
|
329
329
|
}
|
|
330
330
|
/** Send a notification message to Telegram */
|
|
331
331
|
async sendNotification(sessionId2, _sessionLabel, title, message) {
|
|
332
|
-
const text =
|
|
333
|
-
${message}`;
|
|
332
|
+
const text = `<b>${this.escHtml(title)}</b>
|
|
333
|
+
${this.mdToHtml(message)}`;
|
|
334
334
|
const result = await this.sendMessage(text);
|
|
335
335
|
if (result?.message_id) {
|
|
336
336
|
this.messageSessionMap.set(result.message_id, sessionId2);
|
|
@@ -625,6 +625,16 @@ ${label}`);
|
|
|
625
625
|
escHtml(s) {
|
|
626
626
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
627
627
|
}
|
|
628
|
+
/** Convert markdown to Telegram HTML (escape first, then apply formatting) */
|
|
629
|
+
mdToHtml(s) {
|
|
630
|
+
let html = this.escHtml(s);
|
|
631
|
+
html = html.replace(/```(?:\w*)\n?([\s\S]*?)```/g, "<pre>$1</pre>");
|
|
632
|
+
html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
633
|
+
html = html.replace(/^#{1,3}\s+(.+)$/gm, "<b>$1</b>");
|
|
634
|
+
html = html.replace(/\*\*(.+?)\*\*/g, "<b>$1</b>");
|
|
635
|
+
html = html.replace(/\*(.+?)\*/g, "<i>$1</i>");
|
|
636
|
+
return html;
|
|
637
|
+
}
|
|
628
638
|
/** Update config (e.g., from dashboard settings) */
|
|
629
639
|
updateConfig(config2) {
|
|
630
640
|
const wasPolling = this.polling;
|