From c8a20147e52640ffdfd99f79edcb4a48a0a65752 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Tue, 15 Feb 2022 12:08:53 -0800 Subject: [PATCH] cargo fmt --- src/commands/challenge.rs | 47 ++++++++++++++++++++++++++------------- src/commands/mod.rs | 2 +- src/main.rs | 2 +- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/commands/challenge.rs b/src/commands/challenge.rs index 6aa5dbf..4c200ec 100644 --- a/src/commands/challenge.rs +++ b/src/commands/challenge.rs @@ -7,19 +7,34 @@ use std::fs; #[command] async fn challenge(ctx: &Context, msg: &Message) -> CommandResult { - println!("Command received"); - let challenge_dir = env::var("CHALLENGE_DIR").unwrap(); - let paths = fs::read_dir(challenge_dir).unwrap(); - let challenge = { - let mut max = 0; - for path in paths { - let number = path.unwrap().path().file_stem().unwrap().to_str().unwrap().parse::().unwrap(); - if number > max { - max = number; - } - } - max - }; - msg.reply(&ctx.http, format!("Tegaki Tuesday #{n}: https://tegakituesday.com/{n}", n = challenge)).await?; - Ok(()) -} \ No newline at end of file + println!("Command received"); + let challenge_dir = env::var("CHALLENGE_DIR").unwrap(); + let paths = fs::read_dir(challenge_dir).unwrap(); + let challenge = { + let mut max = 0; + for path in paths { + let number = path + .unwrap() + .path() + .file_stem() + .unwrap() + .to_str() + .unwrap() + .parse::() + .unwrap(); + if number > max { + max = number; + } + } + max + }; + msg.reply( + &ctx.http, + format!( + "Tegaki Tuesday #{n}: https://tegakituesday.com/{n}", + n = challenge + ), + ) + .await?; + Ok(()) +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 68d80c7..5268518 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,3 +1,3 @@ +pub mod challenge; pub mod kanji; pub mod owner; -pub mod challenge; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index c8559b7..d0c8e29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ mod commands; use std::{collections::HashSet, env, sync::Arc}; -use commands::{kanji::*, owner::*, challenge::*}; +use commands::{challenge::*, kanji::*, owner::*}; use serenity::{ async_trait, client::bridge::gateway::ShardManager,