@gonzih/cc-discord 0.2.12 → 0.2.13
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/notifier.js +8 -7
- package/package.json +1 -1
package/dist/notifier.js
CHANGED
|
@@ -47,13 +47,12 @@ export function parseNotification(raw) {
|
|
|
47
47
|
let isCron = false;
|
|
48
48
|
try {
|
|
49
49
|
const parsed = JSON.parse(raw);
|
|
50
|
-
// Drop cron-fire pings (⏰ …) — job completion notifications (✅/❌) still pass through
|
|
51
|
-
if (parsed.is_cron === true && parsed.text?.startsWith("⏰"))
|
|
52
|
-
return null;
|
|
53
50
|
// routing: absent/empty → all transports; non-empty → only listed transports
|
|
54
51
|
if (parsed.routing && parsed.routing.length > 0 && !parsed.routing.includes("discord")) {
|
|
55
52
|
return null;
|
|
56
53
|
}
|
|
54
|
+
if (parsed.is_cron === true)
|
|
55
|
+
return null;
|
|
57
56
|
if (parsed.text)
|
|
58
57
|
text = parsed.text;
|
|
59
58
|
driver = parsed.driver;
|
|
@@ -211,12 +210,14 @@ export function startNotifier(bot, notifyChannelId, namespace, redis, handleUser
|
|
|
211
210
|
const buf = metaAgentBuffers.get(ns);
|
|
212
211
|
if (!buf || !buf.text.trim())
|
|
213
212
|
return;
|
|
214
|
-
const
|
|
213
|
+
const text = `← [${ns}] ` + stripAnsi(buf.text.trim());
|
|
214
|
+
if (text.length < 30) {
|
|
215
|
+
buf.text = "";
|
|
216
|
+
buf.timer = null;
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
215
219
|
buf.text = "";
|
|
216
220
|
buf.timer = null;
|
|
217
|
-
if (rawText.length < 20)
|
|
218
|
-
return;
|
|
219
|
-
const text = `← [${ns}] ` + rawText;
|
|
220
221
|
// During an active loop, route meta-agent output to the thread rather than main channel
|
|
221
222
|
const deliverTo = bot.getLoopThreadId(targetChannelId) ?? targetChannelId;
|
|
222
223
|
const chunks = splitLongMessage(text);
|