feat: add Discord channel, OpenCode runtime, rename to Regolith
Some checks failed
Update token count / update-tokens (push) Has been cancelled
Some checks failed
Update token count / update-tokens (push) Has been cancelled
- Discord channel integration (discord.js) with mention stripping, attachment tagging, reply context, message chunking - OpenCode runtime with CLI and SDK modes, SQLite session persistence, idle timeout cleanup - Multi-channel architecture: WhatsApp + Discord simultaneous or independent via DISCORD_ONLY/DISCORD_BOT_TOKEN - Config additions: DISCORD_BOT_TOKEN, DISCORD_ONLY, OPENCODE_MODE, OPENCODE_MODEL, OPENCODE_TIMEOUT, OPENCODE_SESSION_TTL_HOURS - Updated README and CLAUDE.md documentation - Renamed project to Regolith in package.json
This commit is contained in:
22
src/index.ts
22
src/index.ts
@@ -5,11 +5,14 @@ import path from 'path';
|
||||
import {
|
||||
ASSISTANT_NAME,
|
||||
DATA_DIR,
|
||||
DISCORD_BOT_TOKEN,
|
||||
DISCORD_ONLY,
|
||||
IDLE_TIMEOUT,
|
||||
MAIN_GROUP_FOLDER,
|
||||
POLL_INTERVAL,
|
||||
TRIGGER_PATTERN,
|
||||
} from './config.js';
|
||||
import { DiscordChannel } from './channels/discord.js';
|
||||
import { WhatsAppChannel } from './channels/whatsapp.js';
|
||||
import {
|
||||
ContainerOutput,
|
||||
@@ -485,9 +488,17 @@ async function main(): Promise<void> {
|
||||
};
|
||||
|
||||
// Create and connect channels
|
||||
whatsapp = new WhatsAppChannel(channelOpts);
|
||||
channels.push(whatsapp);
|
||||
await whatsapp.connect();
|
||||
if (DISCORD_BOT_TOKEN) {
|
||||
const discord = new DiscordChannel(DISCORD_BOT_TOKEN, channelOpts);
|
||||
channels.push(discord);
|
||||
await discord.connect();
|
||||
}
|
||||
|
||||
if (!DISCORD_ONLY) {
|
||||
whatsapp = new WhatsAppChannel(channelOpts);
|
||||
channels.push(whatsapp);
|
||||
await whatsapp.connect();
|
||||
}
|
||||
|
||||
// Start subsystems (independently of connection handler)
|
||||
startSchedulerLoop({
|
||||
@@ -497,10 +508,7 @@ async function main(): Promise<void> {
|
||||
onProcess: (groupJid, proc, containerName, groupFolder) => queue.registerProcess(groupJid, proc, containerName, groupFolder),
|
||||
sendMessage: async (jid, rawText) => {
|
||||
const channel = findChannel(channels, jid);
|
||||
if (!channel) {
|
||||
console.log(`Warning: no channel owns JID ${jid}, cannot send message`);
|
||||
return;
|
||||
}
|
||||
if (!channel) return;
|
||||
const text = formatOutbound(rawText);
|
||||
if (text) await channel.sendMessage(jid, text);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user