[FEATURE] Add MiddlewareMessageLoop to BotBaseBuilder

This commit is contained in:
AmirAbbas 2023-11-01 13:59:26 +03:30
parent 52bedd29e3
commit 365845f832
2 changed files with 15 additions and 1 deletions

View File

@ -137,6 +137,12 @@ public class BotBaseBuilder : IAPIKeySelectionStage, IMessageLoopSelectionStage,
return this; return this;
} }
public IStartFormSelectionStage MiddlewareMessageLoop(Func<MiddlewareBaseMessageLoop, MiddlewareBaseMessageLoop> messageLoopConfiguration)
{
_messageLoopFactory = messageLoopConfiguration(new MiddlewareBaseMessageLoop());
return this;
}
public IStartFormSelectionStage MinimalMessageLoop() public IStartFormSelectionStage MinimalMessageLoop()
{ {

View File

@ -1,4 +1,6 @@
using TelegramBotBase.Interfaces; using System;
using TelegramBotBase.Interfaces;
using TelegramBotBase.MessageLoops;
namespace TelegramBotBase.Builder.Interfaces; namespace TelegramBotBase.Builder.Interfaces;
@ -12,6 +14,12 @@ public interface IMessageLoopSelectionStage
IStartFormSelectionStage DefaultMessageLoop(); IStartFormSelectionStage DefaultMessageLoop();
/// <summary>
/// Choses a fully customizable middleware-based message loop.
/// </summary>
IStartFormSelectionStage MiddlewareMessageLoop(Func<MiddlewareBaseMessageLoop, MiddlewareBaseMessageLoop> messageLoopConfiguration);
/// <summary> /// <summary>
/// Chooses a minimalistic message loop, which catches all update types and only calls the Load function. /// Chooses a minimalistic message loop, which catches all update types and only calls the Load function.
/// </summary> /// </summary>