aboutsummaryrefslogtreecommitdiff
path: root/src/commands/today/mod.rs
diff options
context:
space:
mode:
authorNathan Perry <np@nathanperry.dev>2024-08-16 23:09:41 -0400
committerNathan Perry <np@nathanperry.dev>2024-08-16 23:09:43 -0400
commit584f0ebc6e33ddc2905d82f44e7b42faea122668 (patch)
treee4a2bbc3d801086649c29a1de741dd49fc466b96 /src/commands/today/mod.rs
parente0a9b18f45858829f88cbe20611aaf696fc5bf6a (diff)
fill in queued playback info
Diffstat (limited to 'src/commands/today/mod.rs')
-rw-r--r--src/commands/today/mod.rs21
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| {