aboutsummaryrefslogtreecommitdiff
path: root/src/commands/meme/mod.rs
diff options
context:
space:
mode:
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?;