Fix autocompletes

This commit is contained in:
jude
2023-08-22 18:10:54 +01:00
parent fca080253f
commit e6f5db1842
3 changed files with 60 additions and 9 deletions

View File

@@ -23,3 +23,19 @@ pub async fn autocomplete_sound(
})
.collect()
}
pub async fn autocomplete_favorite(
ctx: Context<'_>,
partial: &str,
) -> Vec<poise::AutocompleteChoice<String>> {
ctx.data()
.autocomplete_favorite_sounds(&partial, ctx.author().id)
.await
.unwrap_or(vec![])
.iter()
.map(|s| poise::AutocompleteChoice {
name: s.name.clone(),
value: s.id.to_string(),
})
.collect()
}