Minor fixes.

This commit is contained in:
levlam 2022-04-07 20:38:22 +03:00
parent 00c64aba6e
commit 6c0438fc69
9 changed files with 24 additions and 13 deletions

View File

@ -3342,7 +3342,7 @@ internalLinkTypeActiveSessions = InternalLinkType;
//@description The link is a link to an attach menu bot to be opened in the specified chat. Process given chat_link to open corresponding chat.
//-Then call searchPublicChat with the given bot username, check that the user is a bot and can be added to attach menu. Then use getAttachMenuBot to receive information about the bot.
//-If the bot isn't added to attach menu, then user needs to confirm adding the bot to attach menu. If user confirms adding, then use toggleBotIsAddedToAttachMenu to add it.
//-If attach menu bots can't be used in the current chat, show an error to the user. If the bot is added to attach menu, then use openWebApp with the given url
//-If attach menu bots can't be used in the current chat, show an error to the user. If the bot is added to attach menu, then use openWebApp with the given URL
//@chat_link An internal link pointing to a chat; may be null if the current chat needs to be kept @bot_username Username of the bot @url URL to be passed to openWebApp
internalLinkTypeAttachMenuBot chat_link:InternalLinkType bot_username:string url:string = InternalLinkType;

View File

@ -14,17 +14,22 @@
#include "td/telegram/DocumentsManager.h"
#include "td/telegram/files/FileId.hpp"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/logevent/LogEvent.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/StateManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/TdDb.h"
#include "td/telegram/TdParameters.h"
#include "td/telegram/ThemeManager.h"
#include "td/utils/algorithm.h"
#include "td/utils/buffer.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Random.h"
#include "td/utils/Slice.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/tl_helpers.h"
namespace td {

View File

@ -18,7 +18,7 @@
#include "td/actor/Timeout.h"
#include "td/utils/common.h"
#include "td/utils/FlatHashSet.h"
#include "td/utils/FlatHashMap.h"
#include "td/utils/Status.h"
namespace td {

View File

@ -14,6 +14,9 @@
#include "td/telegram/Td.h"
#include "td/utils/buffer.h"
#include "td/utils/logging.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/Status.h"
namespace td {
@ -26,7 +29,7 @@ class SetBotMenuButtonQuery final : public Td::ResultHandler {
void send(UserId user_id, telegram_api::object_ptr<telegram_api::BotMenuButton> input_bot_menu_button) {
auto input_user = user_id.is_valid() ? td_->contacts_manager_->get_input_user(user_id).move_as_ok()
: tl_object_ptr<telegram_api::inputUserEmpty>();
: make_tl_object<telegram_api::inputUserEmpty>();
send_query(G()->net_query_creator().create(
telegram_api::bots_setBotMenuButton(std::move(input_user), std::move(input_bot_menu_button))));
}
@ -58,7 +61,7 @@ class GetBotMenuButtonQuery final : public Td::ResultHandler {
void send(UserId user_id) {
auto input_user = user_id.is_valid() ? td_->contacts_manager_->get_input_user(user_id).move_as_ok()
: tl_object_ptr<telegram_api::inputUserEmpty>();
: make_tl_object<telegram_api::inputUserEmpty>();
send_query(G()->net_query_creator().create(telegram_api::bots_getBotMenuButton(std::move(input_user))));
}

View File

@ -11568,8 +11568,13 @@ void ContactsManager::on_update_user_full_menu_button(UserFull *user_full, UserI
CHECK(user_full != nullptr);
CHECK(bot_menu_button != nullptr);
auto new_button = get_bot_menu_button(std::move(bot_menu_button));
if (user_full->menu_button == nullptr ? new_button != nullptr
: new_button == nullptr || *user_full->menu_button != *new_button) {
bool is_changed;
if (user_full->menu_button == nullptr) {
is_changed = (new_button != nullptr);
} else {
is_changed = (new_button == nullptr || *user_full->menu_button != *new_button);
}
if (is_changed) {
user_full->menu_button = std::move(new_button);
user_full->is_changed = true;
}

View File

@ -8,7 +8,6 @@
#include "td/telegram/ChannelType.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/MessageId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"

View File

@ -34,7 +34,7 @@ StringBuilder &operator<<(StringBuilder &string_builder, const DialogParticipant
}
}
DialogParticipantFilter::DialogParticipantFilter(const tl_object_ptr<td_api::ChatMembersFilter> &filter) {
DialogParticipantFilter::DialogParticipantFilter(const td_api::object_ptr<td_api::ChatMembersFilter> &filter) {
if (filter == nullptr) {
type_ = Type::Members;
return;

View File

@ -6,11 +6,8 @@
//
#pragma once
#include "td/telegram/DialogId.h"
#include "td/telegram/MessageId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"
#include "td/utils/common.h"
#include "td/utils/StringBuilder.h"
@ -28,7 +25,7 @@ class DialogParticipantFilter {
friend StringBuilder &operator<<(StringBuilder &string_builder, const DialogParticipantFilter &filter);
public:
explicit DialogParticipantFilter(const tl_object_ptr<td_api::ChatMembersFilter> &filter);
explicit DialogParticipantFilter(const td_api::object_ptr<td_api::ChatMembersFilter> &filter);
td_api::object_ptr<td_api::SupergroupMembersFilter> get_supergroup_members_filter_object(const string &query) const;

View File

@ -28,11 +28,13 @@ void store(KeyboardButton button, StorerT &storer) {
template <class ParserT>
void parse(KeyboardButton &button, ParserT &parser) {
bool has_url = false;
bool has_url;
if (parser.version() >= static_cast<int32>(Version::AddKeyboardButtonFlags)) {
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_url);
END_PARSE_FLAGS();
} else {
has_url = false;
}
parse(button.type, parser);
parse(button.text, parser);