removed some log messages. rustfmt

This commit is contained in:
jude 2021-12-21 13:46:10 +00:00
parent e47715917e
commit e5ab99f67b
2 changed files with 16 additions and 24 deletions

View File

@ -46,7 +46,7 @@ use tokio::{
use crate::{
commands::{info_cmds, moderation_cmds, reminder_cmds, todo_cmds},
component_models::ComponentDataModel,
consts::{CNC_GUILD, SUBSCRIPTION_ROLES, THEME_COLOR, REMIND_INTERVAL},
consts::{CNC_GUILD, REMIND_INTERVAL, SUBSCRIPTION_ROLES, THEME_COLOR},
framework::RegexFramework,
models::command_macro::CommandMacro,
};
@ -96,12 +96,9 @@ impl EventHandler for Handler {
let reminders = sender::Reminder::fetch_reminders(&pool).await;
if reminders.len() > 0 {
info!("=================================================");
info!("Preparing to send {} reminders:", reminders.len());
info!("Preparing to send {} reminders.", reminders.len());
for reminder in reminders {
info!("Sending {:?}", reminder);
reminder.send(pool.clone(), ctx.clone()).await;
}
}

View File

@ -1,9 +1,16 @@
use chrono::Duration;
use chrono_tz::Tz;
use log::{error, info, warn};
use num_integer::Integer;
use regex::{Captures, Regex};
use serenity::{
builder::CreateEmbed,
http::{CacheHttp, Http, StatusCode},
model::{channel::Embed as SerenityEmbed, id::ChannelId, webhook::Webhook},
model::{
channel::{Channel, Embed as SerenityEmbed},
id::ChannelId,
webhook::Webhook,
},
Error, Result,
};
use sqlx::{
@ -11,11 +18,6 @@ use sqlx::{
MySqlPool,
};
use chrono_tz::Tz;
use num_integer::Integer;
use regex::{Captures, Regex};
use serenity::model::channel::Channel;
lazy_static! {
pub static ref TIMEFROM_REGEX: Regex =
Regex::new(r#"<<timefrom:(?P<time>\d+):(?P<format>.+)?>>"#).unwrap();
@ -29,12 +31,8 @@ fn fmt_displacement(format: &str, seconds: u64) -> String {
let mut hours: u64 = 0;
let mut minutes: u64 = 0;
for (rep, time_type, div) in [
("%d", &mut days, 86400),
("%h", &mut hours, 3600),
("%m", &mut minutes, 60),
]
.iter_mut()
for (rep, time_type, div) in
[("%d", &mut days, 86400), ("%h", &mut hours, 3600), ("%m", &mut minutes, 60)].iter_mut()
{
if format.contains(*rep) {
let (divided, new_seconds) = seconds.div_rem(&div);
@ -441,12 +439,8 @@ DELETE FROM reminders WHERE `id` = ?
Err(e) => Err(e),
}
}
Err(e) => {
Err(e)
}
_ => {
Err(Error::Other("Channel not of valid type"))
}
Err(e) => Err(e),
_ => Err(Error::Other("Channel not of valid type")),
}
}
@ -518,7 +512,8 @@ UPDATE `channels` SET paused = 0, paused_until = NULL WHERE `channel` = ?
let result = if let (Some(webhook_id), Some(webhook_token)) =
(self.webhook_id, &self.webhook_token)
{
let webhook_res = cache_http.http().get_webhook_with_token(webhook_id, webhook_token).await;
let webhook_res =
cache_http.http().get_webhook_with_token(webhook_id, webhook_token).await;
if let Ok(webhook) = webhook_res {
send_to_webhook(cache_http, &self, webhook, embed).await