[CORE] Bot Level or Bot Command Level Persistent Settings & Variables #33

Open
opened 2024-03-19 13:37:55 -04:00 by modulatingforce · 3 comments

At the moment, there are no persistent settings at Bot Command level or those that might be added custom at a Bot Level

I'd like to have an object that could on the fly add Application Settings that could be adjusted and might depend on module? This could be easily accommodated by a HashMap in whatever combination I want

Example Use Case

As a Custom Module Developer , I want to create a module that requires storing some persistent variables across runs of the BotActions I've defined


Possible Implementation?

  1. HashMap based on Modules that is stored at BotInstance level or Child of BotInstance that might store something along the following pseudocode
  • Key : ( StatusLvl , ModType , String (application setting name) )
  • Value : String

Related

#[derive(Debug)]
pub enum StatusLvl {
    Instance,
    _Ch(ChType),
}

// ...

#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub enum ModType {
    BotModule(String),
}

In the above, as a Custom Modules Developer, I could use commands like the following to get and set settings

let lastwin = appsettings.get(
   Ch(ChType::Channel("testChannel")),
   ModType::BotModule("Experiments 001"),
   "Last Winner");

appsettings.set(
   Ch(ChType::Channel("testChannel")),
   ModType::BotModule("Experiments 001"),
   "Last Winner",
   "ModulatingForce");
At the moment, there are no persistent settings at Bot Command level or those that might be added custom at a Bot Level I'd like to have an object that could on the fly add Application Settings that could be adjusted and might depend on module? This could be easily accommodated by a `HashMap` in whatever combination I want # Example Use Case As a Custom Module Developer , I want to create a module that requires storing some persistent variables across runs of the `BotActions` I've defined --- # Possible Implementation? 1. `HashMap` based on Modules that is stored at `BotInstance` level or Child of `BotInstance` that might store something along the following pseudocode - Key : ( `StatusLvl` , `ModType` , `String` (application setting name) ) - Value : `String` Related ``` rust #[derive(Debug)] pub enum StatusLvl { Instance, _Ch(ChType), } // ... #[derive(Debug, PartialEq, Eq, Hash, Clone)] pub enum ModType { BotModule(String), } ``` In the above, as a Custom Modules Developer, I could use commands like the following to get and set settings ```rust let lastwin = appsettings.get( Ch(ChType::Channel("testChannel")), ModType::BotModule("Experiments 001"), "Last Winner"); appsettings.set( Ch(ChType::Channel("testChannel")), ModType::BotModule("Experiments 001"), "Last Winner", "ModulatingForce"); ```
modulatingforce added the
Priority
Medium
Kind/Feature
labels 2024-03-19 13:38:12 -04:00
modulatingforce added this to the Prototype 1.0 milestone 2024-03-19 13:38:16 -04:00
modulatingforce self-assigned this 2024-03-19 13:38:19 -04:00
Author
Owner

Both the following issues might be redundant , or we may want to be cherry pick what we'd like from both designs depending on critical setting or mode

#29
#33

Both the following issues might be redundant , or we may want to be cherry pick what we'd like from both designs depending on critical setting or mode https://git.flake.sh/modulatingforce/forcebot_rs/issues/29 https://git.flake.sh/modulatingforce/forcebot_rs/issues/33
modulatingforce added the
Status
Need More Info
label 2024-03-19 13:49:39 -04:00
Author
Owner

Removing Need More Info flag - we can still work on this feature for now for Custom Modules to have a degree of state persistence . I can revisit #29 later

Removing Need More Info flag - we can still work on this feature for now for Custom Modules to have a degree of state persistence . I can revisit https://git.flake.sh/modulatingforce/forcebot_rs/issues/29 later
modulatingforce removed the
Status
Need More Info
label 2024-03-19 13:54:00 -04:00
modulatingforce added this to the Rust Learning project 2024-03-19 13:58:06 -04:00
Author
Owner

Maybe should rename this as AppRegistry since this would not only include custom settings that a modules developer may set, but also auxiliary temporary variables that change like a running total or last time a win occurred


Or better yet, not only rename to AppRegistry but also include a related enum for the type

pub enum RegType {
    Setting, // Custom Settings - for example starting parameters
    ModVariable, // Variables that may be managed and updated separately, like Running Total 
}

And involve a HashMap with :

  • Key : ( StatusLvl , ModType , RegType , String (application setting name) )
  • Value : String
Maybe should rename this as `AppRegistry` since this would not only include custom settings that a modules developer may set, but also auxiliary temporary variables that change like a running total or last time a win occurred --- Or better yet, not only rename to `AppRegistry` but also include a related enum for the type ``` rust pub enum RegType { Setting, // Custom Settings - for example starting parameters ModVariable, // Variables that may be managed and updated separately, like Running Total } ``` And involve a `HashMap` with : - Key : ( `StatusLvl` , `ModType` , `RegType` , String (application setting name) ) - Value : String
modulatingforce modified the project from Rust Learning to Forcebot Prototype 1.0 Push 2024-03-27 18:33:32 -04:00
modulatingforce added the
Bot_Code
Core
Complexity
Advanced
labels 2024-03-27 18:33:42 -04:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: modulatingforce/forcebot_rs#33
No description provided.