removed some log messages. rustfmt
This commit is contained in:
parent
e47715917e
commit
e5ab99f67b
@ -46,7 +46,7 @@ use tokio::{
|
|||||||
use crate::{
|
use crate::{
|
||||||
commands::{info_cmds, moderation_cmds, reminder_cmds, todo_cmds},
|
commands::{info_cmds, moderation_cmds, reminder_cmds, todo_cmds},
|
||||||
component_models::ComponentDataModel,
|
component_models::ComponentDataModel,
|
||||||
consts::{CNC_GUILD, SUBSCRIPTION_ROLES, THEME_COLOR, REMIND_INTERVAL},
|
consts::{CNC_GUILD, REMIND_INTERVAL, SUBSCRIPTION_ROLES, THEME_COLOR},
|
||||||
framework::RegexFramework,
|
framework::RegexFramework,
|
||||||
models::command_macro::CommandMacro,
|
models::command_macro::CommandMacro,
|
||||||
};
|
};
|
||||||
@ -96,12 +96,9 @@ impl EventHandler for Handler {
|
|||||||
let reminders = sender::Reminder::fetch_reminders(&pool).await;
|
let reminders = sender::Reminder::fetch_reminders(&pool).await;
|
||||||
|
|
||||||
if reminders.len() > 0 {
|
if reminders.len() > 0 {
|
||||||
info!("=================================================");
|
info!("Preparing to send {} reminders.", reminders.len());
|
||||||
info!("Preparing to send {} reminders:", reminders.len());
|
|
||||||
|
|
||||||
for reminder in reminders {
|
for reminder in reminders {
|
||||||
info!("Sending {:?}", reminder);
|
|
||||||
|
|
||||||
reminder.send(pool.clone(), ctx.clone()).await;
|
reminder.send(pool.clone(), ctx.clone()).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
use chrono::Duration;
|
use chrono::Duration;
|
||||||
|
use chrono_tz::Tz;
|
||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
|
use num_integer::Integer;
|
||||||
|
use regex::{Captures, Regex};
|
||||||
use serenity::{
|
use serenity::{
|
||||||
builder::CreateEmbed,
|
builder::CreateEmbed,
|
||||||
http::{CacheHttp, Http, StatusCode},
|
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,
|
Error, Result,
|
||||||
};
|
};
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
@ -11,11 +18,6 @@ use sqlx::{
|
|||||||
MySqlPool,
|
MySqlPool,
|
||||||
};
|
};
|
||||||
|
|
||||||
use chrono_tz::Tz;
|
|
||||||
use num_integer::Integer;
|
|
||||||
use regex::{Captures, Regex};
|
|
||||||
use serenity::model::channel::Channel;
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref TIMEFROM_REGEX: Regex =
|
pub static ref TIMEFROM_REGEX: Regex =
|
||||||
Regex::new(r#"<<timefrom:(?P<time>\d+):(?P<format>.+)?>>"#).unwrap();
|
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 hours: u64 = 0;
|
||||||
let mut minutes: u64 = 0;
|
let mut minutes: u64 = 0;
|
||||||
|
|
||||||
for (rep, time_type, div) in [
|
for (rep, time_type, div) in
|
||||||
("%d", &mut days, 86400),
|
[("%d", &mut days, 86400), ("%h", &mut hours, 3600), ("%m", &mut minutes, 60)].iter_mut()
|
||||||
("%h", &mut hours, 3600),
|
|
||||||
("%m", &mut minutes, 60),
|
|
||||||
]
|
|
||||||
.iter_mut()
|
|
||||||
{
|
{
|
||||||
if format.contains(*rep) {
|
if format.contains(*rep) {
|
||||||
let (divided, new_seconds) = seconds.div_rem(&div);
|
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(e) => {
|
Err(e) => Err(e),
|
||||||
Err(e)
|
_ => Err(Error::Other("Channel not of valid type")),
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
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)) =
|
let result = if let (Some(webhook_id), Some(webhook_token)) =
|
||||||
(self.webhook_id, &self.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 {
|
if let Ok(webhook) = webhook_res {
|
||||||
send_to_webhook(cache_http, &self, webhook, embed).await
|
send_to_webhook(cache_http, &self, webhook, embed).await
|
||||||
|
Loading…
Reference in New Issue
Block a user