2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Add to Group / Channel with suggested rights for bots.

This commit is contained in:
John Preston
2022-03-23 14:15:52 +04:00
parent b62c7c76c8
commit a35888a07b
8 changed files with 141 additions and 22 deletions

View File

@@ -239,6 +239,25 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
user->setCommonChatsCount(update.vcommon_chats_count().v);
user->checkFolder(update.vfolder_id().value_or_empty());
user->setThemeEmoji(qs(update.vtheme_emoticon().value_or_empty()));
if (const auto info = user->botInfo.get()) {
const auto group = update.vbot_group_admin_rights()
? ChatAdminRightsInfo(*update.vbot_group_admin_rights()).flags
: ChatAdminRights();
const auto channel = update.vbot_broadcast_admin_rights()
? ChatAdminRightsInfo(
*update.vbot_broadcast_admin_rights()).flags
: ChatAdminRights();
if (info->groupAdminRights != group
|| info->channelAdminRights != channel) {
info->groupAdminRights = group;
info->channelAdminRights = channel;
user->session().changes().peerUpdated(
user,
Data::PeerUpdate::Flag::Rights);
}
}
user->fullUpdated();
}