Split greet sound enabling

This commit is contained in:
jude
2023-03-22 18:31:49 +00:00
parent 208440a7ff
commit 4edcee2567
9 changed files with 93 additions and 23 deletions

View File

@ -11,7 +11,11 @@ use poise::serenity_prelude::{
use crate::{
cmds::search::SoundPager,
models::{guild_data::CtxGuildData, join_sound::JoinSoundCtx, sound::Sound},
models::{
guild_data::{AllowGreet, CtxGuildData},
join_sound::JoinSoundCtx,
sound::Sound,
},
utils::{join_channel, play_audio, play_from_query},
Data, Error,
};
@ -89,8 +93,14 @@ pub async fn listener(ctx: &Context, event: &poise::Event<'_>, data: &Data) -> R
allowed_greets = read.allow_greets;
}
if allowed_greets {
if let Some(join_id) = data.join_sound(new.user_id, new.guild_id).await
if allowed_greets != AllowGreet::Disabled {
if let Some(join_id) = data
.join_sound(
new.user_id,
new.guild_id,
allowed_greets == AllowGreet::GuildOnly,
)
.await
{
let mut sound = sqlx::query_as_unchecked!(
Sound,