Merge origin/main into chore/nanoclaw-recursive-room

This commit is contained in:
Eyejoker
2026-03-20 03:48:29 +09:00
37 changed files with 4268 additions and 146 deletions

View File

@@ -20,6 +20,7 @@ import {
import { isPairedRoomJid } from '../db.js';
import { readEnvFile } from '../env.js';
import { logger } from '../logger.js';
import { formatOutbound } from '../router.js';
const ATTACHMENTS_DIR = path.join(DATA_DIR, 'attachments');
const TRANSCRIPTION_CACHE_DIR = path.join(CACHE_DIR, 'transcriptions');
@@ -449,6 +450,7 @@ export class DiscordChannel implements Channel {
for (const [name, id] of Object.entries(mentionMap)) {
cleaned = cleaned.replace(new RegExp(`@${name}`, 'g'), `<@${id}>`);
}
cleaned = formatOutbound(cleaned);
// Discord has a 2000 character limit per message — split if needed
const MAX_LENGTH = 2000;
@@ -457,6 +459,11 @@ export class DiscordChannel implements Channel {
name: path.basename(f),
}));
if (!cleaned && files.length === 0) {
logger.debug({ jid }, 'Skipping empty Discord outbound message');
return;
}
if (cleaned.length <= MAX_LENGTH) {
await textChannel.send({
content: cleaned || undefined,
@@ -497,6 +504,7 @@ export class DiscordChannel implements Channel {
return groupType === this.agentTypeFilter;
}
async disconnect(): Promise<void> {
if (this.client) {
this.client.destroy();