Session Updates
This commit is contained in:
parent
567a9f937f
commit
4336ff1681
@ -173,7 +173,7 @@ namespace TelegramBotBase
|
||||
{
|
||||
TelegramBotBase.Tools.Console.SetHandler(() =>
|
||||
{
|
||||
this.Sessions.SaveSessionStates(this.StateMachine);
|
||||
this.Sessions.SaveSessionStates();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -115,6 +115,20 @@ namespace TelegramBotBase
|
||||
return this.SessionList.Where(a => a.Key < 0).Select(a => a.Value).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the previously saved states from the machine.
|
||||
/// </summary>
|
||||
public async void LoadSessionStates()
|
||||
{
|
||||
if (BotBase.StateMachine == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LoadSessionStates(BotBase.StateMachine);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Loads the previously saved states from the machine.
|
||||
/// </summary>
|
||||
|
||||
@ -275,9 +275,13 @@ namespace TelegramBotBase.Sessions
|
||||
|
||||
OnMessageSent(new MessageSentEventArgs(m));
|
||||
}
|
||||
catch (ApiRequestException)
|
||||
catch (ApiRequestException ex)
|
||||
{
|
||||
return null;
|
||||
await Task.Delay(ex.Parameters.RetryAfter);
|
||||
|
||||
m = await (this.Client.TelegramClient.SendTextMessageAsync(deviceId, text, parseMode, replyToMessageId: replyTo, replyMarkup: markup, disableNotification: disableNotification));
|
||||
|
||||
OnMessageSent(new MessageSentEventArgs(m));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user