feat(app): speak the transcription notice on joining a voice channel instead of posting it in chat
The notice (voice.joinNotice) is now a speech request in the voice channel. It is owed from each join until some of it was played or someone stopped it; when the worker cannot speak yet (auto-join while it still starts) it is spoken as soon as the worker is ready. Version 0.1.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -198,9 +198,13 @@ async fn discord_voice_core_on_real_discord() {
|
||||
ev2.lock().unwrap().push(e);
|
||||
}
|
||||
});
|
||||
core.start().await.expect("core start"); // logs in, registers the command, auto-joins, posts the notice
|
||||
core.start().await.expect("core start"); // logs in, registers the command, auto-joins, speaks the notice
|
||||
assert_eq!(core.voice_channel_id(), Some(voice));
|
||||
let jarvis = core.bot_id().unwrap();
|
||||
// The transcription notice is the first speech of the join, and it is spoken, not posted.
|
||||
until("notice spoken", 60_000, || events.lock().unwrap().iter().any(|e| matches!(e, CoreEvent::SpeakEnd(_)))).await;
|
||||
let notice = events.lock().unwrap().iter().find_map(|e| match e { CoreEvent::SpeakEnd(x) => Some(x.clone()), _ => None }).unwrap();
|
||||
assert!(!notice.failed && !notice.cancelled && notice.played > 0, "{notice:?}");
|
||||
|
||||
let call = speaker_songbird.join(GuildId::new(guild), ChannelId::new(voice)).await.expect("speaker joins");
|
||||
let ears = Ears { jarvis, ..Default::default() };
|
||||
@@ -320,7 +324,7 @@ async fn discord_voice_core_on_real_discord() {
|
||||
assert!(tail < 400, "audio went on {tail} ms after stop");
|
||||
assert!(!core.speaking());
|
||||
|
||||
// 5. Chat: live event, history with the join notice, and a send that pings nobody.
|
||||
// 5. Chat: live event, history, and a send that pings nobody.
|
||||
let marker = format!("라이브 테스트 메시지 {}", stop_at.elapsed().as_nanos());
|
||||
ChannelId::new(voice).send_message(&s_http, CreateMessage::new().content(&marker)).await.unwrap();
|
||||
until("chat event", 10_000, || events.lock().unwrap().iter().any(|e| matches!(e, CoreEvent::Chat(c) if c.content == marker))).await;
|
||||
@@ -328,7 +332,6 @@ async fn discord_voice_core_on_real_discord() {
|
||||
assert!(ev.channel_id == voice && ev.author_id == speaker_id && ev.author_is_bot && !ev.from_self);
|
||||
let history = core.read_chat(voice, 20).await.unwrap();
|
||||
assert!(history.iter().any(|m| m.content == marker && !m.from_self));
|
||||
assert!(history.iter().any(|m| m.from_self && m.content.contains("받아 적습니다")), "join notice missing");
|
||||
// An edit and a delete reach the history store.
|
||||
let mut marker_msg = ChannelId::new(voice).messages(&s_http, serenity::all::GetMessages::new().limit(5)).await.unwrap()
|
||||
.into_iter().find(|m| m.content == marker).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user