aboutsummaryrefslogtreecommitdiff
path: root/src/commands/meme/mod.rs
diff options
context:
space:
mode:
authorNathan Perry <np@nathanperry.dev>2024-08-17 03:02:31 -0400
committerNathan Perry <np@nathanperry.dev>2024-08-17 03:02:47 -0400
commit6c686b8b3cd9e5769156321a8d05f737196ee375 (patch)
tree76f940847bef8a85dfb2065914c93709fee0cd55 /src/commands/meme/mod.rs
parent584f0ebc6e33ddc2905d82f44e7b42faea122668 (diff)
fix stats and playback queue
Diffstat (limited to 'src/commands/meme/mod.rs')
-rw-r--r--src/commands/meme/mod.rs25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/commands/meme/mod.rs b/src/commands/meme/mod.rs
index 3883f3e..603ec28 100644
--- a/src/commands/meme/mod.rs
+++ b/src/commands/meme/mod.rs
@@ -32,7 +32,14 @@ pub use self::{
invoke::*,
};
use crate::{
- commands::playback::songbird,
+ bot::PlaybackKey,
+ commands::{
+ playback,
+ playback::{
+ songbird,
+ InvokeInfo,
+ },
+ },
db::{
Audio,
Meme,
@@ -116,6 +123,11 @@ async fn send_meme(
let volume = util::volume(ctx).await;
tracing::debug!(volume);
+ let playback = {
+ let data = ctx.serenity_context().data.read().await;
+ data.get::<PlaybackKey>().unwrap().clone()
+ };
+
{
let (_sb, call) = songbird(ctx).await?;
let mut call = call.lock().await;
@@ -124,8 +136,17 @@ async fn send_meme(
call.join(voice_channel).await?;
}
- let handle = call.enqueue_input(Input::Lazy(Box::new(audio))).await;
+ let input = Input::Lazy(Box::new(audio));
+
+ let handle = call.enqueue_input(input).await;
handle.set_volume(volume as _)?;
+
+ playback.insert(handle.uuid(), playback::Metadata {
+ invoker: ctx.author().id,
+ invoke_info: InvokeInfo::Meme {
+ meme: t.clone(),
+ },
+ });
}
util::react(ctx, ReactionType::Unicode("📣".to_owned())).await?;