wiz0u / WTelegramClient

Telegram Client API (MTProto) library written 100% in C# and .NET
https://wiz0u.github.io/WTelegramClient/
MIT License
956 stars 156 forks source link

I can't send MultiMedia properly #272

Closed VlaDDDimir closed 1 month ago

VlaDDDimir commented 1 month ago

the problem is this, I'm trying to send videos and photos with one media group, but on the desktop and web versions it looks almost normal, and on the mobile version it sends two messages all the time, but if the video weighs less than 10 MB then everything is sent in one message `var inputMediaVideo = new InputMediaUploadedDocument { file = uploadedVideo, mime_type = "video/mp4", attributes = new[] { new DocumentAttributeVideo { duration = 0, w = 1280, h = 720
} } };

        var inputMediaPhoto = new InputMediaUploadedPhoto
        {
            file = uploadedPhoto
        };

        var mMediaPhoto = client.Messages_UploadFile(inputPeet,inputMediaPhoto);
        var mMediaVideo = client.Messages_UploadFile(inputPeet,inputMediaVideo);

        var inputMediaList = new InputSingleMedia[]
        {
            new InputSingleMedia
            {
                media = mMediaPhoto.ToInputMedia(),
                message = caption,
                random_id = Helpers.RandomLong()
            },
            new InputSingleMedia
            {
                media = mMediaVideo.ToInputMedia(),
                random_id = Helpers.RandomLong()
            }
        };

        var updates = await client.Messages_SendMultiMedia(inputPeer, inputMediaList);`

what am I doing wrong, I've already looked at the whole StackOverflow

wiz0u commented 1 month ago

use SendAlbumAsync helper method, it's simpler https://wiz0u.github.io/WTelegramClient/EXAMPLES#album

github-actions[bot] commented 1 month ago

Please note that Github issues should be used only for problems with the library code itself.

For questions about Telegram API usage, you can search the API official documentation and the full list of methods. WTelegramClient covers 100% of the API and let you do anything you can do in an official client.

If the above links didn't answer your problem, click here to ask your question on StackOverflow so the whole community can help and benefit.

VlaDDDimir commented 1 month ago

I used SendAlbumAsync too, but the same problem all the time is that I get two different messages, and yes, I saw that I shouldn't send a document and a photo together, and I would like to know if there is a way to make it work correctly, as if I am sending them in a telegram and I click the group button P.S. ty for your answer

wiz0u commented 1 month ago

Further discussion on your StackOverflow message. Github issues is not for discussion about usage of Telegram API. (Don't open an issue here if you plan to also post on StackOverflow)