consent-recorder: operators (ADMIN_DISCORD_IDS) create an app key on the site; the app calls GET/POST /api/guilds with it to turn servers on/off. Turned-off servers are left immediately. recordingNow() now checks the user picked that server, so someone who only chose server A is not shown as recorded while sitting in a B channel the bot records for others. voice-changer: new "녹음 서버" dialog (record_servers.py), network in a worker thread, key saved in config/record-servers.json; upgrade cleanup list knows the new file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import path from 'node:path';
|
|
import { FollowBot } from './bot.js';
|
|
import { loadConfig, loadDotEnv } from './config.js';
|
|
import { Store } from './db.js';
|
|
import { createSite } from './site.js';
|
|
|
|
loadDotEnv(path.resolve('.env'));
|
|
const cfg = loadConfig();
|
|
const store = new Store(path.join(cfg.dataDir, 'consent.db'));
|
|
const bot = new FollowBot(cfg, store);
|
|
const site = createSite(cfg, store, {
|
|
consentChanged: (id) => bot.consentChanged(id),
|
|
discardActive: (id) => bot.discardActive(id),
|
|
recordingNow: (id) => bot.recordingNow(id),
|
|
userGuilds: (id) => bot.userGuilds(id),
|
|
adminGuilds: () => bot.adminGuilds(),
|
|
guildSettingsChanged: () => bot.guildSettingsChanged(),
|
|
});
|
|
|
|
site.listen(cfg.port, cfg.host, () => console.log(`[site] ${cfg.publicUrl} (http://${cfg.host}:${cfg.port})`));
|
|
await bot.start();
|
|
|
|
let stopping = false;
|
|
for (const sig of ['SIGINT', 'SIGTERM'] as const) {
|
|
process.on(sig, async () => {
|
|
if (stopping) return;
|
|
stopping = true;
|
|
console.log('[main] 끄는 중 (녹음 중인 파일 저장)');
|
|
site.close();
|
|
await bot.stop().catch(() => undefined);
|
|
store.close();
|
|
process.exit(0);
|
|
});
|
|
}
|