Skip to content

Commit 1fa9d80

Browse files
committed
Fix issues #52 and #53
1 parent 33cb4ef commit 1fa9d80

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace NetTelegramBotApi.Requests
2+
{
3+
using System;
4+
using System.Net.Http;
5+
6+
public class DeleteWebhook : RequestBase<bool>
7+
{
8+
public DeleteWebhook()
9+
: base("deleteWebhook")
10+
{
11+
// Nothing
12+
}
13+
14+
public override HttpContent CreateHttpContent()
15+
{
16+
return null;
17+
}
18+
}
19+
}

NetTelegramBotApi/Requests/SetWebhook.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
namespace NetTelegramBotApi.Requests
77
{
88
/// <summary>
9-
/// Use this method to specify a url and receive incoming updates via an outgoing webhook.
10-
/// Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url,
11-
/// containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after
9+
/// Use this method to specify a url and receive incoming updates via an outgoing webhook.
10+
/// Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url,
11+
/// containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after
1212
/// a reasonable amount of attempts.
1313
/// </summary>
1414
/// <remarks>
15-
/// If you'd like to make sure that the Webhook request comes from Telegram,
16-
/// we recommend using a secret path in the URL, e.g. www.example.com/<secret_path>.
15+
/// If you'd like to make sure that the Webhook request comes from Telegram,
16+
/// we recommend using a secret path in the URL, e.g. www.example.com/<secret_path>.
1717
/// Since nobody else knows this secret_path, you can be pretty sure it’s us.
1818
/// </remarks>
1919
public class SetWebhook : SendFileRequestBase<bool>
@@ -43,10 +43,22 @@ public SetWebhook(string url, FileToSend certificatePublicKey)
4343
/// </summary>
4444
public string Url { get; set; }
4545

46+
/// <summary>
47+
/// Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100.
48+
/// Defaults to 40.
49+
/// Use lower values to limit the load on your bot‘s server, and higher values to increase your bot’s throughput.
50+
/// </summary>
51+
public byte? MaxConnections { get; set; }
52+
4653
protected override void AppendParameters(Action<string, string> appendCallback)
4754
{
4855
appendCallback("url", Url);
4956

57+
if (MaxConnections.HasValue)
58+
{
59+
appendCallback("max_connections", MaxConnections.Value.ToString());
60+
}
61+
5062
base.AppendParameters(appendCallback);
5163
}
5264
}

0 commit comments

Comments
 (0)