mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-02 15:45:12 +00:00
Added menu item to bot info for bot management.
This commit is contained in:
@@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reactions.h"
|
||||||
#include "data/data_peer_values.h"
|
#include "data/data_peer_values.h"
|
||||||
|
#include "data/data_user.h"
|
||||||
#include "history/admin_log/history_admin_log_section.h"
|
#include "history/admin_log/history_admin_log_section.h"
|
||||||
#include "info/profile/info_profile_values.h"
|
#include "info/profile/info_profile_values.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
@@ -2014,7 +2015,9 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EditPeerInfoBox::Available(not_null<PeerData*> peer) {
|
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
|
return false
|
||||||
|| chat->canEditInformation()
|
|| chat->canEditInformation()
|
||||||
|| chat->canEditPermissions();
|
|| chat->canEditPermissions();
|
||||||
|
@@ -667,6 +667,7 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
|
|||||||
result->botInfo->inlinePlaceholder = QString();
|
result->botInfo->inlinePlaceholder = QString();
|
||||||
}
|
}
|
||||||
result->botInfo->supportsAttachMenu = data.is_bot_attach_menu();
|
result->botInfo->supportsAttachMenu = data.is_bot_attach_menu();
|
||||||
|
result->botInfo->canEditInformation = data.is_bot_can_edit();
|
||||||
} else {
|
} else {
|
||||||
result->setBotInfoVersion(-1);
|
result->setBotInfoVersion(-1);
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@ struct BotInfo {
|
|||||||
bool readsAllHistory = false;
|
bool readsAllHistory = false;
|
||||||
bool cantJoinGroups = false;
|
bool cantJoinGroups = false;
|
||||||
bool supportsAttachMenu = false;
|
bool supportsAttachMenu = false;
|
||||||
|
bool canEditInformation = false;
|
||||||
int version = 0;
|
int version = 0;
|
||||||
int descriptionVersion = 0;
|
int descriptionVersion = 0;
|
||||||
QString description;
|
QString description;
|
||||||
|
@@ -982,7 +982,9 @@ void Filler::addManageChat() {
|
|||||||
}
|
}
|
||||||
const auto peer = _peer;
|
const auto peer = _peer;
|
||||||
const auto navigation = _controller;
|
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_group_title(tr::now)
|
||||||
: tr::lng_manage_channel_title(tr::now);
|
: tr::lng_manage_channel_title(tr::now);
|
||||||
_addAction(text, [=] {
|
_addAction(text, [=] {
|
||||||
|
Reference in New Issue
Block a user