diff --git a/src/io.rs b/src/io.rs index fecf2fa..6e23bbe 100644 --- a/src/io.rs +++ b/src/io.rs @@ -34,7 +34,7 @@ type Context<'a> = poise::Context<'a, Data, GenericError>; #[derive(Debug, poise::Modal)] #[allow(dead_code)] // fields only used for Debug print #[name = "Créer un nouveau Vote"] -struct VoteCreation { +pub(crate) struct VoteCreation { /// The description of the event #[paragraph] #[name = "Description"] diff --git a/src/modules.rs b/src/modules.rs index 2e936d2..ddc50df 100644 --- a/src/modules.rs +++ b/src/modules.rs @@ -5,7 +5,53 @@ //! Many handler functions //! Every module encompassing a feature +use crate::io::VoteCreation; + #[cfg(test)] mod tests { // use super::*; } + +fn treatment_vote_modal( + ctx: poise::ApplicationContext<'_, Data, GenericError>, + data: VoteCreation, +) { + // parse data + // -> group needs to be matched with existing group or return an error + // -> check which of short_name and hours exist and decide on formatting + // create the final product and send to scheduler for next voting window + unimplemented!() +} + +fn treatment_vote_command( + ctx: poise::ApplicationContext<'_, Data, GenericError>, + data: VoteCreation, +) { + // parse data + // -> check which of short_name and hours exist and decide on formatting + // create the final product and send to scheduler with the start_date and non_days if specified + unimplemented!() +} + +fn treatment_short_vote( + ctx: poise::ApplicationContext<'_, Data, GenericError>, + data: VoteCreation, +) { + // parse data + // -> check whether hours exist and decide on formatting + // create the final product and send to scheduler with the start_date if specified and days + unimplemented!() +} + +fn treatment_long_vote(ctx: poise::ApplicationContext<'_, Data, GenericError>, data: VoteCreation) { + // parse data + // create the final product and pass it along with the start_date if it's here and the begining and end dates + unimplemented!() +} + +// 1: user types command (vote_modal) +// 2: modal pops +// 3: data from the modal gets parsed +// 3.1 : group has to be matched with groups else error +// 3.2 : check whether or not there are hours and short names, and decide on the formatting depending on it +// 4: send final output to scheduler, with (if possible) context so it can reply instead of sending a new post