Skip to content

Commit 695dddf

Browse files
committed
SendHtml returns the number of sent messages in field msg.MigrateToChatId
1 parent 4547587 commit 695dddf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Telegram.Bot/Extensions/FormatExtensions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,12 @@ public static async Task<Message> SendHtml(this ITelegramBotClient botClient, Ch
424424
businessConnectionId: businessConnectionId).ConfigureAwait(false);
425425
}
426426
if (replyMarkup == null)
427-
return (await botClient.SendMediaGroup(chatId, media, replyParameters, messageThreadId, protectContent: protectContent,
428-
businessConnectionId: businessConnectionId).ConfigureAwait(false))[0];
427+
{
428+
var sentMsgs = await botClient.SendMediaGroup(chatId, media, replyParameters, messageThreadId, protectContent: protectContent,
429+
businessConnectionId: businessConnectionId).ConfigureAwait(false);
430+
sentMsgs[0].MigrateToChatId = sentMsgs.Length;
431+
return sentMsgs[0];
432+
}
429433
if (media.Count > 1)
430434
throw new FormatException("Cannot use keyboard with media group");
431435
return media[0] switch

0 commit comments

Comments
 (0)