feat: fix period ++ burst_colours missing
This commit is contained in:
parent
0c1e534e19
commit
8ae9ec821f
17
Cargo.lock
generated
17
Cargo.lock
generated
@ -3535,6 +3535,15 @@ dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_cow"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64e84ce5596a72f0c4c60759a10ff8c22d5eaf227b0dc2789c8746193309058b"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.203"
|
||||
@ -3635,13 +3644,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serenity"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c64da29158bb55d70677cacd4f4f8eab1acef005fb830d9c3bea411b090e96a9"
|
||||
version = "0.12.2"
|
||||
source = "git+https://github.com/serenity-rs/serenity?branch=current#060ee3281b44f7e532f3ea5863c5df57340e1ec9"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"async-trait",
|
||||
"base64 0.21.7",
|
||||
"base64 0.22.1",
|
||||
"bitflags 2.5.0",
|
||||
"bytes",
|
||||
"chrono",
|
||||
@ -3655,6 +3663,7 @@ dependencies = [
|
||||
"reqwest",
|
||||
"secrecy",
|
||||
"serde",
|
||||
"serde_cow",
|
||||
"serde_json",
|
||||
"time",
|
||||
"tokio",
|
||||
|
@ -51,6 +51,8 @@ serde_with = "3.8.1"
|
||||
tokio-cron = "0.1.3"
|
||||
cron = "0.12.1"
|
||||
|
||||
[patch.crates-io]
|
||||
serenity = { git = "https://github.com/serenity-rs/serenity", branch = "current" }
|
||||
|
||||
[[bin]]
|
||||
name = "botdiscord"
|
||||
|
@ -1,11 +1,14 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::botv2::{
|
||||
use crate::{
|
||||
botv2::{
|
||||
domain::concour::{
|
||||
check_if_allowed::check_if_allowed,
|
||||
set_periode::{set_periode, SetPeriodeConcourError},
|
||||
},
|
||||
init::{Context, Error},
|
||||
},
|
||||
db::concour::ConcourStatus,
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
use cron::Schedule;
|
||||
@ -134,6 +137,39 @@ pub async fn period(
|
||||
false,
|
||||
);
|
||||
}
|
||||
// Restart the cronjob if concour is ongoing
|
||||
if concour.status == ConcourStatus::OnGoing {
|
||||
{
|
||||
let mut scheduler = ctx.data().scheduler.clone();
|
||||
match scheduler
|
||||
.stop_scheduled_job(concour.server_id, concour.channel_id)
|
||||
.await
|
||||
{
|
||||
Ok(_) => {
|
||||
info!("Cronjob stopped");
|
||||
match scheduler
|
||||
.add_concour_cron_job(
|
||||
concour.server_id,
|
||||
concour.channel_id,
|
||||
concour.periode,
|
||||
ctx.http(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(_) => {
|
||||
info!("Cronjob restarted");
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("Error restarting cronjob");
|
||||
}
|
||||
};
|
||||
}
|
||||
Err(err) => {
|
||||
warn!(err = err.to_string(), "Error stopping cronjob");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
output
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user