aboutsummaryrefslogtreecommitdiff
path: root/src/commands/meme
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/meme')
-rw-r--r--src/commands/meme/history.rs33
-rw-r--r--src/commands/meme/invoke.rs23
-rw-r--r--src/commands/meme/mod.rs16
3 files changed, 36 insertions, 36 deletions
diff --git a/src/commands/meme/history.rs b/src/commands/meme/history.rs
index 1acb019..270ae9a 100644
--- a/src/commands/meme/history.rs
+++ b/src/commands/meme/history.rs
@@ -1,16 +1,3 @@
-use crate::{
- commands::game::get_user_id,
- db::{
- self,
- connection,
- InvocationRecord,
- Meme,
- Metadata,
- },
- util,
- PoiseContext,
- CONFIG,
-};
use chrono::TimeZone;
use diesel::{
result::Error as DieselError,
@@ -34,7 +21,20 @@ use timeago::{
Formatter,
TimeUnit,
};
-use windows::core::s;
+
+use crate::{
+ commands::game::get_user_id,
+ config::CONFIG,
+ db::{
+ self,
+ connection,
+ InvocationRecord,
+ Meme,
+ Metadata,
+ },
+ util,
+ PoiseContext,
+};
lazy_static! {
static ref TIME_FORMATTER: Formatter = {
@@ -393,10 +393,7 @@ pub async fn query(ctx: PoiseContext<'_>, rest: util::RestVec) -> anyhow::Result
use regex::Regex;
use serenity::model::id::UserId;
- use crate::{
- db,
- CONFIG,
- };
+ use crate::db;
lazy_static! {
static ref CREATOR_REGEX: Regex = Regex::new(r"(?i)(?:by|creator)=(.*)").unwrap();
diff --git a/src/commands/meme/invoke.rs b/src/commands/meme/invoke.rs
index aff5c23..4b361a3 100644
--- a/src/commands/meme/invoke.rs
+++ b/src/commands/meme/invoke.rs
@@ -1,6 +1,5 @@
use diesel::{
result::Error as DieselError,
- row::NamedRow,
NotFound,
};
use grate::tracing;
@@ -93,10 +92,10 @@ pub(crate) async fn _meme(
x.id,
false,
)
- .await?;
+ .await?;
x
- }
+ },
Err(e) => {
return if let Some(NotFound) = e.downcast_ref::<DieselError>() {
tracing::info!("requested meme not found in database");
@@ -107,7 +106,7 @@ pub(crate) async fn _meme(
util::reply(ctx, "what in ryan's name").await?;
Err(e.into())
};
- }
+ },
};
send_meme(ctx, &mem, &mut conn).await
@@ -135,15 +134,15 @@ async fn rand_meme(ctx: PoiseContext<'_>, audio_playback: AudioPlayback) -> anyh
mem.id,
true,
)
- .await?;
+ .await?;
send_meme(ctx, &mem, &mut conn).await?;
Ok(())
- }
+ },
Ok(None) => {
tracing::info!("random meme not found");
util::reply(ctx, "i don't know any :(").await?;
Ok(())
- }
+ },
Err(e) => {
if let Some(NotFound) = e.downcast_ref::<DieselError>() {
tracing::info!("random meme not found");
@@ -154,7 +153,7 @@ async fn rand_meme(ctx: PoiseContext<'_>, audio_playback: AudioPlayback) -> anyh
util::reply(ctx, "HELP").await?;
Err(e.into())
- }
+ },
}
}
@@ -177,16 +176,16 @@ pub async fn rare_meme(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
meme.id,
true,
)
- .await?;
+ .await?;
send_meme(ctx, &meme, &mut conn).await
- }
+ },
Ok(None) => {
tracing::info!("rare meme not found");
util::reply(ctx, "i don't know any :(").await?;
Ok(())
- }
+ },
Err(e) => {
if let Some(NotFound) = e.downcast_ref::<DieselError>() {
@@ -199,6 +198,6 @@ pub async fn rare_meme(ctx: PoiseContext<'_>) -> anyhow::Result<()> {
util::reply(ctx, "THE MEME MARKET IS IN FREEFALL").await?;
Err(e.into())
- }
+ },
}
}
diff --git a/src/commands/meme/mod.rs b/src/commands/meme/mod.rs
index eb6aa1d..3883f3e 100644
--- a/src/commands/meme/mod.rs
+++ b/src/commands/meme/mod.rs
@@ -1,3 +1,8 @@
+use std::{
+ borrow::ToOwned,
+ default::Default,
+};
+
use diesel_async::AsyncPgConnection;
use grate::tracing;
use rand::random;
@@ -19,10 +24,6 @@ use songbird::input::{
Compose,
Input,
};
-use std::{
- borrow::ToOwned,
- default::Default,
-};
pub use self::{
create::*,
@@ -38,7 +39,6 @@ use crate::{
},
util,
PoiseContext,
- CONFIG,
};
mod create;
@@ -113,6 +113,9 @@ async fn send_meme(
return Ok(());
};
+ let volume = util::volume(ctx).await;
+ tracing::debug!(volume);
+
{
let (_sb, call) = songbird(ctx).await?;
let mut call = call.lock().await;
@@ -121,7 +124,8 @@ async fn send_meme(
call.join(voice_channel).await?;
}
- call.enqueue_input(Input::Lazy(Box::new(audio))).await;
+ let handle = call.enqueue_input(Input::Lazy(Box::new(audio))).await;
+ handle.set_volume(volume as _)?;
}
util::react(ctx, ReactionType::Unicode("📣".to_owned())).await?;