Skip to content

Commit 06e0c26

Browse files
authored
Merge pull request #1460 from TelegramBots/develop
constructors for BotCommand
2 parents 76c173d + 0d2d6b6 commit 06e0c26

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

.azure-pipelines/variables.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
variables:
22
- group: Integration Tests Variables
33
- name: versionPrefix
4-
value: 22.4.2
4+
value: 22.4.3
55
- name: versionSuffix
66
value: ''
77
- name: ciVersionSuffix

src/Telegram.Bot/Extend.Types.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ public partial class InputPollOption
128128
public static implicit operator InputPollOption(string text) => new() { Text = text };
129129
}
130130

131+
public partial class BotCommand
132+
{
133+
/// <summary>Instantiates a new BotCommand</summary>
134+
/// <param name="command">Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores</param>
135+
/// <param name="description">Description of the command, 1-256 characters</param>
136+
public BotCommand(string command, string description) { Command = command; Description = description; }
137+
/// <summary>Instantiates a new BotCommand like this: <code>new BotCommand { Command = "/start", Description = "Start the bot" }</code></summary>
138+
public BotCommand() { }
139+
/// <summary>Instantiates a new BotCommand from a tuple</summary>
140+
public static implicit operator BotCommand((string text, string description) tuple) => new(tuple.text, tuple.description);
141+
}
142+
131143
public partial class BotCommandScope
132144
{
133145
/// <summary>Create a default <see cref="BotCommandScope"/> instance</summary>
@@ -154,7 +166,7 @@ namespace Payments
154166
{
155167
public partial class LabeledPrice
156168
{
157-
/// <summary>Instantiates a new <see cref="LabeledPrice"/></summary>
169+
/// <summary>Instantiates a new <see cref="LabeledPrice"/> from a tuple</summary>
158170
public static implicit operator LabeledPrice((string label, int amount) t) => new(t.label, t.amount);
159171
}
160172
}

0 commit comments

Comments
 (0)