Skip to content

Commit 1f1aa1f

Browse files
committed
Adding throwPendingUpdates to QuickStart in BBB
1 parent 39e68a2 commit 1f1aa1f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

TelegramBotBase/Builder/BotBaseBuilder.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ public IMessageLoopSelectionStage WithAPIKey(string apiKey)
7373
}
7474

7575

76-
public IBuildingStage QuickStart(string apiKey, Type startForm)
76+
public IBuildingStage QuickStart(string apiKey, Type startForm, bool throwPendingUpdates = false)
7777
{
7878
_apiKey = apiKey;
7979
_factory = new DefaultStartFormFactory(startForm);
8080

8181
DefaultMessageLoop();
8282

83-
NoProxy();
83+
NoProxy(throwPendingUpdates);
8484

8585
OnlyStart();
8686

@@ -94,15 +94,15 @@ public IBuildingStage QuickStart(string apiKey, Type startForm)
9494
}
9595

9696

97-
public IBuildingStage QuickStart<T>(string apiKey)
97+
public IBuildingStage QuickStart<T>(string apiKey, bool throwPendingUpdates = false)
9898
where T : FormBase
9999
{
100100
_apiKey = apiKey;
101101
_factory = new DefaultStartFormFactory(typeof(T));
102102

103103
DefaultMessageLoop();
104104

105-
NoProxy();
105+
NoProxy(throwPendingUpdates);
106106

107107
OnlyStart();
108108

@@ -115,14 +115,14 @@ public IBuildingStage QuickStart<T>(string apiKey)
115115
return this;
116116
}
117117

118-
public IBuildingStage QuickStart(string apiKey, IStartFormFactory startFormFactory)
118+
public IBuildingStage QuickStart(string apiKey, IStartFormFactory startFormFactory, bool throwPendingUpdates = false)
119119
{
120120
_apiKey = apiKey;
121121
_factory = startFormFactory;
122122

123123
DefaultMessageLoop();
124124

125-
NoProxy();
125+
NoProxy(throwPendingUpdates);
126126

127127
OnlyStart();
128128

TelegramBotBase/Builder/Interfaces/IAPIKeySelectionStage.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,26 @@ public interface IAPIKeySelectionStage
2020
/// </summary>
2121
/// <param name="apiKey"></param>
2222
/// <param name="StartForm"></param>
23+
/// <param name="throwPendingUpdates">Indicates if all pending Telegram.Bot.Types.Updates should be thrown out before start polling.</param>
2324
/// <returns></returns>
24-
IBuildingStage QuickStart(string apiKey, Type StartForm);
25+
IBuildingStage QuickStart(string apiKey, Type StartForm, bool throwPendingUpdates = false);
2526

2627
/// <summary>
2728
/// Quick and easy way to create a BotBase instance.
2829
/// Uses: DefaultMessageLoop, NoProxy, OnlyStart, NoSerialization, DefaultLanguage
2930
/// </summary>
3031
/// <param name="apiKey"></param>
32+
/// <param name="throwPendingUpdates">Indicates if all pending Telegram.Bot.Types.Updates should be thrown out before start polling.</param>
3133
/// <returns></returns>
32-
IBuildingStage QuickStart<T>(string apiKey) where T : FormBase;
34+
IBuildingStage QuickStart<T>(string apiKey , bool throwPendingUpdates = false) where T : FormBase;
3335

3436
/// <summary>
3537
/// Quick and easy way to create a BotBase instance.
3638
/// Uses: DefaultMessageLoop, NoProxy, OnlyStart, NoSerialization, DefaultLanguage
3739
/// </summary>
3840
/// <param name="apiKey"></param>
3941
/// <param name="StartFormFactory"></param>
42+
/// <param name="throwPendingUpdates">Indicates if all pending Telegram.Bot.Types.Updates should be thrown out before start polling.</param>
4043
/// <returns></returns>
41-
IBuildingStage QuickStart(string apiKey, IStartFormFactory StartFormFactory);
44+
IBuildingStage QuickStart(string apiKey, IStartFormFactory StartFormFactory, bool throwPendingUpdates = false);
4245
}

0 commit comments

Comments
 (0)