2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 23:55:12 +00:00

Support custom attach bot icons.

This commit is contained in:
John Preston
2022-03-29 18:14:11 +04:00
parent 426be943a2
commit 72ae2f0269
10 changed files with 297 additions and 51 deletions

View File

@@ -383,16 +383,22 @@ void SessionNavigation::showPeerByLinkResolved(
msgId = ShowAtUnreadMsgId;
}
const auto attachBotUsername = info.attachBotUsername;
if (user && user->isBot()) {
if (user
&& user->isBot()
&& user->botInfo->startToken != info.startToken) {
user->botInfo->startToken = info.startToken;
user->session().changes().peerUpdated(
user,
Data::PeerUpdate::Flag::BotStartToken);
}
crl::on_main(this, [=] {
showPeerHistory(peer->id, params, msgId);
peer->session().attachWebView().request(peer, attachBotUsername);
});
if (user && info.attachBotToggle) {
user->session().attachWebView().requestAddToMenu(user);
} else {
crl::on_main(this, [=] {
showPeerHistory(peer->id, params, msgId);
peer->session().attachWebView().request(peer, attachBotUsername);
});
}
}
}