Skip to content

[v0.14] New era of controller's state and improvements in Unknown handlers

Compare
Choose a tag to compare
@k0dep k0dep released this 06 Aug 22:48
· 25 commits to master since this release

Q() supports classes !

That time has come! Now you can do this:

var foo = new ExampleClass
{
    IntField = 25,
    StringProp = "very looooong string with many words"
};
Button("Click me", Q(HandleIt, foo));

....
[Action]
void HandleIt(ExampleClass foo)
{
    PushL($"StringProp: {foo.StringProp}");
}

Looks like magic but it works!

Example is here

Controller state saving and restoring

Now you can save controller's state acros the updates. "State" means controller's fields and properties.
To save the state you have to mark it with [State] attribute.
It looks like that:

class Example : BotController
{
    [State]
    int intField;
    
    ...
}

intField will be saved between user's updates.

Fully featured example is located here

improved Unknown handlers

Beginning from v0.14 you have ability to make many of Unknown handlers in your code.
Second thing is that you can use filters to decide when botf has to call your handler.

See the complete example of the new feature here