set the permissions correctly on soundboard cmd

This commit is contained in:
jellywx 2021-06-27 12:52:25 +01:00
parent a38e4c808e
commit 5dc1521181
3 changed files with 13 additions and 6 deletions

View File

@ -17,7 +17,7 @@ use crate::{
event_handlers::RestartTrack,
framework::{Args, CommandInvoke, CreateGenericResponse},
guild_data::CtxGuildData,
join_channel, play_cmd,
join_channel, play_from_query,
sound::Sound,
AudioIndex, MySQL,
};
@ -48,7 +48,7 @@ pub async fn play(
.respond(
ctx.http.clone(),
CreateGenericResponse::new()
.content(play_cmd(ctx, guild, invoke.author_id(), args, false).await),
.content(play_from_query(ctx, guild, invoke.author_id(), args, false).await),
)
.await?;
@ -78,7 +78,7 @@ pub async fn loop_play(
.respond(
ctx.http.clone(),
CreateGenericResponse::new()
.content(play_cmd(ctx, guild, invoke.author_id(), args, true).await),
.content(play_from_query(ctx, guild, invoke.author_id(), args, true).await),
)
.await?;
@ -184,6 +184,7 @@ __Available ambience sounds:__
}
#[command("soundboard")]
#[required_permissions(Managed)]
#[group("Play")]
#[kind(Slash)]
#[description("Get a menu of sounds with buttons to play them")]

View File

@ -1,7 +1,7 @@
use crate::{
framework::RegexFramework,
guild_data::CtxGuildData,
join_channel, play_audio, play_cmd,
join_channel, play_audio, play_from_query,
sound::{JoinSoundCtx, Sound},
MySQL, ReqwestClient,
};
@ -208,7 +208,7 @@ SELECT name, id, plays, public, server_id, uploader_id
};
args.args.insert("query".to_string(), data.custom_id);
play_cmd(
play_from_query(
&ctx,
interaction.guild(ctx.cache.clone()).await.unwrap(),
member.user.id,

View File

@ -140,7 +140,13 @@ async fn join_channel(
(call, res)
}
async fn play_cmd(ctx: &Context, guild: Guild, user_id: UserId, args: Args, loop_: bool) -> String {
async fn play_from_query(
ctx: &Context,
guild: Guild,
user_id: UserId,
args: Args,
loop_: bool,
) -> String {
let guild_id = guild.id;
let channel_to_join = guild