diff --git a/TelegramBotBase/Builder/BotBaseBuilder.cs b/TelegramBotBase/Builder/BotBaseBuilder.cs index ddbf4a8..e05242d 100644 --- a/TelegramBotBase/Builder/BotBaseBuilder.cs +++ b/TelegramBotBase/Builder/BotBaseBuilder.cs @@ -137,6 +137,12 @@ public class BotBaseBuilder : IAPIKeySelectionStage, IMessageLoopSelectionStage, return this; } + public IStartFormSelectionStage MiddlewareMessageLoop(Func messageLoopConfiguration) + { + _messageLoopFactory = messageLoopConfiguration(new MiddlewareBaseMessageLoop()); + + return this; + } public IStartFormSelectionStage MinimalMessageLoop() { diff --git a/TelegramBotBase/Builder/Interfaces/IMessageLoopSelectionStage.cs b/TelegramBotBase/Builder/Interfaces/IMessageLoopSelectionStage.cs index 21223e7..422aadc 100644 --- a/TelegramBotBase/Builder/Interfaces/IMessageLoopSelectionStage.cs +++ b/TelegramBotBase/Builder/Interfaces/IMessageLoopSelectionStage.cs @@ -1,4 +1,6 @@ -using TelegramBotBase.Interfaces; +using System; +using TelegramBotBase.Interfaces; +using TelegramBotBase.MessageLoops; namespace TelegramBotBase.Builder.Interfaces; @@ -12,6 +14,12 @@ public interface IMessageLoopSelectionStage IStartFormSelectionStage DefaultMessageLoop(); + /// + /// Choses a fully customizable middleware-based message loop. + /// + IStartFormSelectionStage MiddlewareMessageLoop(Func messageLoopConfiguration); + + /// /// Chooses a minimalistic message loop, which catches all update types and only calls the Load function. ///