Fix soundboards
This commit is contained in:
parent
365d1df4ce
commit
52327b3695
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1924,7 +1924,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "soundfx-rs"
|
name = "soundfx-rs"
|
||||||
version = "1.5.3"
|
version = "1.5.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dashmap",
|
"dashmap",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "soundfx-rs"
|
name = "soundfx-rs"
|
||||||
version = "1.5.3"
|
version = "1.5.4"
|
||||||
authors = ["jellywx <judesouthworth@pm.me>"]
|
authors = ["jellywx <judesouthworth@pm.me>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
@ -197,32 +197,25 @@ impl SoundPager {
|
|||||||
let user_id = interaction.user.id;
|
let user_id = interaction.user.id;
|
||||||
let guild_id = interaction.guild_id.unwrap();
|
let guild_id = interaction.guild_id.unwrap();
|
||||||
|
|
||||||
match serde_json::from_str::<Self>(&interaction.data.custom_id) {
|
let pager = serde_json::from_str::<Self>(&interaction.data.custom_id)?;
|
||||||
Ok(pager) => {
|
let sounds = pager.get_page(data, user_id, guild_id).await?;
|
||||||
let sounds = pager.get_page(data, user_id, guild_id).await?;
|
let count = match pager.context {
|
||||||
let count = match pager.context {
|
ListContext::User => data.count_user_sounds(user_id).await?,
|
||||||
ListContext::User => data.count_user_sounds(user_id).await?,
|
ListContext::Guild => data.count_guild_sounds(guild_id).await?,
|
||||||
ListContext::Guild => data.count_guild_sounds(guild_id).await?,
|
};
|
||||||
};
|
|
||||||
|
|
||||||
interaction
|
interaction
|
||||||
.create_interaction_response(&ctx, |r| {
|
.create_interaction_response(&ctx, |r| {
|
||||||
r.kind(InteractionResponseType::UpdateMessage)
|
r.kind(InteractionResponseType::UpdateMessage)
|
||||||
.interaction_response_data(|d| {
|
.interaction_response_data(|d| {
|
||||||
d.ephemeral(true)
|
d.ephemeral(true)
|
||||||
.add_embed(pager.embed(&sounds, count))
|
.add_embed(pager.embed(&sounds, count))
|
||||||
.components(|c| {
|
.components(|c| c.add_action_row(pager.create_action_row(count / 25)))
|
||||||
c.add_action_row(pager.create_action_row(count / 25))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.await?;
|
})
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
|
||||||
|
|
||||||
Err(_) => Ok(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn reply(&self, ctx: Context<'_>) -> Result<(), Error> {
|
async fn reply(&self, ctx: Context<'_>) -> Result<(), Error> {
|
||||||
|
Loading…
Reference in New Issue
Block a user