diff options
Diffstat (limited to 'src/commands/today/mod.rs')
| -rw-r--r-- | src/commands/today/mod.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/commands/today/mod.rs b/src/commands/today/mod.rs index f8f38c7..2c47e83 100644 --- a/src/commands/today/mod.rs +++ b/src/commands/today/mod.rs @@ -5,11 +5,17 @@ use rand::{ seq::SliceRandom, thread_rng, }; -use songbird::input::YoutubeDl; +use songbird::input::{ + Compose, + YoutubeDl, +}; use tap::Conv; use crate::{ - bot::HttpKey, + bot::{ + HttpKey, + PlaybackKey, + }, commands::playback::songbird, util, PoiseContext, @@ -117,12 +123,21 @@ pub async fn today(ctx: PoiseContext<'_>, #[rest] _rest: Option<String>) -> anyh data.get::<HttpKey>().unwrap().clone() }; - let input = + let mut input = YoutubeDl::new_ytdl_like("yt-dlp", client.clone(), play_args.url.conv::<String>()); + let meta = input.aux_metadata().await?; + let handle = call.enqueue_input(input.into()).await; handle.set_volume(volume as _)?; + let playback = { + let data = ctx.serenity_context().data.read().await; + data.get::<PlaybackKey>().unwrap().clone() + }; + + playback.insert(handle.uuid(), meta); + let q = call.queue(); q.pause()?; q.modify_queue(move |q| { |
