From 90b2c077a65752c4013d9b78e75186a93a5d6084 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 29 May 2025 17:20:51 +0400 Subject: [PATCH] Don't flood with bot requests in monoforums. --- Telegram/SourceFiles/api/api_chat_participants.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/api/api_chat_participants.cpp b/Telegram/SourceFiles/api/api_chat_participants.cpp index 478390798f..af60bdfe3d 100644 --- a/Telegram/SourceFiles/api/api_chat_participants.cpp +++ b/Telegram/SourceFiles/api/api_chat_participants.cpp @@ -494,8 +494,15 @@ void ChatParticipants::requestBots(not_null channel) { LOG(("API Error: " "channels.channelParticipantsNotModified received!")); }); - }).fail([=] { + }).fail([=](const MTP::Error &error) { _botsRequests.remove(channel); + if (error.type() == u"CHANNEL_MONOFORUM_UNSUPPORTED"_q) { + channel->mgInfo->bots.clear(); + channel->mgInfo->botStatus = -1; + channel->session().changes().peerUpdated( + channel, + Data::PeerUpdate::Flag::FullInfo); + } }).send(); _botsRequests[channel] = requestId;