WIP: Basic Routine Functionality #40
2 changed files with 55 additions and 16 deletions
|
@ -580,7 +580,7 @@ impl BotActionTrait for Listener {
|
|||
}
|
||||
|
||||
// #[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||
#[derive(PartialEq, Eq, Hash)]
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
pub enum RoutineAttr {
|
||||
DelayedStart,
|
||||
ScheduledStart(DateTime<Local>), // Scheduled Date (if any) after which, if not started, may trigger
|
||||
|
@ -718,31 +718,60 @@ impl Routine {
|
|||
// }
|
||||
// );
|
||||
|
||||
let mut attribute_supported = false;
|
||||
|
||||
for given_routine in routine_attr {
|
||||
|
||||
if !matches!(given_routine,RoutineAttr::DelayedStart)
|
||||
&& !matches!(given_routine,RoutineAttr::ScheduledStart(_))
|
||||
&& !matches!(given_routine,RoutineAttr::LoopDuration(_))
|
||||
&& !matches!(given_routine,RoutineAttr::LoopInfinitely)
|
||||
&& !matches!(given_routine,RoutineAttr::RunOnce)
|
||||
&& !matches!(given_routine,RoutineAttr::MaxTimeThreshold(_))
|
||||
&& !matches!(given_routine,RoutineAttr::MaxIterations(_))
|
||||
// if !matches!(given_routine,RoutineAttr::DelayedStart)
|
||||
// && !matches!(given_routine,RoutineAttr::ScheduledStart(_))
|
||||
// && !matches!(given_routine,RoutineAttr::LoopDuration(_))
|
||||
// && !matches!(given_routine,RoutineAttr::LoopInfinitely)
|
||||
// && !matches!(given_routine,RoutineAttr::RunOnce)
|
||||
// && !matches!(given_routine,RoutineAttr::MaxTimeThreshold(_))
|
||||
// && !matches!(given_routine,RoutineAttr::MaxIterations(_))
|
||||
if matches!(given_routine,RoutineAttr::DelayedStart)
|
||||
|| matches!(given_routine,RoutineAttr::ScheduledStart(_))
|
||||
|| matches!(given_routine,RoutineAttr::LoopDuration(_))
|
||||
|| matches!(given_routine,RoutineAttr::LoopInfinitely)
|
||||
|| matches!(given_routine,RoutineAttr::RunOnce)
|
||||
|| matches!(given_routine,RoutineAttr::MaxTimeThreshold(_))
|
||||
|| matches!(given_routine,RoutineAttr::MaxIterations(_))
|
||||
|
||||
{
|
||||
botlog::trace(
|
||||
"[ERROR][Routine Feature NOT IMPLEMENTED]",
|
||||
Some("Routine > Validate_attr()".to_string()),
|
||||
None,
|
||||
);
|
||||
|
||||
Log::flush();
|
||||
attribute_supported = true;
|
||||
|
||||
return Err("NOT IMPLEMENTED".to_string());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
if !attribute_supported {
|
||||
botlog::trace(
|
||||
"[ERROR][Routine Feature NOT IMPLEMENTED]",
|
||||
Some("Routine > Validate_attr()".to_string()),
|
||||
None,
|
||||
);
|
||||
|
||||
Log::flush();
|
||||
|
||||
botlog::trace(
|
||||
format!(
|
||||
"[ERROR][Routine Feature NOT IMPLEMENTED] > Problem Routine - {:?}"
|
||||
,routine_attr).as_str(),
|
||||
Some("Routine > Validate_attr()".to_string()),
|
||||
None,
|
||||
);
|
||||
|
||||
Log::flush();
|
||||
|
||||
return Err("NOT IMPLEMENTED".to_string());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if unimplemented.next().is_some() {
|
||||
|
||||
|
@ -809,7 +838,7 @@ impl Routine {
|
|||
// {
|
||||
|
||||
botlog::trace(
|
||||
"[ERROR][Routine Feature NOT IMPLEMENTED]",
|
||||
"[OK][Implemented & Validated]",
|
||||
Some("Routine > Validate_attr()".to_string()),
|
||||
None,
|
||||
);
|
||||
|
|
|
@ -191,6 +191,16 @@ async fn countdown_chnl_v1(params : ExecBodyParams) {
|
|||
// Some(a) => a,
|
||||
// };
|
||||
|
||||
// let routine_lock = arr.read().await;
|
||||
// if let Some(a) = routine_lock.remaining_iterations.clone() {
|
||||
// println!("Remaining iterations > {}",a)
|
||||
// }
|
||||
|
||||
{
|
||||
let routine_lock = arr.write().await;
|
||||
let a = routine_lock.remaining_iterations;
|
||||
println!("remaining iterations : {:?}", a);
|
||||
}
|
||||
|
||||
botlog::trace(
|
||||
"after loading remaining iterations",
|
||||
|
|
Loading…
Reference in a new issue