2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Add bot menu button with webview open support.

This commit is contained in:
John Preston
2022-04-07 16:16:43 +04:00
parent d35b8f82a3
commit 94c6793e92
9 changed files with 143 additions and 10 deletions

View File

@@ -133,10 +133,23 @@ void UserData::setBotInfo(const MTPBotInfo &info) {
const auto changedCommands = Data::UpdateBotCommands(
botInfo->commands,
d.vcommands());
auto text = QString();
auto url = QString();
d.vmenu_button().match([&](const MTPDbotMenuButton &data) {
text = qs(data.vtext());
url = qs(data.vurl());
}, [&](const auto &) {
});
const auto changedButton = (botInfo->botMenuButtonText != text)
|| (botInfo->botMenuButtonUrl != url);
if (changedButton) {
botInfo->botMenuButtonText = text;
botInfo->botMenuButtonUrl = url;
}
botInfo->inited = true;
if (changedCommands) {
if (changedCommands || changedButton) {
owner().botCommandsChanged(this);
}
} break;