From b602673b94b7db41b46e309a93503052089510f1 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Sat, 26 Sep 2020 15:16:47 -0400 Subject: add france, shrek, better debug options --- src/commands/today/france.rs | 16 ++++++++++++++++ src/commands/today/mod.rs | 10 +++++++++- src/commands/today/shrek.rs | 9 +++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/commands/today/france.rs create mode 100644 src/commands/today/shrek.rs diff --git a/src/commands/today/france.rs b/src/commands/today/france.rs new file mode 100644 index 0000000..28c7b96 --- /dev/null +++ b/src/commands/today/france.rs @@ -0,0 +1,16 @@ +use super::prelude::*; + +pub fn france(date: chrono::NaiveDate) -> TodayIter { + let ok = match month_day(date) { + // bastille day + (7, 14) => true, + + _ => false, + }; + + if !ok { + return Box::new(empty()); + } + + Box::new(once(by_url("https://www.youtube.com/watch?v=VFevH5vP32s"))) +} diff --git a/src/commands/today/mod.rs b/src/commands/today/mod.rs index 84f3f1b..ff06cc8 100644 --- a/src/commands/today/mod.rs +++ b/src/commands/today/mod.rs @@ -33,6 +33,8 @@ mod nov_5; mod halloween; mod ussr; +mod france; +mod shrek; mod wednesday; @@ -68,6 +70,8 @@ lazy_static! { halloween::halloween, ussr::ussr, + france::france, + shrek::shrek, wednesday::wednesday, @@ -100,12 +104,16 @@ pub fn today(ctx: &mut Context, msg: &Message, args: Args) -> Result<()> { .flat_map(|f| f(today)) .collect(); - debug!("selected {} options for {}", options.len(), today); + debug!("{} options for {}", options.len(), today); let play_args = options.choose(&mut thread_rng()) .map(|x| x.as_play_args(msg)); if let Some(play_args) = play_args { + play_args.data.as_ref().left().iter().for_each(|url| { + debug!("today selected: {}", url); + }); + let queue_lock = ctx.data.write().get::().cloned().unwrap(); let mut play_queue = queue_lock.write().unwrap(); diff --git a/src/commands/today/shrek.rs b/src/commands/today/shrek.rs new file mode 100644 index 0000000..0f16337 --- /dev/null +++ b/src/commands/today/shrek.rs @@ -0,0 +1,9 @@ +use super::prelude::*; + +pub fn shrek(date: chrono::NaiveDate) -> TodayIter { + if month_day(date) != (4, 22) { + return Box::new(empty()); + } + + Box::new(once(by_url("https://www.youtube.com/watch?v=L_jWHffIx5E"))) +} -- cgit v1.3.1