From d4f743801e6e88f90352ad08b86676cc97430664 Mon Sep 17 00:00:00 2001 From: Jokler Date: Fri, 6 Mar 2020 20:20:47 +0100 Subject: Add search command to the music bot --- src/bot/music.rs | 3 +++ src/command.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/bot/music.rs b/src/bot/music.rs index 5f7928e..25c5d4b 100644 --- a/src/bot/music.rs +++ b/src/bot/music.rs @@ -329,6 +329,9 @@ impl MusicBot { self.add_audio(url.to_string(), invoker.name).await; } + Command::Search { query } => { + self.add_audio(format!("ytsearch:{}", query.join(" ")), invoker.name).await; + } Command::Pause => { self.player.pause()?; } diff --git a/src/command.rs b/src/command.rs index db22028..c907d51 100644 --- a/src/command.rs +++ b/src/command.rs @@ -15,6 +15,8 @@ use structopt::StructOpt; pub enum Command { /// Adds url to playlist Add { url: String }, + /// Adds the first video found on YouTube + Search { query: Vec }, /// Starts audio playback Play, /// Pauses audio playback -- cgit v1.2.3-70-g09d2