Skip to content

Commit fbc0728

Browse files
authored
Merge pull request #1458 from TelegramBots/develop
minor improvements
2 parents e10a824 + 68b3c4a commit fbc0728

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

.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.0
4+
value: 22.4.1
55
- name: versionSuffix
66
value: ''
77
- name: ciVersionSuffix

src/Telegram.Bot/Extend.Types.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,17 @@ public InlineKeyboardButton(string text, string callbackDataOrUrl)
355355
CallbackData = callbackDataOrUrl;
356356
}
357357

358-
/// <summary>Performs an implicit conversion from <see cref="string"/> to <see cref="InlineKeyboardButton"/> with callback data</summary>
359-
/// <param name="textAndCallbackData">Label text and callback data of the button</param>
358+
/// <summary>Performs an implicit conversion from <see cref="string"/> to <see cref="InlineKeyboardButton"/></summary>
359+
/// <param name="textAndCallbackDataOrUrl">Text serving as the label of the button, as well as the URL to be opened or the callback data to be sent</param>
360360
/// <returns>The result of the conversion.</returns>
361-
public static implicit operator InlineKeyboardButton(string textAndCallbackData)
362-
=> new(textAndCallbackData) { CallbackData = textAndCallbackData };
361+
public static implicit operator InlineKeyboardButton(string textAndCallbackDataOrUrl)
362+
=> new(textAndCallbackDataOrUrl, textAndCallbackDataOrUrl);
363+
364+
/// <summary>Performs an implicit conversion from (<see cref="string"/>, <see cref="string"/>) tuple to <see cref="InlineKeyboardButton"/></summary>
365+
/// <param name="tuple">Tuple with label text, and the URL to be opened or the callback data</param>
366+
/// <returns>The result of the conversion.</returns>
367+
public static implicit operator InlineKeyboardButton((string text, string callbackDataOrUrl) tuple)
368+
=> new(tuple.text, tuple.callbackDataOrUrl);
363369

364370
/// <summary>Creates an inline keyboard button that sends <see cref="CallbackQuery"/> to bot when pressed</summary>
365371
/// <param name="textAndCallbackData">Text and data of the button to be sent in a <see cref="CallbackQuery">callback query</see> to the bot when button is pressed, 1-64 bytes</param>

src/Telegram.Bot/TelegramBotClientExtensions.ApiMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4415,7 +4415,7 @@ public static async Task SendGift(
44154415
) => await botClient.ThrowIfNull().SendRequest(new SendGiftRequest
44164416
{
44174417
ChatId = chatId?.Identifier > 0 ? null : chatId,
4418-
UserId = chatId?.Identifier > 0 ? chatId?.Identifier : null,
4418+
UserId = chatId?.Identifier > 0 ? chatId.Identifier : null,
44194419
GiftId = giftId,
44204420
Text = text,
44214421
TextParseMode = textParseMode,

src/Telegram.Bot/Types/ReplyMarkups/ReplyMarkup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public abstract class ReplyMarkup
3535
/// <param name="buttons">Keyboard buttons</param>
3636
public static implicit operator ReplyMarkup?(IEnumerable<KeyboardButton>[]? buttons) => buttons is null ? default : new ReplyKeyboardMarkup(buttons) { ResizeKeyboard = true };
3737

38-
38+
/// <summary>Generate an inline keyboard markup from a single button</summary>
3939
/// <param name="button">Inline keyboard button</param>
4040
[return: NotNullIfNotNull(nameof(button))]
4141
public static implicit operator ReplyMarkup?(InlineKeyboardButton? button) => button is null ? default : new InlineKeyboardMarkup(button);

0 commit comments

Comments
 (0)