MajMcCloud/TelegramBotFramework

Add method to save session states directly without stopping the Bot

MajMcCloud opened this issue ยท 2 comments

image

Feedback by Xilosof

I tried the method you recommended in the chat.
bot.Sessions.SaveSessionStates(bot.StateMachine);
Its Work!

Simple Demo:

var bot = new TelegramBotBase.BotBase<forms.StartForm> (BotConfig.ApiKey);

bot.StateMachine = new TelegramBotBase.States.JSONStateMachine (
AppContext.BaseDirectory + "config\\states.json");
            
bot.Start ();

Console.WriteLine ("Bot started");

Console.ReadLine ();
bot.Sessions.SaveSessionStates(bot.StateMachine);

glad to hear, that this works !

we will integrate it later as a standalone method