Merge pull request #89 from davidgfnet/master

Update to version 7.10
This commit is contained in:
giuseppeM99 2024-10-01 00:59:37 +02:00 committed by GitHub
commit 8ba69b0857
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 2465 additions and 563 deletions

View File

@ -6,7 +6,7 @@ if (POLICY CMP0065)
cmake_policy(SET CMP0065 NEW)
endif()
project(TelegramBotApi VERSION 7.0 LANGUAGES CXX)
project(TelegramBotApi VERSION 7.10 LANGUAGES CXX)
if (POLICY CMP0069)
option(TELEGRAM_BOT_API_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.")

View File

@ -201,13 +201,16 @@
<option>Alpine</option>
<option>CentOS 7</option>
<option>CentOS 8</option>
<option>CentOS Stream 9</option>
<option>Debian 8/9</option>
<option>Debian 10+</option>
<option>Fedora 21+</option>
<option>Ubuntu 14</option>
<option>Ubuntu 16</option>
<option>Ubuntu 18</option>
<option>Ubuntu 20</option>
<option>Ubuntu 22</option>
<option>Ubuntu 24</option>
<option>Other</option>
</select>
<p></p>
@ -260,7 +263,7 @@
</div>
<div id="buildRootDiv" class="hide">
<label><input type="checkbox" id="buildRootCheckbox" onchange="onOptionsChanged()"/>Build from root user (unrecommended).</label>
<label><input type="checkbox" id="buildRootCheckbox" onchange="onOptionsChanged()"/>Build from root user (not recommended).</label>
</div>
<p></p>
@ -353,7 +356,7 @@ function onOptionsChanged() {
document.getElementById('buildCommandsDiv').style.display = 'block';
var use_clang = os_freebsd || os_openbsd;
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS')) {
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS') && !linux_distro.includes('Fedora')) {
document.getElementById('buildCompilerDiv').style.display = 'block';
use_clang = document.getElementById('buildCompilerRadioClang').checked;
} else {
@ -446,7 +449,7 @@ function onOptionsChanged() {
pre_text.push('Install Git, ' + compiler + ', make, CMake >= 3.0.2, OpenSSL-dev, zlib-dev, gperf using your package manager.');
}
if (os_freebsd) {
pre_text.push('Note that the following instruction is for FreeBSD 11.');
pre_text.push('Note that the following instruction is for FreeBSD 13.');
pre_text.push('Note that the following calls to <code>pkg</code> needs to be run as <code>root</code>.');
}
if (os_openbsd) {
@ -496,6 +499,19 @@ function onOptionsChanged() {
return '-10';
case 'Ubuntu 22':
return '-14';
case 'Ubuntu 24':
return '-18';
default:
return ''; // use default version
}
}
function getLibcplusplusVersionSuffix() {
switch (linux_distro) {
case 'Ubuntu 20':
case 'Ubuntu 22':
case 'Ubuntu 24':
return getClangVersionSuffix();
default:
return ''; // use default version
}
@ -514,23 +530,32 @@ function onOptionsChanged() {
commands.push(sudo + 'apk update');
commands.push(sudo + 'apk upgrade');
var packages = 'alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake';
commands.push(sudo + 'apk add --update ' + packages);
commands.push(sudo + 'apk add ' + packages);
break;
case 'CentOS 7':
case 'CentOS 8':
commands.push(sudo + 'yum update -y');
var packages = 'gcc-c++ make git zlib-devel openssl-devel';
if (linux_distro === 'CentOS 7') {
commands.push(sudo + 'yum install -y centos-release-scl-rh epel-release');
commands.push(sudo + 'yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++');
cmake = 'cmake3';
packages += ' gperf';
} else {
commands.push(sudo + 'dnf --enablerepo=powertools install gperf');
}
packages += ' ' + cmake;
commands.push(sudo + 'yum install -y centos-release-scl-rh epel-release');
commands.push(sudo + 'yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++');
cmake = 'cmake3';
var packages = 'gcc-c++ make git zlib-devel openssl-devel gperf ' + cmake;
commands.push(sudo + 'yum install -y ' + packages);
break;
case 'CentOS 8':
case 'CentOS Stream 9':
commands.push(sudo + 'dnf update -y');
if (linux_distro === 'CentOS 8') {
commands.push(sudo + 'dnf --enablerepo=powertools install gperf');
} else {
commands.push(sudo + 'dnf --enablerepo=crb install gperf');
}
var packages = 'gcc-c++ make git zlib-devel openssl-devel cmake';
commands.push(sudo + 'dnf install -y ' + packages);
break;
case 'Fedora 21+':
commands.push(sudo + 'dnf update -y');
var packages = 'gperf gcc-c++ make git zlib-devel openssl-devel cmake';
commands.push(sudo + 'dnf install -y ' + packages);
break;
case 'Debian 8/9':
case 'Debian 10+':
case 'Ubuntu 14':
@ -538,6 +563,7 @@ function onOptionsChanged() {
case 'Ubuntu 18':
case 'Ubuntu 20':
case 'Ubuntu 22':
case 'Ubuntu 24':
if (linux_distro.includes('Debian') && !use_root) {
commands.push('su -');
}
@ -553,9 +579,9 @@ function onOptionsChanged() {
packages += ' cmake';
}
if (use_clang) {
packages += ' clang' + getClangVersionSuffix() + ' libc++-dev';
if (linux_distro === 'Debian 10+' || linux_distro === 'Ubuntu 18' || linux_distro === 'Ubuntu 20' || linux_distro === 'Ubuntu 22') {
packages += ' libc++abi-dev';
packages += ' clang' + getClangVersionSuffix() + ' libc++' + getLibcplusplusVersionSuffix() + '-dev';
if (linux_distro === 'Debian 10+' || linux_distro === 'Ubuntu 18' || linux_distro === 'Ubuntu 20' || linux_distro === 'Ubuntu 22' || linux_distro === 'Ubuntu 24') {
packages += ' libc++abi' + getLibcplusplusVersionSuffix() + '-dev';
}
} else {
packages += ' g++';
@ -587,7 +613,7 @@ function onOptionsChanged() {
commands.push('su -');
}
commands.push('export PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r)/All');
var packages = 'git gperf cmake openssl gcc12-libs mozilla-rootcerts-openssl';
var packages = 'git gperf pcre2 cmake openssl gcc12-libs mozilla-rootcerts-openssl';
commands.push('pkg_add ' + packages);
if (!use_root) {
commands.push('exit');

2
td

@ -1 +1 @@
Subproject commit 27c3eaeb4964bd5f18d8488e354abde1a4383e49
Subproject commit 87d881071fe514936bb17029e96761141287d2be

View File

@ -264,6 +264,10 @@ paths:
last_name:
description: The last name of the user; 0-64 characters.
type: string
disable_notification:
description: Disables "user joined Telegram" notification for other users that have the contact in their contact list.
default: false
type: boolean
required:
- first_name
multipart/form-data:
@ -276,6 +280,10 @@ paths:
last_name:
description: The last name of the user; 0-64 characters.
type: string
disable_notification:
description: Disables "user joined Telegram" notification for other users that have the contact in their contact list.
default: false
type: boolean
required:
- first_name
application/json:
@ -288,6 +296,10 @@ paths:
last_name:
description: The last name of the user; 0-64 characters.
type: string
disable_notification:
description: Disables "user joined Telegram" notification for other users that have the contact in their contact list.
default: false
type: boolean
required:
- first_name
required: true
@ -1471,6 +1483,10 @@ paths:
query:
description: Query to search for.
type: string
only_in_channels:
description: Search for messages only in channels
default: false
type: boolean
offset_date:
description: The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message.
type: integer
@ -1505,6 +1521,10 @@ paths:
query:
description: Query to search for.
type: string
only_in_channels:
description: Search for messages only in channels
default: false
type: boolean
offset_date:
description: The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message.
type: integer
@ -1539,6 +1559,10 @@ paths:
query:
description: Query to search for.
type: string
only_in_channels:
description: Search for messages only in channels
default: false
type: boolean
offset_date:
description: The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message.
type: integer

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)
@ -106,6 +106,11 @@ class Client final : public WebhookActor::Callback {
class JsonUsers;
class JsonReactionType;
class JsonReactionCount;
class JsonBirthdate;
class JsonBusinessStartPage;
class JsonBusinessLocation;
class JsonBusinessOpeningHoursInterval;
class JsonBusinessOpeningHours;
class JsonChatPermissions;
class JsonChatPhotoInfo;
class JsonChatLocation;
@ -129,6 +134,8 @@ class Client final : public WebhookActor::Callback {
class JsonVideo;
class JsonVideoNote;
class JsonVoiceNote;
class JsonPaidMedia;
class JsonPaidMediaInfo;
class JsonContact;
class JsonDice;
class JsonGame;
@ -154,6 +161,7 @@ class Client final : public WebhookActor::Callback {
class JsonInlineCallbackQuery;
class JsonShippingQuery;
class JsonPreCheckoutQuery;
class JsonPaidMediaPurchased;
class JsonBotCommand;
class JsonBotMenuButton;
class JsonBotName;
@ -176,9 +184,16 @@ class Client final : public WebhookActor::Callback {
class JsonGameHighScore;
class JsonMessageReactionUpdated;
class JsonMessageReactionCountUpdated;
class JsonBusinessConnection;
class JsonBusinessMessagesDeleted;
class JsonAddress;
class JsonOrderInfo;
class JsonStory;
class JsonBackgroundFill;
class JsonBackgroundType;
class JsonChatBackground;
class JsonSuccessfulPaymentBot;
class JsonRefundedPayment;
class JsonEncryptedPassportElement;
class JsonEncryptedCredentials;
class JsonPassportData;
@ -190,11 +205,18 @@ class Client final : public WebhookActor::Callback {
class JsonChatSetMessageAutoDeleteTime;
class JsonWriteAccessAllowed;
class JsonUserShared;
class JsonSharedUser;
class JsonUsersShared;
class JsonChatShared;
class JsonGiveawayCreated;
class JsonGiveaway;
class JsonGiveawayWinners;
class JsonGiveawayCompleted;
class JsonChatBoostAdded;
class JsonRevenueWithdrawalState;
class JsonStarTransactionPartner;
class JsonStarTransaction;
class JsonStarTransactions;
class JsonUpdateTypes;
class JsonWebhookInfo;
class JsonStickerSet;
@ -218,12 +240,15 @@ class Client final : public WebhookActor::Callback {
class TdOnInitCallback;
class TdOnGetUserProfilePhotosCallback;
class TdOnSendMessageCallback;
class TdOnReturnBusinessMessageCallback;
class TdOnSendMessageAlbumCallback;
class TdOnSendBusinessMessageAlbumCallback;
class TdOnForwardMessagesCallback;
class TdOnDeleteFailedToSendMessageCallback;
class TdOnEditMessageCallback;
class TdOnEditInlineMessageCallback;
class TdOnStopPollCallback;
class TdOnStopBusinessPollCallback;
class TdOnOkQueryCallback;
class TdOnGetReplyMessageCallback;
class TdOnGetEditedMessageCallback;
@ -238,6 +263,8 @@ class Client final : public WebhookActor::Callback {
class TdOnGetMyShortDescriptionCallback;
class TdOnGetChatFullInfoCallback;
class TdOnGetChatStickerSetCallback;
class TdOnGetChatCustomEmojiStickerSetCallback;
class TdOnGetChatBusinessStartPageStickerSetCallback;
class TdOnGetChatPinnedMessageCallback;
class TdOnGetChatPinnedMessageToUnpinCallback;
class TdOnGetGroupMembersCallback;
@ -245,6 +272,7 @@ class Client final : public WebhookActor::Callback {
class TdOnGetSupergroupMemberCountCallback;
class TdOnGetUserChatBoostsCallback;
class TdOnCreateInvoiceLinkCallback;
class TdOnGetStarTransactionsQueryCallback;
class TdOnReplacePrimaryChatInviteLinkCallback;
class TdOnGetChatInviteLinkCallback;
class TdOnGetGameHighScoresCallback;
@ -278,10 +306,13 @@ class Client final : public WebhookActor::Callback {
void on_get_callback_query_message(object_ptr<td_api::message> message, int64 user_id, int state);
void on_get_sticker_set(int64 set_id, int64 new_callback_query_user_id, int64 new_message_chat_id,
object_ptr<td_api::stickerSet> sticker_set);
const td::string &new_message_business_connection_id,
int64 new_business_callback_query_user_id, object_ptr<td_api::text> sticker_set_name);
void on_get_sticker_set_name(int64 set_id, const td::string &name);
void on_get_sticker_set_name(int64 set_id, object_ptr<td_api::Object> sticker_set_name);
class TdQueryCallback {
public:
virtual void on_result(object_ptr<td_api::Object> result) = 0;
@ -334,6 +365,8 @@ class Client final : public WebhookActor::Callback {
template <class OnSuccess>
class TdOnCheckMessageThreadCallback;
template <class OnSuccess>
class TdOnCheckBusinessConnectionCallback;
template <class OnSuccess>
class TdOnCheckRemoteFileIdCallback;
template <class OnSuccess>
class TdOnGetChatMemberCallback;
@ -362,6 +395,16 @@ class Client final : public WebhookActor::Callback {
template <class OnSuccess>
void check_chat_no_fail(td::Slice chat_id_str, PromisedQueryPtr query, OnSuccess on_success);
static td::Result<int64> get_business_connection_chat_id(td::Slice chat_id_str);
template <class OnSuccess>
void check_business_connection(const td::string &business_connection_id, PromisedQueryPtr query,
OnSuccess on_success);
template <class OnSuccess>
void check_business_connection_chat_id(const td::string &business_connection_id, const td::string &chat_id_str,
PromisedQueryPtr query, OnSuccess on_success);
template <class OnSuccess>
void check_bot_command_scope(BotCommandScope &&scope, PromisedQueryPtr query, OnSuccess on_success);
@ -416,6 +459,8 @@ class Client final : public WebhookActor::Callback {
static object_ptr<td_api::InputMessageReplyTo> get_input_message_reply_to(CheckedReplyParameters &&reply_parameters);
static object_ptr<td_api::InputMessageReplyTo> get_input_message_reply_to(InputReplyParameters &&reply_parameters);
static td::Result<InputReplyParameters> get_reply_parameters(const Query *query);
static td::Result<InputReplyParameters> get_reply_parameters(td::JsonValue &&value);
@ -514,14 +559,17 @@ class Client final : public WebhookActor::Callback {
static td::Result<object_ptr<td_api::StickerFormat>> get_sticker_format(td::Slice sticker_format);
td::Result<object_ptr<td_api::inputSticker>> get_legacy_input_sticker(const Query *query) const;
td::Result<object_ptr<td_api::inputSticker>> get_input_sticker(const Query *query) const;
td::Result<object_ptr<td_api::inputSticker>> get_input_sticker(const Query *query, td::JsonValue &&value) const;
td::Result<object_ptr<td_api::inputSticker>> get_input_sticker(const Query *query, td::JsonValue &&value,
td::Slice default_sticker_format) const;
td::Result<td::vector<object_ptr<td_api::inputSticker>>> get_input_stickers(
const Query *query, object_ptr<td_api::StickerFormat> &sticker_format) const;
td::Result<td::vector<object_ptr<td_api::inputSticker>>> get_input_stickers(const Query *query) const;
static td::Result<object_ptr<td_api::InputFile>> get_sticker_input_file(const Query *query);
static td::Result<object_ptr<td_api::InputFile>> get_sticker_input_file(const Query *query,
td::Slice field_name = "sticker");
static td::Result<td::string> get_passport_element_hash(td::Slice encoded_hash);
@ -572,13 +620,24 @@ class Client final : public WebhookActor::Callback {
td::Result<td::vector<object_ptr<td_api::InputMessageContent>>> get_input_message_contents(
const Query *query, td::JsonValue &&value) const;
td::Result<object_ptr<td_api::inputPaidMedia>> get_input_paid_media(const Query *query,
td::JsonValue &&input_media) const;
td::Result<object_ptr<td_api::inputPaidMedia>> get_input_paid_media(const Query *query, td::Slice field_name) const;
td::Result<td::vector<object_ptr<td_api::inputPaidMedia>>> get_paid_media(const Query *query,
td::Slice field_name) const;
td::Result<td::vector<object_ptr<td_api::inputPaidMedia>>> get_paid_media(const Query *query,
td::JsonValue &&value) const;
td::Result<object_ptr<td_api::inputMessageInvoice>> get_input_message_invoice(const Query *query) const;
static object_ptr<td_api::messageSendOptions> get_message_send_options(bool disable_notification,
bool protect_content,
bool protect_content, int64 effect_id,
object_ptr<td_api::MessageSchedulingState> &&scheduling_state);
static td::Result<td::vector<td::string>> get_poll_options(const Query *query);
static td::Result<td::vector<object_ptr<td_api::formattedText>>> get_poll_options(const Query *query);
static td::Result<object_ptr<td_api::ReactionType>> get_reaction_type(td::JsonValue &&value);
@ -658,6 +717,7 @@ class Client final : public WebhookActor::Callback {
td::Status process_send_video_query(PromisedQueryPtr &query);
td::Status process_send_video_note_query(PromisedQueryPtr &query);
td::Status process_send_voice_query(PromisedQueryPtr &query);
td::Status process_send_paid_media_query(PromisedQueryPtr &query);
td::Status process_send_game_query(PromisedQueryPtr &query);
td::Status process_send_invoice_query(PromisedQueryPtr &query);
td::Status process_send_location_query(PromisedQueryPtr &query);
@ -680,6 +740,8 @@ class Client final : public WebhookActor::Callback {
td::Status process_delete_message_query(PromisedQueryPtr &query);
td::Status process_delete_messages_query(PromisedQueryPtr &query);
td::Status process_create_invoice_link_query(PromisedQueryPtr &query);
td::Status process_get_star_transactions_query(PromisedQueryPtr &query);
td::Status process_refund_star_payment_query(PromisedQueryPtr &query);
td::Status process_set_game_score_query(PromisedQueryPtr &query);
td::Status process_get_game_high_scores_query(PromisedQueryPtr &query);
td::Status process_answer_web_app_query_query(PromisedQueryPtr &query);
@ -689,8 +751,11 @@ class Client final : public WebhookActor::Callback {
td::Status process_answer_pre_checkout_query_query(PromisedQueryPtr &query);
td::Status process_export_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_create_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_create_chat_subscription_invite_link_query(PromisedQueryPtr &query);
td::Status process_edit_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_edit_chat_subscription_invite_link_query(PromisedQueryPtr &query);
td::Status process_revoke_chat_invite_link_query(PromisedQueryPtr &query);
td::Status process_get_business_connection_query(PromisedQueryPtr &query);
td::Status process_get_chat_query(PromisedQueryPtr &query);
td::Status process_set_chat_photo_query(PromisedQueryPtr &query);
td::Status process_delete_chat_photo_query(PromisedQueryPtr &query);
@ -734,6 +799,7 @@ class Client final : public WebhookActor::Callback {
td::Status process_upload_sticker_file_query(PromisedQueryPtr &query);
td::Status process_create_new_sticker_set_query(PromisedQueryPtr &query);
td::Status process_add_sticker_to_set_query(PromisedQueryPtr &query);
td::Status process_replace_sticker_in_set_query(PromisedQueryPtr &query);
td::Status process_set_sticker_set_title_query(PromisedQueryPtr &query);
td::Status process_set_sticker_set_thumbnail_query(PromisedQueryPtr &query);
td::Status process_set_custom_emoji_sticker_set_thumbnail_query(PromisedQueryPtr &query);
@ -850,6 +916,8 @@ class Client final : public WebhookActor::Callback {
static void fail_query_with_error(PromisedQueryPtr &&query, object_ptr<td_api::error> error,
td::Slice default_message = td::Slice());
static bool is_special_error_code(int32 error_code);
class JsonUpdates;
void do_get_updates(int32 offset, int32 limit, int32 timeout, PromisedQueryPtr query);
@ -875,6 +943,9 @@ class Client final : public WebhookActor::Callback {
object_ptr<td_api::chatPhoto> photo;
td::string bio;
object_ptr<td_api::birthdate> birthdate;
object_ptr<td_api::businessInfo> business_info;
int64 personal_chat_id = 0;
// start custom properties
bool is_verified = false;
@ -885,9 +956,11 @@ class Client final : public WebhookActor::Callback {
bool have_access = false;
bool can_join_groups = false;
bool can_read_all_group_messages = false;
bool is_inline_bot = false;
bool can_connect_to_business = false;
bool has_main_web_app = false;
bool has_private_forwards = false;
bool has_restricted_voice_and_video_messages = false;
bool is_inline_bot = false;
bool is_premium = false;
bool added_to_attachment_menu = false;
};
@ -918,8 +991,10 @@ class Client final : public WebhookActor::Callback {
td::string description;
td::string invite_link;
int64 sticker_set_id = 0;
int64 custom_emoji_sticker_set_id = 0;
int32 date = 0;
int32 slow_mode_delay = 0;
int32 unrestrict_boost_count = 0;
int64 linked_chat_id = 0;
object_ptr<td_api::chatLocation> location;
object_ptr<td_api::ChatMemberStatus> status;
@ -932,6 +1007,7 @@ class Client final : public WebhookActor::Callback {
bool join_by_request = false;
bool has_hidden_members = false;
bool has_aggressive_anti_spam_enabled = false;
bool has_paid_media_allowed = false;
// start custom properties
bool is_verified = false;
@ -954,6 +1030,7 @@ class Client final : public WebhookActor::Callback {
int64 background_custom_emoji_id = 0;
int64 profile_background_custom_emoji_id = 0;
bool has_protected_content = false;
int32 max_reaction_count = 0;
object_ptr<td_api::chatAvailableReactionsSome> available_reactions;
object_ptr<td_api::chatPhotoInfo> photo_info;
object_ptr<td_api::chatPermissions> permissions;
@ -966,6 +1043,9 @@ class Client final : public WebhookActor::Callback {
ChatInfo *add_chat(int64 chat_id);
const ChatInfo *get_chat(int64 chat_id) const;
void set_chat_available_reactions(ChatInfo *chat_info,
object_ptr<td_api::ChatAvailableReactions> &&available_reactions);
enum class ChatType { Private, Group, Supergroup, Channel, Unknown };
ChatType get_chat_type(int64 chat_id) const;
@ -981,13 +1061,19 @@ class Client final : public WebhookActor::Callback {
int32 date = 0;
int32 edit_date = 0;
int32 initial_send_date = 0;
int32 sender_boost_count = 0;
object_ptr<td_api::MessageOrigin> forward_origin;
td::string author_signature;
td::unique_ptr<MessageInfo> business_reply_to_message;
object_ptr<td_api::messageReplyToMessage> reply_to_message;
object_ptr<td_api::messageReplyToStory> reply_to_story;
int64 media_album_id = 0;
int64 via_bot_user_id = 0;
object_ptr<td_api::MessageContent> content;
object_ptr<td_api::ReplyMarkup> reply_markup;
td::string business_connection_id;
int64 sender_business_bot_user_id = 0;
int64 effect_id = 0;
// start custom properties
int32 views = 0;
@ -1000,9 +1086,22 @@ class Client final : public WebhookActor::Callback {
bool can_be_saved = false;
bool is_automatic_forward = false;
bool is_topic_message = false;
bool is_from_offline = false;
mutable bool is_content_changed = false;
};
struct BusinessConnection {
td::string id_;
int64 user_id_ = 0;
int64 user_chat_id_ = 0;
int32 date_ = 0;
bool can_reply_ = false;
bool is_enabled_ = false;
};
const BusinessConnection *add_business_connection(object_ptr<td_api::businessConnection> &&business_connection,
bool from_update);
const BusinessConnection *get_business_connection(const td::string &connection_id) const;
static int64 get_same_chat_reply_to_message_id(const td_api::messageReplyToMessage *reply_to,
int64 message_thread_id);
@ -1027,7 +1126,7 @@ class Client final : public WebhookActor::Callback {
static bool are_equal_inline_keyboards(const td_api::replyMarkupInlineKeyboard *lhs,
const td_api::replyMarkupInlineKeyboard *rhs);
void set_message_reply_markup(MessageInfo *message_info, object_ptr<td_api::ReplyMarkup> &&reply_markup);
static void set_message_reply_markup(MessageInfo *message_info, object_ptr<td_api::ReplyMarkup> &&reply_markup);
static int64 get_sticker_set_id(const object_ptr<td_api::MessageContent> &content);
@ -1061,6 +1160,12 @@ class Client final : public WebhookActor::Callback {
void process_new_message_queue(int64 chat_id, int state);
void add_new_business_message(object_ptr<td_api::updateNewBusinessMessage> &&update);
void add_business_message_edited(object_ptr<td_api::updateBusinessMessageEdited> &&update);
void process_new_business_message_queue(const td::string &connection_id);
struct FullMessageId {
int64 chat_id;
int64 message_id;
@ -1082,9 +1187,13 @@ class Client final : public WebhookActor::Callback {
};
FullMessageId add_message(object_ptr<td_api::message> &&message, bool force_update_content = false);
void init_message(MessageInfo *message_info, object_ptr<td_api::message> &&message, bool force_update_content);
const MessageInfo *get_message(int64 chat_id, int64 message_id, bool force_cache) const;
MessageInfo *get_message_editable(int64 chat_id, int64 message_id);
td::unique_ptr<MessageInfo> create_business_message(td::string business_connection_id,
object_ptr<td_api::businessMessage> &&message);
void update_message_content(int64 chat_id, int64 message_id, object_ptr<td_api::MessageContent> &&content);
void on_update_message_edited(int64 chat_id, int64 message_id, int32 edit_date,
@ -1119,12 +1228,18 @@ class Client final : public WebhookActor::Callback {
void process_new_callback_query_queue(int64 user_id, int state);
void add_new_business_callback_query(object_ptr<td_api::updateNewBusinessCallbackQuery> &&query);
void process_new_business_callback_query_queue(int64 user_id);
void add_new_inline_callback_query(object_ptr<td_api::updateNewInlineCallbackQuery> &&query);
void add_new_shipping_query(object_ptr<td_api::updateNewShippingQuery> &&query);
void add_new_pre_checkout_query(object_ptr<td_api::updateNewPreCheckoutQuery> &&query);
void add_update_purchased_paid_media(object_ptr<td_api::updatePaidMediaPurchased> &&query);
void add_new_custom_event(object_ptr<td_api::updateNewCustomEvent> &&event);
void add_new_custom_query(object_ptr<td_api::updateNewCustomQuery> &&query);
@ -1139,6 +1254,10 @@ class Client final : public WebhookActor::Callback {
void add_update_message_reaction_count(object_ptr<td_api::updateMessageReactions> &&update);
void add_update_business_connection(object_ptr<td_api::updateBusinessConnection> &&update);
void add_update_business_messages_deleted(object_ptr<td_api::updateBusinessMessagesDeleted> &&update);
// append only before Size
enum class UpdateType : int32 {
Message,
@ -1161,6 +1280,11 @@ class Client final : public WebhookActor::Callback {
ChatBoostRemoved,
MessageReaction,
MessageReactionCount,
BusinessConnection,
BusinessMessage,
EditedBusinessMessage,
BusinessMessagesDeleted,
PurchasedPaidMedia,
Size
};
@ -1232,6 +1356,7 @@ class Client final : public WebhookActor::Callback {
td::WaitFreeHashMap<int64, td::unique_ptr<GroupInfo>> groups_;
td::WaitFreeHashMap<int64, td::unique_ptr<SupergroupInfo>> supergroups_;
td::WaitFreeHashMap<int64, td::unique_ptr<ChatInfo>> chats_;
td::WaitFreeHashMap<td::string, td::unique_ptr<BusinessConnection>> business_connections_;
td::FlatHashMap<int32, td::vector<PromisedQueryPtr>> file_download_listeners_;
td::FlatHashSet<int32> download_started_file_ids_;
@ -1269,12 +1394,32 @@ class Client final : public WebhookActor::Callback {
};
td::FlatHashMap<int64, NewMessageQueue> new_message_queues_; // chat_id -> queue
struct NewBusinessMessage {
object_ptr<td_api::businessMessage> message_;
bool is_edited_ = false;
NewBusinessMessage(object_ptr<td_api::businessMessage> &&message, bool is_edited)
: message_(std::move(message)), is_edited_(is_edited) {
}
};
struct NewBusinessMessageQueue {
std::queue<NewBusinessMessage> queue_;
bool has_active_request_ = false;
};
td::FlatHashMap<td::string, NewBusinessMessageQueue> new_business_message_queues_; // connection_id -> queue
struct NewCallbackQueryQueue {
std::queue<object_ptr<td_api::updateNewCallbackQuery>> queue_;
bool has_active_request_ = false;
};
td::FlatHashMap<int64, NewCallbackQueryQueue> new_callback_query_queues_; // sender_user_id -> queue
struct NewBusinessCallbackQueryQueue {
std::queue<object_ptr<td_api::updateNewBusinessCallbackQuery>> queue_;
bool has_active_request_ = false;
};
td::FlatHashMap<int64, NewBusinessCallbackQueryQueue> new_business_callback_query_queues_; // sender_user_id -> queue
td::WaitFreeHashMap<int64, td::string> sticker_set_names_;
td::WaitFreeHashMap<int64, double> last_send_message_time_;

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021, Luckydonald (tdlight-telegram-bot-api+code@luckydonald.de) 2020
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024, Luckydonald (tdlight-telegram-bot-api+code@luckydonald.de) 2020
//
// 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)
@ -100,6 +100,11 @@ void ClientManager::send(PromisedQueryPtr query) {
auto id_it = token_to_id_.find(token);
if (id_it == token_to_id_.end()) {
auto method = query->method();
if (method == "close") {
return fail_query(400, "Bad Request: the bot has already been closed", std::move(query));
}
if (!check_flood_limits(query)) {
return;
}
@ -116,7 +121,6 @@ void ClientManager::send(PromisedQueryPtr query) {
query->token().str(), query->is_user(), query->is_test_dc(),
tqueue_id, parameters_, client_info->stat_.actor_id(&client_info->stat_));
auto method = query->method();
if (method != "deletewebhook" && method != "setwebhook") {
auto webhook_info = parameters_->shared_data_->webhook_db_->get(bot_token_with_dc);
if (!webhook_info.empty()) {

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)
@ -590,8 +590,7 @@ void WebhookActor::send_updates() {
void WebhookActor::handle(td::unique_ptr<td::HttpQuery> response) {
SCOPE_EXIT {
bool dummy = false;
td::Scheduler::instance()->destroy_on_scheduler(SharedData::get_file_gc_scheduler_id(), response, dummy);
td::Scheduler::instance()->destroy_on_scheduler_unique_ptr(SharedData::get_file_gc_scheduler_id(), response);
};
auto connection_id = get_link_token();

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
// 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)
@ -103,6 +103,7 @@ static void dump_stacktrace_signal_handler(int sig) {
static void fail_signal_handler(int sig) {
has_failed = true;
print_log();
{
td::LogGuard log_guard;
td::signal_safe_write_signal_number(sig);
@ -110,7 +111,6 @@ static void fail_signal_handler(int sig) {
options.use_gdb = true;
td::Stacktrace::print_to_stderr(options);
}
print_log();
_Exit(EXIT_FAILURE);
}
@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
auto start_time = td::Time::now();
auto shared_data = std::make_shared<SharedData>();
auto parameters = std::make_unique<ClientParameters>();
parameters->version_ = "7.0";
parameters->version_ = "7.10";
parameters->shared_data_ = shared_data;
parameters->start_time_ = start_time;
auto net_query_stats = td::create_net_query_stats();