Add InputBusinessChatLink.
This commit is contained in:
parent
c4b42c2678
commit
c9224b24ab
@ -397,6 +397,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/GroupCallVideoPayload.cpp
|
||||
td/telegram/HashtagHints.cpp
|
||||
td/telegram/InlineQueriesManager.cpp
|
||||
td/telegram/InputBusinessChatLink.cpp
|
||||
td/telegram/InputDialogId.cpp
|
||||
td/telegram/InputGroupCallId.cpp
|
||||
td/telegram/InputInvoice.cpp
|
||||
@ -717,6 +718,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/GroupCallVideoPayload.h
|
||||
td/telegram/HashtagHints.h
|
||||
td/telegram/InlineQueriesManager.h
|
||||
td/telegram/InputBusinessChatLink.h
|
||||
td/telegram/InputDialogId.h
|
||||
td/telegram/InputGroupCallId.h
|
||||
td/telegram/InputInvoice.h
|
||||
|
@ -362,6 +362,7 @@ function split_file($file, $chunks, $undo) {
|
||||
'group_call_manager[_(-](?![.]get[(][)])|GroupCallManager' => 'GroupCallManager',
|
||||
'hashtag_hints[_(-](?![.]get[(][)])|HashtagHints' => 'HashtagHints',
|
||||
'inline_queries_manager[_(-](?![.]get[(][)])|InlineQueriesManager' => 'InlineQueriesManager',
|
||||
'InputBusinessChatLink' => 'InputBusinessChatLink',
|
||||
'language_pack_manager[_(-]|LanguagePackManager' => 'LanguagePackManager',
|
||||
'link_manager[_(-](?![.]get[(][)])|LinkManager' => 'LinkManager',
|
||||
'LogeventIdWithGeneration|add_log_event|delete_log_event|get_erase_log_event_promise|parse_time|store_time' => 'logevent/LogEventHelper',
|
||||
|
@ -669,6 +669,11 @@ businessChatLink link:string text:formattedText title:string view_count:int32 =
|
||||
//@description Contains a list of business chat links created by the user @links List of links
|
||||
businessChatLinks links:vector<businessChatLink> = BusinessChatLinks;
|
||||
|
||||
//@description Describes a business chat link to create or edit
|
||||
//@text Message draft text that will be added to the input field
|
||||
//@title Link title
|
||||
inputBusinessChatLink text:formattedText title:string = InputBusinessChatLink;
|
||||
|
||||
|
||||
//@class ChatPhotoStickerType @description Describes type of sticker, which was used to create a chat photo
|
||||
|
||||
|
45
td/telegram/InputBusinessChatLink.cpp
Normal file
45
td/telegram/InputBusinessChatLink.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#include "td/telegram/InputBusinessChatLink.h"
|
||||
|
||||
#include "td/telegram/DialogManager.h"
|
||||
#include "td/telegram/misc.h"
|
||||
#include "td/telegram/Td.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
InputBusinessChatLink::InputBusinessChatLink(const Td *td, td_api::object_ptr<td_api::inputBusinessChatLink> &&link) {
|
||||
auto r_text =
|
||||
get_formatted_text(td, td->dialog_manager_->get_my_dialog_id(), std::move(link->text_), false, true, true, false);
|
||||
if (r_text.is_error()) {
|
||||
LOG(INFO) << "Ignore draft text: " << r_text.error();
|
||||
} else {
|
||||
text_ = r_text.move_as_ok();
|
||||
}
|
||||
if (!clean_input_string(link->title_)) {
|
||||
title_ = std::move(link->title_);
|
||||
}
|
||||
}
|
||||
|
||||
telegram_api::object_ptr<telegram_api::inputBusinessChatLink> InputBusinessChatLink::get_input_business_chat_link(
|
||||
const UserManager *user_manager) const {
|
||||
int32 flags = 0;
|
||||
auto entities = get_input_message_entities(user_manager, &text_, "get_input_business_chat_link");
|
||||
if (!entities.empty()) {
|
||||
flags |= telegram_api::inputBusinessChatLink::ENTITIES_MASK;
|
||||
}
|
||||
if (!title_.empty()) {
|
||||
flags |= telegram_api::inputBusinessChatLink::TITLE_MASK;
|
||||
}
|
||||
return telegram_api::make_object<telegram_api::inputBusinessChatLink>(flags, text_.text, std::move(entities), title_);
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const InputBusinessChatLink &link) {
|
||||
return string_builder << '[' << link.title_ << ']';
|
||||
}
|
||||
|
||||
} // namespace td
|
36
td/telegram/InputBusinessChatLink.h
Normal file
36
td/telegram/InputBusinessChatLink.h
Normal file
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
class Td;
|
||||
class UserManager;
|
||||
|
||||
class InputBusinessChatLink {
|
||||
FormattedText text_;
|
||||
string title_;
|
||||
|
||||
friend StringBuilder &operator<<(StringBuilder &string_builder, const InputBusinessChatLink &link);
|
||||
|
||||
public:
|
||||
InputBusinessChatLink(const Td *td, td_api::object_ptr<td_api::inputBusinessChatLink> &&link);
|
||||
|
||||
telegram_api::object_ptr<telegram_api::inputBusinessChatLink> get_input_business_chat_link(
|
||||
const UserManager *user_manager) const;
|
||||
};
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const InputBusinessChatLink &link);
|
||||
|
||||
} // namespace td
|
Loading…
Reference in New Issue
Block a user