mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Added menu item to bot info for bot management.
This commit is contained in:
parent
a0ca3beef8
commit
2276a4c9af
4 changed files with 9 additions and 2 deletions
|
@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_changes.h"
|
||||
#include "data/data_message_reactions.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_user.h"
|
||||
#include "history/admin_log/history_admin_log_section.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
@ -2014,7 +2015,9 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
|
|||
}
|
||||
|
||||
bool EditPeerInfoBox::Available(not_null<PeerData*> peer) {
|
||||
if (const auto chat = peer->asChat()) {
|
||||
if (const auto bot = peer->asUser()) {
|
||||
return bot->botInfo && bot->botInfo->canEditInformation;
|
||||
} else if (const auto chat = peer->asChat()) {
|
||||
return false
|
||||
|| chat->canEditInformation()
|
||||
|| chat->canEditPermissions();
|
||||
|
|
|
@ -667,6 +667,7 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
|
|||
result->botInfo->inlinePlaceholder = QString();
|
||||
}
|
||||
result->botInfo->supportsAttachMenu = data.is_bot_attach_menu();
|
||||
result->botInfo->canEditInformation = data.is_bot_can_edit();
|
||||
} else {
|
||||
result->setBotInfoVersion(-1);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ struct BotInfo {
|
|||
bool readsAllHistory = false;
|
||||
bool cantJoinGroups = false;
|
||||
bool supportsAttachMenu = false;
|
||||
bool canEditInformation = false;
|
||||
int version = 0;
|
||||
int descriptionVersion = 0;
|
||||
QString description;
|
||||
|
|
|
@ -982,7 +982,9 @@ void Filler::addManageChat() {
|
|||
}
|
||||
const auto peer = _peer;
|
||||
const auto navigation = _controller;
|
||||
const auto text = (peer->isChat() || peer->isMegagroup())
|
||||
const auto text = peer->isUser()
|
||||
? tr::lng_manage_bot_title(tr::now)
|
||||
: (peer->isChat() || peer->isMegagroup())
|
||||
? tr::lng_manage_group_title(tr::now)
|
||||
: tr::lng_manage_channel_title(tr::now);
|
||||
_addAction(text, [=] {
|
||||
|
|
Loading…
Add table
Reference in a new issue