aboutsummaryrefslogtreecommitdiff
path: root/src/commands/meme/create.rs
diff options
context:
space:
mode:
authorNathan Perry <np@nathanperry.dev>2024-05-08 14:15:42 -0400
committerNathan Perry <np@nathanperry.dev>2024-05-08 14:16:01 -0400
commit47817c4166937af24041a93e56ad9f841bf1e8f1 (patch)
treea8ec0a674a5a4e5046e1bc92c1c317a48b5e4815 /src/commands/meme/create.rs
parentffba60b278162707bc4eb004c3bfb6b2e9595213 (diff)
fixups: memes working
Diffstat (limited to 'src/commands/meme/create.rs')
-rw-r--r--src/commands/meme/create.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/commands/meme/create.rs b/src/commands/meme/create.rs
index 1c12f2a..ef6090e 100644
--- a/src/commands/meme/create.rs
+++ b/src/commands/meme/create.rs
@@ -110,6 +110,8 @@ pub async fn addmeme(ctx: &Context, msg: &Message, args: Args) -> CommandResult
#[command]
pub async fn addaudiomeme(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
+ debug!("running addaudiomeme");
+
let mut args = Args::new(args.rest(), DELIMS.as_ref());
let title = args.single_quoted::<String>()?;
@@ -117,7 +119,7 @@ pub async fn addaudiomeme(ctx: &Context, msg: &Message, args: Args) -> CommandRe
let elems = audio_str.split_whitespace().collect::<Vec<_>>();
- if elems.len() == 0 {
+ if elems.is_empty() {
util::send(ctx, msg.channel_id, "are you stupid", msg.tts).await?;
return Err(anyhow!("no audio link was provided").into());
}
@@ -127,6 +129,7 @@ pub async fn addaudiomeme(ctx: &Context, msg: &Message, args: Args) -> CommandRe
let (start, end) = parse_times(opts);
let youtube_url = util::ytdl_url(audio_link.as_str()).await?;
+ debug!("got download url: {youtube_url}");
let duration_opts = if let Some(e) = end {
vec![
@@ -184,6 +187,7 @@ pub async fn addaudiomeme(ctx: &Context, msg: &Message, args: Args) -> CommandRe
let mut audio_data = Vec::new();
let bytes = audio_reader.read_to_end(&mut audio_data).await?;
+ debug!("downloaded audio ({} bytes)", audio_data.len());
if bytes == 0 {
debug!("read 0 bytes from audio reader");