Fix soundboard interactions not working for switching play mode
This commit is contained in:
parent
6caca25719
commit
c74c481d32
@ -96,11 +96,10 @@ pub async fn listener(ctx: &Context, event: &FullEvent, data: &Data) -> Result<(
|
||||
if let Some(guild_id) = component.guild_id {
|
||||
if let Ok(()) = SoundPager::handle_interaction(ctx, &data, component).await {
|
||||
} else {
|
||||
component.defer(&ctx).await.unwrap();
|
||||
let mode = component.data.custom_id.as_str();
|
||||
match mode {
|
||||
"#stop" => {
|
||||
component.defer(&ctx).await.unwrap();
|
||||
|
||||
let songbird = songbird::get(ctx).await.unwrap();
|
||||
let call_opt = songbird.get(guild_id);
|
||||
|
||||
@ -123,30 +122,37 @@ pub async fn listener(ctx: &Context, event: &FullEvent, data: &Data) -> Result<(
|
||||
ActionRowComponent::Button(button) => match &button
|
||||
.data
|
||||
{
|
||||
ButtonKind::NonLink { custom_id, style } => row
|
||||
.push(
|
||||
CreateButton::new(
|
||||
if custom_id.starts_with('#') {
|
||||
custom_id.to_string()
|
||||
} else {
|
||||
format!(
|
||||
"{}{}",
|
||||
custom_id
|
||||
.split('#')
|
||||
.next()
|
||||
.unwrap(),
|
||||
mode
|
||||
)
|
||||
},
|
||||
)
|
||||
.label(button.label.clone().unwrap())
|
||||
.emoji(button.emoji.clone().unwrap())
|
||||
.disabled(
|
||||
custom_id == "#mode"
|
||||
|| custom_id == mode,
|
||||
)
|
||||
.style(*style),
|
||||
),
|
||||
ButtonKind::NonLink { custom_id, style } => {
|
||||
let mut btn = CreateButton::new(
|
||||
if custom_id.starts_with('#') {
|
||||
custom_id.to_string()
|
||||
} else {
|
||||
format!(
|
||||
"{}{}",
|
||||
custom_id
|
||||
.split('#')
|
||||
.next()
|
||||
.unwrap(),
|
||||
mode
|
||||
)
|
||||
},
|
||||
)
|
||||
.disabled(
|
||||
custom_id == "#mode"
|
||||
|| custom_id == mode,
|
||||
)
|
||||
.style(*style);
|
||||
|
||||
if let Some(emoji) = button.emoji.clone() {
|
||||
btn = btn.emoji(emoji);
|
||||
}
|
||||
|
||||
if let Some(label) = button.label.clone() {
|
||||
btn = btn.label(label);
|
||||
}
|
||||
|
||||
row.push(btn)
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
@ -165,8 +171,6 @@ pub async fn listener(ctx: &Context, event: &FullEvent, data: &Data) -> Result<(
|
||||
}
|
||||
|
||||
id_mode => {
|
||||
component.defer(&ctx).await.unwrap();
|
||||
|
||||
let mut it = id_mode.split('#');
|
||||
let id = it.next().unwrap();
|
||||
let mode = it.next().unwrap_or("instant");
|
||||
|
Loading…
x
Reference in New Issue
Block a user