mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 16:15:29 +00:00
support auto archive thread
This commit is contained in:
@ -68,7 +68,7 @@ pub async fn stop_command(
|
||||
.clone()
|
||||
};
|
||||
|
||||
{
|
||||
let thread_id = {
|
||||
let mut storage = storage_lock.write().await;
|
||||
if !storage.contains_key(&guild.id) {
|
||||
command
|
||||
@ -82,8 +82,12 @@ pub async fn stop_command(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let thread_id = storage.get(&guild.id).unwrap().text_channel;
|
||||
|
||||
storage.remove(&guild.id);
|
||||
}
|
||||
|
||||
thread_id
|
||||
};
|
||||
|
||||
let _handler = manager.remove(guild.id.0).await;
|
||||
|
||||
@ -93,5 +97,10 @@ pub async fn stop_command(
|
||||
})
|
||||
.await?;
|
||||
|
||||
thread_id
|
||||
.edit_thread(&ctx.http, |f| f.archived(true))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -66,6 +66,13 @@ pub async fn voice_state_update(ctx: Context, old: Option<VoiceState>, new: Voic
|
||||
}
|
||||
|
||||
if del_flag {
|
||||
storage
|
||||
.get(&guild_id)
|
||||
.unwrap()
|
||||
.text_channel
|
||||
.edit_thread(&ctx.http, |f| f.archived(true))
|
||||
.await
|
||||
.unwrap();
|
||||
storage.remove(&guild_id);
|
||||
|
||||
let manager = songbird::get(&ctx)
|
||||
|
Reference in New Issue
Block a user