@gonzih/cc-discord 0.1.12 → 0.1.14
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 +10 -1
- package/dist/notifier.js +3 -6
- package/package.json +1 -1
package/dist/bot.js
CHANGED
|
@@ -362,6 +362,7 @@ export class CcDiscordBot {
|
|
|
362
362
|
if (mappedNs && this.redis) {
|
|
363
363
|
this.writeChatMessage("user", "discord", text, effectiveChannelId, mappedNs.namespace);
|
|
364
364
|
this.opts.registerRoutedChannelId?.(mappedNs.namespace, effectiveChannelId);
|
|
365
|
+
this.persistChannelMapping(effectiveChannelId, mappedNs.namespace, mappedNs.repoUrl);
|
|
365
366
|
const username = msg.member?.displayName ?? msg.author.username;
|
|
366
367
|
try {
|
|
367
368
|
await routeToMetaAgent(mappedNs.namespace, stampPrompt(text, username, msg.createdAt), this.redis);
|
|
@@ -371,7 +372,12 @@ export class CcDiscordBot {
|
|
|
371
372
|
}
|
|
372
373
|
return;
|
|
373
374
|
}
|
|
374
|
-
//
|
|
375
|
+
// Unknown guild channel — reject rather than silently start a local session with wrong context
|
|
376
|
+
if (msg.guild) {
|
|
377
|
+
await msg.channel.send("This channel is not configured. Use `channel for https://github.com/org/repo` to set it up.").catch(() => { });
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
// Local Claude session (DMs only beyond this point)
|
|
375
381
|
const session = this.getOrCreateSession(effectiveChannelId, msg.channel);
|
|
376
382
|
const username = msg.member?.displayName ?? msg.author.username;
|
|
377
383
|
try {
|
|
@@ -404,6 +410,7 @@ export class CcDiscordBot {
|
|
|
404
410
|
if (mappedNs && this.redis) {
|
|
405
411
|
this.writeChatMessage("user", "discord", fullText, channelId, mappedNs.namespace);
|
|
406
412
|
this.opts.registerRoutedChannelId?.(mappedNs.namespace, channelId);
|
|
413
|
+
this.persistChannelMapping(channelId, mappedNs.namespace, mappedNs.repoUrl);
|
|
407
414
|
try {
|
|
408
415
|
await routeToMetaAgent(mappedNs.namespace, prompt, this.redis);
|
|
409
416
|
}
|
|
@@ -452,6 +459,7 @@ export class CcDiscordBot {
|
|
|
452
459
|
const prompt = stampPrompt(fullText, imgUsername, msg.createdAt);
|
|
453
460
|
this.writeChatMessage("user", "discord", fullText, channelId, mappedNs.namespace);
|
|
454
461
|
this.opts.registerRoutedChannelId?.(mappedNs.namespace, channelId);
|
|
462
|
+
this.persistChannelMapping(channelId, mappedNs.namespace, mappedNs.repoUrl);
|
|
455
463
|
try {
|
|
456
464
|
await routeToMetaAgent(mappedNs.namespace, prompt, this.redis);
|
|
457
465
|
}
|
|
@@ -493,6 +501,7 @@ export class CcDiscordBot {
|
|
|
493
501
|
if (mappedNs && this.redis) {
|
|
494
502
|
this.writeChatMessage("user", "discord", fullText, channelId, mappedNs.namespace);
|
|
495
503
|
this.opts.registerRoutedChannelId?.(mappedNs.namespace, channelId);
|
|
504
|
+
this.persistChannelMapping(channelId, mappedNs.namespace, mappedNs.repoUrl);
|
|
496
505
|
try {
|
|
497
506
|
await routeToMetaAgent(mappedNs.namespace, prompt, this.redis);
|
|
498
507
|
}
|
package/dist/notifier.js
CHANGED
|
@@ -202,12 +202,9 @@ export function startNotifier(bot, notifyChannelId, namespace, redis, handleUser
|
|
|
202
202
|
const content = parsed.content;
|
|
203
203
|
if (!content)
|
|
204
204
|
return;
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
|
|
208
|
-
const targetChannelId = ns === namespace
|
|
209
|
-
? (routedChannelIds.get(ns) ?? notifyChannelId ?? getActiveChannelId?.())
|
|
210
|
-
: routedChannelIds.get(ns);
|
|
205
|
+
// Only forward to Discord for explicitly routed namespaces.
|
|
206
|
+
// Primary namespace (money-brain) chat output belongs to Telegram — cc-tg handles that.
|
|
207
|
+
const targetChannelId = routedChannelIds.get(ns);
|
|
211
208
|
if (targetChannelId == null) {
|
|
212
209
|
log("warn", `meta-agent output: no channelId for namespace=${ns}, dropping line`);
|
|
213
210
|
return;
|