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:
@@ -84,6 +84,7 @@ export class FollowBot {
|
||||
recordingNow(userId: string): string | null {
|
||||
for (const [gid, r] of this.recorders) {
|
||||
const g = this.client.guilds.cache.get(gid);
|
||||
if (!this.store.isConsentedIn(userId, gid)) continue; // 이 서버는 녹음하지 않기로 한 사람 (다른 동의자를 녹음 중인 채널에 같이 있어도)
|
||||
if (g?.voiceStates.cache.get(userId)?.channelId === r.channelId) return g.channels.cache.get(r.channelId)?.name ?? '음성채널';
|
||||
}
|
||||
return null;
|
||||
@@ -95,8 +96,22 @@ export class FollowBot {
|
||||
this.queue.set(guild.id, next);
|
||||
}
|
||||
|
||||
/** .env 의 ALLOWED_GUILD_IDS 안에 있고, 운영자가 앱에서 끄지 않은 서버 */
|
||||
private allowedGuild(guild: Guild): boolean {
|
||||
return !this.cfg.allowedGuildIds.size || this.cfg.allowedGuildIds.has(guild.id);
|
||||
return (!this.cfg.allowedGuildIds.size || this.cfg.allowedGuildIds.has(guild.id)) && this.store.guildEnabled(guild.id);
|
||||
}
|
||||
|
||||
/** 운영자가 켜고 끌 수 있는 서버 (봇이 들어가 있고 ALLOWED_GUILD_IDS 안에 있는 곳) */
|
||||
adminGuilds(): { id: string; name: string; enabled: boolean }[] {
|
||||
return [...this.client.guilds.cache.values()]
|
||||
.filter((g) => !this.cfg.allowedGuildIds.size || this.cfg.allowedGuildIds.has(g.id))
|
||||
.map((g) => ({ id: g.id, name: g.name, enabled: this.store.guildEnabled(g.id) }))
|
||||
.sort((a, b) => a.name.localeCompare(b.name, 'ko'));
|
||||
}
|
||||
|
||||
/** 운영자가 서버를 켜고 끈 직후: 끈 서버에서는 바로 나가고, 켠 서버에는 동의자가 있으면 따라 들어간다 */
|
||||
guildSettingsChanged(): void {
|
||||
for (const g of this.client.guilds.cache.values()) this.schedule(g);
|
||||
}
|
||||
|
||||
private canJoin(ch: VoiceBasedChannel): boolean {
|
||||
|
||||
Reference in New Issue
Block a user