mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +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();
|
||||
}
|
||||
};
|
||||
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;
|
||||
const auto none = MTPphotos_UploadProfilePhoto::Flags(0);
|
||||
_api.request(MTPphotos_UploadProfilePhoto(
|
||||
MTP_flags((file ? Flag::f_file : none)
|
||||
| (botUserInput ? Flag::f_bot : none)
|
||||
| (videoSize ? Flag::f_video_emoji_markup : none)
|
||||
| ((type == UploadType::Fallback) ? Flag::f_fallback : none)),
|
||||
MTPInputUser(), // bot
|
||||
botUserInput ? (*botUserInput) : MTPInputUser(), // bot
|
||||
file ? (*file) : MTPInputFile(),
|
||||
MTPInputFile(), // video
|
||||
MTPdouble(), // video_start_ts
|
||||
|
|
Loading…
Add table
Reference in a new issue