11use std:: {
22 borrow:: Cow ,
33 sync:: {
4- atomic:: { AtomicBool , Ordering } ,
54 Arc ,
5+ atomic:: { AtomicBool , Ordering } ,
66 } ,
77 time:: Instant ,
88} ;
@@ -15,9 +15,12 @@ use scripty_integrations::kiai::{KiaiApiClient, KiaiPostVirtualMessage};
1515use scripty_metrics:: Metrics ;
1616use scripty_stt:: { ModelError , Stream } ;
1717use serenity:: {
18- all:: { ChannelId as SerenityChannelId , ChannelId , GuildId , UserId , Webhook } ,
1918 builder:: { CreateEmbed , CreateMessage , EditMember , ExecuteWebhook } ,
2019 gateway:: client:: Context ,
20+ model:: {
21+ id:: { ChannelId , GenericChannelId , GuildId , ThreadId , UserId } ,
22+ webhook:: Webhook ,
23+ } ,
2124} ;
2225use songbird:: events:: context_data:: VoiceTick ;
2326
@@ -37,7 +40,7 @@ pub struct VoiceTickContext {
3740 pub ctx : Context ,
3841 pub webhook : Arc < Webhook > ,
3942 pub channel_id : ChannelId ,
40- pub thread_id : Option < ChannelId > ,
43+ pub thread_id : Option < ThreadId > ,
4144 pub transcript_results : Option < Arc < RwLock < Vec < String > > > > ,
4245 pub automod_server_cfg : Arc < AutomodServerConfig > ,
4346 pub auto_detect_lang : Arc < AtomicBool > ,
@@ -122,7 +125,7 @@ struct SilentSpeakersContext {
122125 verbose : Arc < AtomicBool > ,
123126 guild_id : GuildId ,
124127 channel_id : ChannelId ,
125- thread_id : Option < ChannelId > ,
128+ thread_id : Option < ThreadId > ,
126129 automod_server_cfg : Arc < AutomodServerConfig > ,
127130 transcript_results : TranscriptResults ,
128131 ctx : Context ,
@@ -171,7 +174,7 @@ async fn handle_silent_speakers<'a>(
171174 // finalize the stream
172175 let lang = language. read ( ) . clone ( ) ;
173176 let _typing = thread_id
174- . unwrap_or ( channel_id)
177+ . map_or_else ( || channel_id. widen ( ) , ThreadId :: widen )
175178 . start_typing ( ctx. http . clone ( ) ) ;
176179 let ( final_result, hook) = match finalize_stream (
177180 old_stream,
@@ -233,7 +236,7 @@ async fn handle_silent_speakers<'a>(
233236 }
234237 }
235238
236- if let Err ( e) = SerenityChannelId :: from ( automod_server_cfg. log_channel_id )
239+ if let Err ( e) = GenericChannelId :: from ( automod_server_cfg. log_channel_id )
237240 . send_message (
238241 & ctx. http ,
239242 CreateMessage :: new ( ) . embed (
@@ -464,7 +467,7 @@ async fn handle_speakers(ssrc_state: Arc<SsrcMaps>, metrics: Arc<Metrics>, voice
464467async fn finalize_stream < ' a > (
465468 stream : Stream ,
466469 user_data_map : SsrcUserDataMap ,
467- thread_id : Option < ChannelId > ,
470+ thread_id : Option < ThreadId > ,
468471 ssrc : u32 ,
469472 language : String ,
470473 verbose : & Arc < AtomicBool > ,
0 commit comments