Open Kataane opened 7 months ago
Hey, looks interesting. I heared something about this at @NickChapsas (https://www.youtube.com/@nickchapsas)
But for now I have to get more into the benefits and how to implement such things.
Maybe my current "Lab" project is fitting here for a better needs, not sure yet. But please dont hesitate to give it a look: https://github.com/MajMcCloud/TelegramBotFramework/tree/Lab/Experiments/ExternalActionManager
Cheers!
Hi. I am currently working on implementing automatic form call using IServiceProvider. Since in the new .NET 8 they added the ability to get services by key.
The first thing that came to mind is to create a scope at the user session level. That is, the session started, created a start form via IServiceProvider. And then there is automatic navigation by parsing the command from the user and getting the form using the IServiceProvider and the command as a key. But it is difficult to implement it now, because SessionManager and DeviceSession are closed for extension.
At the moment i have the following working implementation.
Since the whole BotBase and session creation is not extensible. Making the wrapper / facade. Which will mimic BotBase.
Intercept the message to see if the message is a command.
Add a command attribute that specifies the command and its description
Create a command-form with a new attribute
All that's left to do is register it
It looks great and work, but it's not.
BotBaseInjectable is kludge doing this kind of navigation looks rather strange. Besides, it is hard to extend many things, for example SessionManager and DeviceSession. Maybe there are some ideas for improvement? Ready to assist in implementation.
Each step in the BotBase factory is bound to the next step, which makes it necessary to cast BotBaseBuilder to the required step.
Also, the problem with this solution is that you can't ignore StartFormFactory. And every time you intercept commands, StartForm will be displayed.
Best regards, Kataane.