Added check of bot info with correct lang code to bot management box.

This commit is contained in:
23rd 2023-04-21 00:13:11 +03:00
parent 66e7f1d490
commit efa19d5782

View file

@ -1809,16 +1809,28 @@ void Controller::saveTitle() {
).fail(std::move(onFail) ).fail(std::move(onFail)
).send(); ).send();
} else if (_isBot) { } else if (_isBot) {
using Flag = MTPbots_SetBotInfo::Flag; _api.request(MTPbots_GetBotInfo(
_api.request(MTPbots_SetBotInfo( MTP_flags(MTPbots_GetBotInfo::Flag::f_bot),
MTP_flags(Flag::f_bot | Flag::f_name),
_peer->asUser()->inputUser, _peer->asUser()->inputUser,
MTPstring(), // Lang code. MTPstring() // Lang code.
MTP_string(*_savingData.title), // Name. )).done([=](const MTPbots_BotInfo &result) {
MTPstring(), // About. const auto was = qs(result.data().vname());
MTPstring() // Description. const auto now = *_savingData.title;
)).done([=] { if (was == now) {
continueSave(); return continueSave();
}
using Flag = MTPbots_SetBotInfo::Flag;
_api.request(MTPbots_SetBotInfo(
MTP_flags(Flag::f_bot | Flag::f_name),
_peer->asUser()->inputUser,
MTPstring(), // Lang code.
MTP_string(now), // Name.
MTPstring(), // About.
MTPstring() // Description.
)).done([=] {
continueSave();
}).fail(std::move(onFail)
).send();
}).fail(std::move(onFail) }).fail(std::move(onFail)
).send(); ).send();
} else { } else {
@ -1836,19 +1848,32 @@ void Controller::saveDescription() {
continueSave(); continueSave();
}; };
if (_isBot) { if (_isBot) {
using Flag = MTPbots_SetBotInfo::Flag; _api.request(MTPbots_GetBotInfo(
_api.request(MTPbots_SetBotInfo( MTP_flags(MTPbots_GetBotInfo::Flag::f_bot),
MTP_flags(Flag::f_bot | Flag::f_about),
_peer->asUser()->inputUser, _peer->asUser()->inputUser,
MTPstring(), // Lang code. MTPstring() // Lang code.
MTPstring(), // Name. )).done([=](const MTPbots_BotInfo &result) {
MTP_string(*_savingData.description), // About. const auto was = qs(result.data().vabout());
MTPstring() // Description. const auto now = *_savingData.description;
)).done([=] { if (was == now) {
successCallback(); return continueSave();
}
using Flag = MTPbots_SetBotInfo::Flag;
_api.request(MTPbots_SetBotInfo(
MTP_flags(Flag::f_bot | Flag::f_about),
_peer->asUser()->inputUser,
MTPstring(), // Lang code.
MTPstring(), // Name.
MTP_string(now), // About.
MTPstring() // Description.
)).done([=] {
successCallback();
}).fail([=] {
_controls.description->showError();
cancelSave();
}).send();
}).fail([=] { }).fail([=] {
_controls.description->showError(); continueSave();
cancelSave();
}).send(); }).send();
return; return;
} }