Pick recording servers from the voice-changer app; fix per-server recording status

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>
This commit is contained in:
EJClaw
2026-11-11 21:16:53 +09:00
parent f45d349f96
commit 32ad429773
14 changed files with 473 additions and 8 deletions

View File

@@ -55,3 +55,39 @@ test('녹음할 서버로 고르지 않은 서버에서는 동의자라도 따
await bot.client.destroy();
store.close();
});
test('녹음 중 표시는 그 서버를 고른 사람에게만 (다른 동의자를 녹음 중인 채널에 같이 있어도)', async () => {
const store = new Store(':memory:');
store.consent({ id: 'u1', username: 'a' });
store.consent({ id: 'u3', username: 'c' });
store.setConsentGuilds('u1', ['g']);
store.setConsentGuilds('u3', ['other']);
const cfg = loadConfig({ PUBLIC_URL: 'http://localhost', DISCORD_CLIENT_ID: 'c', DISCORD_CLIENT_SECRET: 's' }, false);
const bot = new FollowBot(cfg, store);
const guild = fakeGuild();
guild.voiceStates.cache.set('u3', { id: 'u3', channelId: 'A', member: { user: { bot: false } } });
guild.channels = { cache: new Map([['A', { name: 'A채널' }]]) };
(bot.client.guilds.cache as any).set('g', guild);
(bot as any).recorders.set('g', { channelId: 'A' });
assert.equal(bot.recordingNow('u1'), 'A채널');
assert.equal(bot.recordingNow('u3'), null);
(bot as any).recorders.clear();
(bot.client.guilds.cache as any).clear();
await bot.client.destroy();
store.close();
});
test('운영자가 앱에서 끈 서버는 따라가지 않는다', async () => {
const store = new Store(':memory:');
const cfg = loadConfig({ PUBLIC_URL: 'http://localhost', DISCORD_CLIENT_ID: 'c', DISCORD_CLIENT_SECRET: 's' }, false);
const bot = new FollowBot(cfg, store);
const guild = { ...fakeGuild(), name: '서버' };
(bot.client.guilds.cache as any).set('g', guild);
assert.equal((bot as any).allowedGuild(guild), true); // 처음에는 켜짐
store.setGuildEnabled('admin', { g: false });
assert.equal((bot as any).allowedGuild(guild), false);
assert.deepEqual(bot.adminGuilds(), [{ id: 'g', name: '서버', enabled: false }]);
(bot.client.guilds.cache as any).clear();
await bot.client.destroy();
store.close();
});