From d1edef3623504d0817de79c3541da3c7bd34b1cf Mon Sep 17 00:00:00 2001 From: "oupson1er@gmail.com" Date: Sat, 12 Jun 2021 20:09:07 +0200 Subject: [PATCH] Add join sound --- .gitignore | 3 ++- Cargo.toml | 2 +- src/commands/music/mod.rs | 12 +++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 86f2cd4..9c719ae 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ Cargo.lock Conf.toml /data -/log \ No newline at end of file +/log +join_audio.mp3 \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 4c6082a..5d81582 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,4 +24,4 @@ serde_json = "1.0" log = "0.4" log4rs = "1.0" ctrlc = "3.1" -songbird = { version = "0.1", features = ["driver", "builtin-queue"], optional = true } \ No newline at end of file +songbird = { version = "0.1.6", features = ["driver", "builtin-queue"], optional = true } \ No newline at end of file diff --git a/src/commands/music/mod.rs b/src/commands/music/mod.rs index 6cba376..67c6143 100644 --- a/src/commands/music/mod.rs +++ b/src/commands/music/mod.rs @@ -127,6 +127,16 @@ async fn join(ctx: &Context, msg: &Message) -> CommandResult { if success.is_ok() { let mut handler = handler_lock.lock().await; + + match songbird::ffmpeg("join_audio.mp3").await { + Ok(input) => { + handler.enqueue_source(input); + } + Err(e) => { + error!("Failed to load join sound : {:?}", e); + } + } + handler.add_global_event( Event::Track(TrackEvent::Play), TrackStartNotifier { @@ -294,7 +304,7 @@ async fn play(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { ) }) .await?; - return Ok(()); + return Ok(()); msg.channel_id .send_message(&ctx.http, |m| { embed_response(