[ENH] BotAction Execution Body implementation #7
Labels
No labels
Automated
Backlog
Post_Prototype_1.0
Bot_Code
Core
Bot_Code
Custom
CI/CD
Complexity
Advanced
Complexity
Basic
Complexity
Expert
Complexity
Intermediate
Kind/Breaking
Kind/Bug
Kind/Bug Fix
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Nix
Ownership
Collab
Ownership
Collab with Leads
Ownership
Individual Lead
Ownership
In-Review
Ownership
Needs Owner > May Delegate
Ownership
Workshop with Leads
Phase 1.0
Requirements > Drafting
Phase 1.0
Requirements > Researching
Phase 1.0
Requirements > Review & Planning
Phase 2.0
Design > Research & Analysis
Phase 3.0
Coding > Implementation
Phase 4.0
QA > Unit Testing & Design
Phase 5.0
Resolution > Completed
Phase 5.0
Resolution > Review for Completion
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: modulatingforce/forcebot_rs#7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Enhance
BotAction
so reference to anasync fn
can execute as expected.Expectation :
say_in_reply_to()
that might require async ?At the moment, I'm running into issues as I'm not able to store
async fn
in a struct like BotAction's exec_body ; because of this, I'm not able to independently call client module code.Example problem case :
I get a Compilation Error for the implementation I tried
Given the following
in
modules/experiments.rs
For the above, client module code would be
experiments.rs
. There may be an issue in an understanding the type I should be storing these (e.g., something withdyn
keyword?)This is relatively high priority. The understanding of this would help other
BotAction
types . Considering this almost a show-stopping knowledge gapAfter testing in a sandbox project, I believe I'm able to get a working implementation that stores an
async
function into a structSo it looks like a few things that I can keep in mind :
To avoid infinite or cyclical types, I should have
Listener
orModuleManager
interact withChat
commands through some intermediary likeBotInstance
, but I should not passBotInstance
to any of these, asBotInstance
contains these structsDefine the custom function to be
async
, and has a signature similar to the followingListener
object can have a definition like the followingBotInstance
is initialized with listeners, it should pass exec bodies in the following formListener
exec_body, pass theChat
objectAfter discussing with tori, finally after so much random troubleshooting on my part, tori was able to identify a solution that allowed an async exec_body within a struct to be executed , and not have other issues - namely, not have issues storing in a HashMap of other Actions of the same type
The following is a very small demonstration of working code , that I've encapsulated a bit in the hopes that a module developer can create an execution body with ease for botactions they create
The following are next :
I was initially running into an issue where defining an Async fn with parameters were throwing compile errors, but the following is working example with an argument/parameter
As of
3f6e3710ef
in Dev branch, I can now add working execution bodies for bothListener
andBotCommand
The resolution took the ideas from this issue, and melded it with my Rust_Notes Obsidian Vault for 20240105_DESIGN_Working_Custom_Exec_Body - on the rust note repo as https://git.flake.sh/modulatingforce/Rust_Notes/src/branch/main/forcebot_rs%20Notes/Issues/20240105_DESIGN_Working_Custom_Exec_Body/20240105_DESIGN_Working_Custom_Exec_Body.md
I'll keep this in monitoring for now for a few days before I move this in the project to Review for Completion
No longer an issue
Current working implementation uses
Arc<RwLock<BotInstance>>
to pass to custom functions