W
W
wantpro2020-11-21 13:39:11
C++ / C#
wantpro, 2020-11-21 13:39:11

C# Telegram API How to send a post with multiple pictures and text?

Hello, I need to send a post with several pictures and text.
How do I:

public async void NewPost(Post post)
        {
            botClient = new TelegramBotClient(APIKEY");
            Message[] messages = await botClient.SendMediaGroupAsync(
                           chatId: "@dxfnxcvn",
                           inputMedia: post.Photo.Select(x => new InputMediaPhoto(x) { Caption = post.Msg})
                       );
        }


This is a List of images I post.Photo

add text: The Caption = post.Msg

post is published, but the text is visible only if you open a photo in telegram.
5fb8ed690f858967741811.png

In order for the text to be visible under the post, you need to specify Caption for only one image, and not for all, then the post will look like this:
5fb8edd2e1491571864977.png

How to specify Caption only for the first image from the list?
Thanks

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question