Discord admin Add form: say so when the system already plays in that channel (#213)
Re-adding the same system to a voice channel returns the running stream untouched (already_on). The form closed as if a stream had been added and the new label/bot was silently dropped; it now stays open and explains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8af410aede
commit
5c53850cbf
@@ -71,7 +71,7 @@ function AddChannelForm({
|
||||
setSaving(true);
|
||||
setError(null);
|
||||
try {
|
||||
await c2api.startDiscordStream({
|
||||
const res = await c2api.startDiscordStream({
|
||||
guild_id: guildId,
|
||||
channel_id: channelId.trim(),
|
||||
system_id: systemId,
|
||||
@@ -79,6 +79,16 @@ function AddChannelForm({
|
||||
channel_name: channelName.trim() || undefined,
|
||||
preferred_token_id: botId || undefined,
|
||||
});
|
||||
if (res?.already_on) {
|
||||
// Same system re-added to a channel that already plays it: c2-core
|
||||
// returns that stream untouched (label, mode and bot kept). Say so
|
||||
// instead of closing as if a stream had been added.
|
||||
setError({
|
||||
message: `${res.system_name || "That system"} is already playing in this voice channel, so nothing was added or changed. Pick another system to add a second stream, or Remove the existing row to change its label or bot.`,
|
||||
invite: [],
|
||||
});
|
||||
return;
|
||||
}
|
||||
onDone();
|
||||
} catch (err) {
|
||||
setError(parseC2Error(err));
|
||||
|
||||
Reference in New Issue
Block a user