diff --git a/TelegramBotBase/Sessions/DeviceSession.cs b/TelegramBotBase/Sessions/DeviceSession.cs
index 58ba599..bd08ab3 100644
--- a/TelegramBotBase/Sessions/DeviceSession.cs
+++ b/TelegramBotBase/Sessions/DeviceSession.cs
@@ -704,6 +704,8 @@ namespace TelegramBotBase.Sessions
}
}
+ #region "Users"
+
public virtual async Task RestrictUser(int userId, ChatPermissions permissions, DateTime until = default(DateTime))
{
try
@@ -753,7 +755,42 @@ namespace TelegramBotBase.Sessions
}
}
+ #endregion
+ ///
+ /// Gives access to the original TelegramClient without any Exception catchings.
+ ///
+ ///
+ ///
+ ///
+ public T RAW(Func call)
+ {
+ return call(this.Client.TelegramClient);
+ }
+
+ ///
+ /// This will call a function on the TelegramClient and automatically Retry if an limit has been exceeded.
+ ///
+ ///
+ ///
+ ///
+ public async Task API(Func> call)
+ {
+ try
+ {
+ return await call(this.Client.TelegramClient);
+ }
+ catch(ApiRequestException ex)
+ {
+ await Task.Delay(ex.Parameters.RetryAfter);
+
+ return await call(this.Client.TelegramClient);
+ }
+ }
+
+
+
+ #region "Events"
///
/// Eventhandler for sent messages
@@ -796,5 +833,7 @@ namespace TelegramBotBase.Sessions
{
(this.__Events[__evMessageReceived] as EventHandler)?.Invoke(this, e);
}
+
+ #endregion
}
}