From ffba60b278162707bc4eb004c3bfb6b2e9595213 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Wed, 8 May 2024 12:55:35 -0400 Subject: rework to use songbird --- src/commands/mod.rs | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src/commands/mod.rs') diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 4893e73..c8a7014 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,3 +1,4 @@ +use crate::util; use log::info; use serenity::framework::{ standard::macros::group, @@ -9,10 +10,7 @@ pub use self::meme::*; pub use self::{ playback::*, roll::ROLL_COMMAND, - today::{ - today, - TODAY_COMMAND, - }, + today::TODAY_COMMAND, }; pub(crate) mod playback; @@ -38,16 +36,24 @@ pub fn register_commands(f: StandardFramework) -> StandardFramework { let result = result.group(&crate::game::GAME_GROUP); result.help(&help::HELP).unrecognised_command(|ctx, msg, unrec| { - let url = match msg.content.split_whitespace().skip(1).next() { - Some(x) if x.starts_with("http") => x, - _ => { - info!("bad command formatting: '{}'", unrec); - let _ = ctx.send(msg.channel_id, "format your commands right. fuck you.", msg.tts); - return; - }, - }; - - let _ = _play(ctx, msg, &url); + Box::pin(async move { + let url = match msg.content.split_whitespace().skip(1).next() { + Some(x) if x.starts_with("http") => x, + _ => { + info!("bad command formatting: '{}'", unrec); + let _ = util::send( + ctx, + msg.channel_id, + "format your commands right. fuck you.", + msg.tts, + ) + .await; + return; + }, + }; + + let _ = _play(ctx, msg, &url); + }) }) } -- cgit v1.3.1