@gonzih/cc-discord 0.2.7 → 0.2.8

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/bot.js CHANGED
@@ -1198,7 +1198,7 @@ export class CcDiscordBot {
1198
1198
  return;
1199
1199
  try {
1200
1200
  session.claude.sendPrompt(stampPrompt(text));
1201
- this.writeChatMessage("user", "cc-tg", text, channelId);
1201
+ this.writeChatMessage("user", "cc-discord", text, channelId);
1202
1202
  }
1203
1203
  catch (err) {
1204
1204
  console.error(`[forwardNotification:${channelId}] failed:`, err.message);
@@ -15,7 +15,7 @@ import { type EvalReport } from "./loop-manager.js";
15
15
  import type { CcDiscordBot } from "./bot.js";
16
16
  export interface ChatMessage {
17
17
  id: string;
18
- source: "discord" | "ui" | "claude" | "cc-tg";
18
+ source: "discord" | "ui" | "claude" | "cc-tg" | "cc-discord";
19
19
  role: "user" | "assistant" | "tool";
20
20
  content: string;
21
21
  timestamp: string;
@@ -24,6 +24,7 @@ export interface ChatMessage {
24
24
  export interface ParsedNotification {
25
25
  text: string;
26
26
  chatId?: number;
27
+ isCron: boolean;
27
28
  /** Populated when the notification JSON contains an `eval_report` object. */
28
29
  evalReport?: EvalReport;
29
30
  }
package/dist/notifier.js CHANGED
@@ -44,6 +44,7 @@ export function parseNotification(raw) {
44
44
  let model;
45
45
  let cost;
46
46
  let chatId;
47
+ let isCron = false;
47
48
  try {
48
49
  const parsed = JSON.parse(raw);
49
50
  // routing: absent/empty → all transports; non-empty → only listed transports
@@ -58,18 +59,20 @@ export function parseNotification(raw) {
58
59
  cost = parsed.cost;
59
60
  if (typeof parsed.chat_id === "number" && parsed.chat_id !== 0)
60
61
  chatId = parsed.chat_id;
62
+ if (typeof parsed.is_cron === "boolean")
63
+ isCron = parsed.is_cron;
61
64
  }
62
65
  catch {
63
- return { text };
66
+ return { text, isCron };
64
67
  }
65
68
  // Parse eval_report if present — this field is non-standard and not in NotificationPayload type
66
69
  const evalReport = parseEvalReport(raw);
67
70
  if (!driver)
68
- return { text, chatId, evalReport: evalReport ?? undefined };
71
+ return { text, chatId, isCron, evalReport: evalReport ?? undefined };
69
72
  const shortModel = shortenModelName(model ?? "", driver);
70
73
  const badge = shortModel ? `${driver}:${shortModel}` : driver;
71
74
  const costStr = cost != null ? ` cost: $${cost.toFixed(3)}` : "";
72
- return { text: `${text}\n[${badge}]${costStr}`, chatId, evalReport: evalReport ?? undefined };
75
+ return { text: `${text}\n[${badge}]${costStr}`, chatId, isCron, evalReport: evalReport ?? undefined };
73
76
  }
74
77
  /**
75
78
  * Write a message to the chat log in Redis.
@@ -298,8 +301,8 @@ export function startNotifier(bot, notifyChannelId, namespace, redis, handleUser
298
301
  bot.sendToChannelById(destChannelId, notification.text).catch((err) => {
299
302
  log("warn", `notify list send failed (ns=${ns}):`, err.message);
300
303
  });
301
- if (forwardNotification) {
302
- forwardNotification(mainChannelId, notification.text);
304
+ if (!notification.isCron && handleUserMessage) {
305
+ handleUserMessage(mainChannelId, notification.text);
303
306
  }
304
307
  }
305
308
  if (remaining > 0) {
@@ -358,8 +361,8 @@ export function startNotifier(bot, notifyChannelId, namespace, redis, handleUser
358
361
  bot.sendToChannelById(deliverTo, notification.text).catch((err) => {
359
362
  log("warn", `notify send failed (ns=${ns}):`, err.message);
360
363
  });
361
- if (forwardNotification) {
362
- forwardNotification(mainChannelId, notification.text);
364
+ if (!notification.isCron && handleUserMessage) {
365
+ handleUserMessage(mainChannelId, notification.text);
363
366
  }
364
367
  }
365
368
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonzih/cc-discord",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Claude Code Discord bot — chat with Claude Code via Discord",
5
5
  "type": "module",
6
6
  "bin": {