support auto archive thread

This commit is contained in:
mii
2022-11-19 02:51:09 +00:00
parent f7b7071a09
commit 68a73a4dae
2 changed files with 18 additions and 2 deletions

View File

@ -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(())
}

View File

@ -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)