2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 23:15:59 +00:00

Track bot commands separately in different chats.

This commit is contained in:
John Preston
2021-07-01 14:05:15 +03:00
parent 93d99d6173
commit b930bc0e6d
14 changed files with 149 additions and 94 deletions

View File

@@ -246,6 +246,12 @@ PeerId ChatData::groupCallDefaultJoinAs() const {
return _callDefaultJoinAs;
}
void ChatData::setBotCommands(const MTPVector<MTPBotInfo> &data) {
if (Data::UpdateBotCommands(_botCommands, data)) {
owner().botCommandsChanged(this);
}
}
namespace Data {
void ApplyChatUpdate(
@@ -393,15 +399,9 @@ void ApplyChatUpdate(not_null<ChatData*> chat, const MTPDchatFull &update) {
chat->setMessagesTTL(update.vttl_period().value_or_empty());
if (const auto info = update.vbot_info()) {
for (const auto &item : info->v) {
item.match([&](const MTPDbotInfo &data) {
const auto userId = data.vuser_id().v;
if (const auto bot = chat->owner().userLoaded(userId)) {
bot->setBotInfo(item);
chat->session().api().fullPeerUpdated().notify(bot);
}
});
}
chat->setBotCommands(*info);
} else {
chat->setBotCommands(MTP_vector<MTPBotInfo>());
}
chat->setFullFlags(update.vflags().v);
if (const auto photo = update.vchat_photo()) {