Update to serenity 12

This commit is contained in:
jude
2023-12-18 19:06:18 +00:00
parent cd5651c7f6
commit facef2a55c
14 changed files with 1564 additions and 1116 deletions

View File

@@ -1,3 +1,5 @@
use poise::serenity_prelude::AutocompleteChoice;
use crate::{models::sound::SoundCtx, Context};
pub mod favorite;
@@ -8,34 +10,22 @@ pub mod search;
pub mod settings;
pub mod stop;
pub async fn autocomplete_sound(
ctx: Context<'_>,
partial: &str,
) -> Vec<poise::AutocompleteChoice<String>> {
pub async fn autocomplete_sound(ctx: Context<'_>, partial: &str) -> Vec<AutocompleteChoice> {
ctx.data()
.autocomplete_user_sounds(&partial, ctx.author().id, ctx.guild_id().unwrap())
.await
.unwrap_or(vec![])
.iter()
.map(|s| poise::AutocompleteChoice {
name: s.name.clone(),
value: s.id.to_string(),
})
.map(|s| AutocompleteChoice::new(s.name.clone(), s.id.to_string()))
.collect()
}
pub async fn autocomplete_favorite(
ctx: Context<'_>,
partial: &str,
) -> Vec<poise::AutocompleteChoice<String>> {
pub async fn autocomplete_favorite(ctx: Context<'_>, partial: &str) -> Vec<AutocompleteChoice> {
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(),
})
.map(|s| AutocompleteChoice::new(s.name.clone(), s.id.to_string()))
.collect()
}