From 584f0ebc6e33ddc2905d82f44e7b42faea122668 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Fri, 16 Aug 2024 23:09:41 -0400 Subject: fill in queued playback info --- src/commands/today/mod.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/commands/today/mod.rs') 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) -> anyh data.get::().unwrap().clone() }; - let input = + let mut input = YoutubeDl::new_ytdl_like("yt-dlp", client.clone(), play_args.url.conv::()); + 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::().unwrap().clone() + }; + + playback.insert(handle.uuid(), meta); + let q = call.queue(); q.pause()?; q.modify_queue(move |q| { -- cgit v1.3.1