io_tweaks #39

Merged
vky merged 2 commits from io_tweaks into dev 2024-11-29 11:24:48 +01:00
3 changed files with 26 additions and 23 deletions

View File

@ -55,8 +55,6 @@ pub struct VoteContainer {
pub(crate) group: Option<serenity::RoleId>,
/// Optional hours describing the specific date of the event
pub(crate) hours: Option<String>,
/// Short name, used in voting titles
pub(crate) short_name: Option<String>,
/// Auto-Start date of the event (in human-readable format)
pub(crate) start_date: Option<String>,
/// Days not selected for the vote
@ -121,21 +119,19 @@ pub(crate) struct WeeklyVoteModal {
#[name = "Groupe"]
#[placeholder = "groupe (sans le @)"]
group: Option<String>,
/// The time a which the event shall take place
#[name = "Horaires"]
#[placeholder = "'21h - 23h' par défaut"]
hours: Option<String>,
/// The name of the event
#[name = "Nom du jeu"]
#[placeholder = "'FFXIV', 'MHW', 'D&D'..."]
short_name: Option<String>,
/// The date from which the vote can become active
#[name = "Date de début du vote"]
#[placeholder = "'ven', '10', '21 jan', vide pour la prochaine période de votes"]
start_date: Option<String>,
/// Days for which reactions should "not count"
#[name = "Jours non dispos"]
#[placeholder = "'lun', '30', '2 dec'"]
non_days: Option<String>,
// Max fields is 5 so the two below will have to be command-exclusive
// #[name = "Date de début du vote"]
// #[placeholder = "'ven', '10', '21 jan', vide pour la prochaine période de votes"]
// start_date: Option<String>,
// #[name = "Jours non dispos"]
// #[placeholder = "'lun', '30', '2 dec'"]
// non_days: Option<String>,
// /// The time a which the event shall take place
// #[name = "Horaires"]
// #[placeholder = "'21h - 23h' par défaut"]
// hours: Option<String>,
}
#[cfg(test)] // This default implementation only exists during testing
@ -198,7 +194,6 @@ pub async fn vote_modal(
description: underlying_data.description,
group,
hours: underlying_data.hours,
short_name: underlying_data.short_name,
identifier: VoteTypeIdentifier::WeeklyVote,
..Default::default()
};
@ -263,7 +258,6 @@ fn find_role_from_str(group: Option<&str>, roles: Vec<&str>) -> Option<String> {
pub async fn vote_command(
ctx: Context<'_>,
#[description = "Titre"] title: String,
#[description = "Nom du jeu"] short_name: Option<String>,
#[description = "Groupe"] group: Option<serenity::RoleId>,
#[description = "Description"] description: String,
#[description = "Horaires"] hours: Option<String>,
@ -275,7 +269,6 @@ pub async fn vote_command(
description,
group,
hours,
short_name,
start_date,
non_days,
identifier: VoteTypeIdentifier::WeeklyVote,

View File

@ -22,7 +22,7 @@ async fn main() {
init_logger().unwrap();
// TODO: Check that this is actually what we want
task::spawn(main_scheduler_loop(
time::interval(time::Duration::from_secs(1)),
time::interval(time::Duration::from_secs(5)),
event_context.clone(),
));
discord_main_loop(event_context).await;

View File

@ -15,6 +15,8 @@
use crate::votes::EventHolder;
use chrono::{DateTime, Local, NaiveDate};
use poise::serenity_prelude::{CacheHttp, ChannelId};
use serde::Serialize;
/// The main scheduler waiting and dispatch loop.
///
@ -40,9 +42,17 @@ fn fk_around(ev_ctx: &EventHolder) {
"In the fk_around function ({}):",
Local::now() // &ev_ctx
);
if let Some(discord_ctx) = ev_ctx.discord_ctx.lock().unwrap().as_mut() {
println!("Fking around : {:#?}", discord_ctx);
}
// if let Some(discord_ctx) = ev_ctx.discord_ctx.lock().unwrap().as_mut() {
// println!("Fking around : {:#?}", discord_ctx);
// let _ = discord_ctx
// .http()
// .send_message(
// ChannelId::new(1300786300143800351),
// Vec::new(),
// &"This is a message".to_owned(),
// )
// .await;
// }
}
/// The `watchdog_update` function updates the state of the watchdog and executes the necessary tasks.