mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added api support to upload bot photo.
This commit is contained in:
parent
2276a4c9af
commit
bbeefaed9c
1 changed files with 9 additions and 2 deletions
|
@ -367,14 +367,21 @@ void PeerPhoto::ready(
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (peer->isSelf()) {
|
const auto botUserInput = [&] {
|
||||||
|
const auto user = peer->asUser();
|
||||||
|
return (user && user->botInfo && user->botInfo->canEditInformation)
|
||||||
|
? std::make_optional<MTPInputUser>(user->inputUser)
|
||||||
|
: std::nullopt;
|
||||||
|
}();
|
||||||
|
if (peer->isSelf() || botUserInput) {
|
||||||
using Flag = MTPphotos_UploadProfilePhoto::Flag;
|
using Flag = MTPphotos_UploadProfilePhoto::Flag;
|
||||||
const auto none = MTPphotos_UploadProfilePhoto::Flags(0);
|
const auto none = MTPphotos_UploadProfilePhoto::Flags(0);
|
||||||
_api.request(MTPphotos_UploadProfilePhoto(
|
_api.request(MTPphotos_UploadProfilePhoto(
|
||||||
MTP_flags((file ? Flag::f_file : none)
|
MTP_flags((file ? Flag::f_file : none)
|
||||||
|
| (botUserInput ? Flag::f_bot : none)
|
||||||
| (videoSize ? Flag::f_video_emoji_markup : none)
|
| (videoSize ? Flag::f_video_emoji_markup : none)
|
||||||
| ((type == UploadType::Fallback) ? Flag::f_fallback : none)),
|
| ((type == UploadType::Fallback) ? Flag::f_fallback : none)),
|
||||||
MTPInputUser(), // bot
|
botUserInput ? (*botUserInput) : MTPInputUser(), // bot
|
||||||
file ? (*file) : MTPInputFile(),
|
file ? (*file) : MTPInputFile(),
|
||||||
MTPInputFile(), // video
|
MTPInputFile(), // video
|
||||||
MTPdouble(), // video_start_ts
|
MTPdouble(), // video_start_ts
|
||||||
|
|
Loading…
Add table
Reference in a new issue