V17 - Big Update

- Adding a message loop interface to build custom message loops
- extracting default message loop from BotBase into seperate class
- updates to BotBaseBuilder for integration of custom message loops
- updating all result classes for using the new Update object of V17
- improving MessageResult and UpdateResult classes
- BotBase has been prepared for cleanup (a lot of comments)
- Comment cleanup at the next build
- updating Readme
This commit is contained in:
FlorianDahn
2021-11-26 17:57:49 +01:00
parent e9c25ea9e4
commit 31e52887ba
16 changed files with 824 additions and 330 deletions
+7 -7
View File
@@ -769,7 +769,7 @@ namespace TelegramBotBase.Sessions
/// <typeparam name="T"></typeparam>
/// <param name="call"></param>
/// <returns></returns>
public T RAW<T>(Func<Telegram.Bot.TelegramBotClient, T> call)
public T RAW<T>(Func<Telegram.Bot.ITelegramBotClient, T> call)
{
return call(this.Client.TelegramClient);
}
@@ -780,7 +780,7 @@ namespace TelegramBotBase.Sessions
/// <typeparam name="T"></typeparam>
/// <param name="call"></param>
/// <returns></returns>
public async Task<T> API<T>(Func<Telegram.Bot.TelegramBotClient, Task<T>> call)
public async Task<T> API<T>(Func<Telegram.Bot.ITelegramBotClient, Task<T>> call)
{
var numberOfTries = 0;
while (numberOfTries < DeviceSession.MaxNumberOfRetries)
@@ -794,8 +794,8 @@ namespace TelegramBotBase.Sessions
if (ex.ErrorCode != 429)
throw;
if (ex.Parameters != null)
await Task.Delay(ex.Parameters.RetryAfter * 1000);
if (ex.Parameters != null && ex.Parameters.RetryAfter != null)
await Task.Delay(ex.Parameters.RetryAfter.Value * 1000);
numberOfTries++;
}
@@ -808,7 +808,7 @@ namespace TelegramBotBase.Sessions
/// </summary>
/// <param name="call"></param>
/// <returns></returns>
public async Task API(Func<Telegram.Bot.TelegramBotClient, Task> call)
public async Task API(Func<Telegram.Bot.ITelegramBotClient, Task> call)
{
var numberOfTries = 0;
while (numberOfTries < DeviceSession.MaxNumberOfRetries)
@@ -823,8 +823,8 @@ namespace TelegramBotBase.Sessions
if (ex.ErrorCode != 429)
throw;
if (ex.Parameters != null)
await Task.Delay(ex.Parameters.RetryAfter * 1000);
if (ex.Parameters != null && ex.Parameters.RetryAfter != null)
await Task.Delay(ex.Parameters.RetryAfter.Value * 1000);
numberOfTries++;
}