diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 28c526ba8..92dffb94d 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -14,8 +14,8 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build docker image - run: docker build -t reo7sp/tgbot-cpp -f Dockerfile . + run: docker build -t reo7sp/maxbot-cpp -f Dockerfile . - name: Build docker image with examples and unit tests - run: docker build -t reo7sp/tgbot-cpp-test -f Dockerfile_test . + run: docker build -t reo7sp/maxbot-cpp-test -f Dockerfile_test . - name: Run unit tests - run: docker run --rm reo7sp/tgbot-cpp-test + run: docker run --rm reo7sp/maxbot-cpp-test diff --git a/.gitignore b/.gitignore index 56b06ba91..d1e55e546 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ install_manifest.txt .sw doc/ Thumbs.db -TgBot_test +MaxBot_test .idea/ docs/ cmake-build-* diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py new file mode 100644 index 000000000..fe69b966e --- /dev/null +++ b/.ycm_extra_conf.py @@ -0,0 +1,95 @@ +from distutils.sysconfig import get_python_inc +import platform +import os +import subprocess +import ycm_core + +DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) ) +SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] + +flags = [ + '-Wall', + '-Wextra', + '-Werror', + '-x', + 'c++', + '-std=c++23', + '-I', DIR_OF_THIS_SCRIPT + '/include', + '-I', '/usr/include', +] + + + +# Set this to the absolute path to the folder (NOT the file!) containing the +# compile_commands.json file to use that instead of 'flags'. See here for +# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html +# +# You can get CMake to generate this file for you by adding: +# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 ) +# to your CMakeLists.txt file. +# +# Most projects will NOT need to set this to anything; you can just change the +# 'flags' list of compilation flags. Notice that YCM itself uses that approach. +compilation_database_folder = '' + +if os.path.exists( compilation_database_folder ): + database = ycm_core.CompilationDatabase( compilation_database_folder ) +else: + database = None + + +def IsHeaderFile( filename ): + extension = os.path.splitext( filename )[ 1 ] + return extension in [ '.h', '.hxx', '.hpp', '.hh' ] + + +def FindCorrespondingSourceFile( filename ): + if IsHeaderFile( filename ): + basename = os.path.splitext( filename )[ 0 ] + for extension in SOURCE_EXTENSIONS: + replacement_file = basename + extension + if os.path.exists( replacement_file ): + return replacement_file + return filename + + +def Settings( **kwargs ): + if kwargs[ 'language' ] == 'cfamily': + # If the file is a header, try to find the corresponding source file and + # retrieve its flags from the compilation database if using one. This is + # necessary since compilation databases don't have entries for header files. + # In addition, use this source file as the translation unit. This makes it + # possible to jump from a declaration in the header file to its definition + # in the corresponding source file. + filename = FindCorrespondingSourceFile( kwargs[ 'filename' ] ) + + if not database: + return { + 'flags': flags, + 'include_paths_relative_to_dir': DIR_OF_THIS_SCRIPT, + 'override_filename': filename + } + + compilation_info = database.GetCompilationInfoForFile( filename ) + if not compilation_info.compiler_flags_: + return {} + + # Bear in mind that compilation_info.compiler_flags_ does NOT return a + # python list, but a "list-like" StringVec object. + final_flags = list( compilation_info.compiler_flags_ ) + + # NOTE: This is just for YouCompleteMe; it's highly likely that your project + # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR + # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT. + try: + final_flags.remove( '-stdlib=libc++' ) + except ValueError: + pass + + return { + 'flags': final_flags, + 'include_paths_relative_to_dir': compilation_info.compiler_working_dir_, + 'override_filename': filename + } + return {} + diff --git a/CMakeLists.txt b/CMakeLists.txt index d00ed617b..f93cd0571 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2) -project(TgBot) +project(MaxBot) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) # find_package() uses _ROOT variables @@ -7,13 +7,13 @@ endif() # options option(ENABLE_TESTS "Set to ON to enable building of tests" OFF) -option(BUILD_SHARED_LIBS "Build tgbot-cpp shared/static library." OFF) +option(BUILD_SHARED_LIBS "Build maxbot-cpp shared/static library." OFF) option(BUILD_DOCUMENTATION "Build doxygen API documentation." OFF) # sources -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_EXTENSIONS ON) if(WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) add_definitions(-D_WIN32_WINNT=0x0601) @@ -28,12 +28,14 @@ set(SRC_LIST src/Api.cpp src/Bot.cpp src/EventHandler.cpp - src/TgException.cpp - src/TgTypeParser.cpp + src/BotException.cpp + src/BotTypeParser.cpp + src/BotTypeParserBase.cpp + src/BotTypeParserUpdates.cpp src/net/BoostHttpOnlySslClient.cpp src/net/CurlHttpClient.cpp src/net/HttpParser.cpp - src/net/TgLongPoll.cpp + src/net/BotLongPoll.cpp src/net/Url.cpp src/tools/FileTools.cpp src/tools/StringTools.cpp @@ -46,7 +48,6 @@ set(SRC_LIST src/types/InputMessageContent.cpp src/types/MenuButton.cpp src/types/MessageOrigin.cpp - src/types/PassportElementError.cpp src/types/ReactionType.cpp) # libs @@ -63,6 +64,7 @@ include_directories(${OPENSSL_INCLUDE_DIR}) ## curl find_package(CURL 7.58.0) if (CURL_FOUND) + message("CURL available") include_directories(${CURL_INCLUDE_DIRS}) add_definitions(-DHAVE_CURL) endif() @@ -159,5 +161,5 @@ if(BUILD_DOCUMENTATION) endif() if(BUILD_SHARED_LIBS) - add_definitions(-DTGBOT_DLL) + add_definitions(-DMAXBOT_DLL) endif() diff --git a/Dockerfile b/Dockerfile index 3664680db..18418d28a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ RUN apt-get -qq update && \ apt-get -qq install -y g++ make binutils cmake libssl-dev libboost-system-dev libcurl4-openssl-dev zlib1g-dev && \ rm -rf /var/lib/apt/lists/* -WORKDIR /usr/src/tgbot-cpp +WORKDIR /usr/src/maxbot-cpp COPY include include COPY src src COPY CMakeLists.txt ./ @@ -13,4 +13,4 @@ COPY CMakeLists.txt ./ RUN cmake . && \ make -j$(nproc) && \ make install && \ - rm -rf /usr/src/tgbot-cpp/* + rm -rf /usr/src/maxbot-cpp/* diff --git a/Dockerfile_test b/Dockerfile_test index e28a43b2c..debb8bcf6 100644 --- a/Dockerfile_test +++ b/Dockerfile_test @@ -19,7 +19,7 @@ RUN apt-get -qq update && \ zlib1g-dev && \ rm -rf /var/lib/apt/lists/* -WORKDIR /usr/src/tgbot-cpp +WORKDIR /usr/src/maxbot-cpp COPY include include COPY src src COPY test test @@ -31,51 +31,51 @@ RUN cmake -DENABLE_TESTS=ON . && \ COPY samples samples -WORKDIR /usr/src/tgbot-cpp/samples/echobot +WORKDIR /usr/src/maxbot-cpp/samples/echobot RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp/samples/echobot-curl-client +WORKDIR /usr/src/maxbot-cpp/samples/echobot-curl-client RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp/samples/echobot-setmycommands +WORKDIR /usr/src/maxbot-cpp/samples/echobot-setmycommands RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp -RUN rm -rf samples/echobot-submodule/tgbot-cpp/ -COPY include samples/echobot-submodule/tgbot-cpp/include -COPY src samples/echobot-submodule/tgbot-cpp/src -COPY CMakeLists.txt samples/echobot-submodule/tgbot-cpp/ -WORKDIR /usr/src/tgbot-cpp/samples/echobot-submodule +WORKDIR /usr/src/maxbot-cpp +RUN rm -rf samples/echobot-submodule/maxbot-cpp/ +COPY include samples/echobot-submodule/maxbot-cpp/include +COPY src samples/echobot-submodule/maxbot-cpp/src +COPY CMakeLists.txt samples/echobot-submodule/maxbot-cpp/ +WORKDIR /usr/src/maxbot-cpp/samples/echobot-submodule RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp/samples/echobot-webhook-server +WORKDIR /usr/src/maxbot-cpp/samples/echobot-webhook-server RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp/samples/inline-keyboard +WORKDIR /usr/src/maxbot-cpp/samples/inline-keyboard RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp/samples/photo +WORKDIR /usr/src/maxbot-cpp/samples/photo RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp/samples/received-text-processing +WORKDIR /usr/src/maxbot-cpp/samples/received-text-processing RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp/samples/reply-keyboard +WORKDIR /usr/src/maxbot-cpp/samples/reply-keyboard RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp/samples/receive-file +WORKDIR /usr/src/maxbot-cpp/samples/receive-file RUN rm -rf CMakeCache.txt CMakeFiles/ && \ cmake . && make -j$(nproc) -WORKDIR /usr/src/tgbot-cpp +WORKDIR /usr/src/maxbot-cpp ENV CTEST_OUTPUT_ON_FAILURE=1 CMD make test diff --git a/Doxyfile b/Doxyfile index 114567e73..24217532f 100644 --- a/Doxyfile +++ b/Doxyfile @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = tgbot-cpp +PROJECT_NAME = maxbot-cpp # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version diff --git a/LICENSE b/LICENSE index 8c9682a51..28bda2383 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015-2024 GitHub contributors https://github.com/reo7sp/tgbot-cpp/graphs/contributors +Copyright (c) 2015-2024 GitHub contributors https://github.com/reo7sp/maxbot-cpp/graphs/contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index d20f8fc08..efbdd9a83 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# tgbot-cpp +# maxbot-cpp -[![GitHub contributors](https://img.shields.io/github/contributors/reo7sp/tgbot-cpp.svg)](https://github.com/reo7sp/tgbot-cpp/graphs/contributors) +[![GitHub contributors](https://img.shields.io/github/contributors/reo7sp/maxbot-cpp.svg)](https://github.com/reo7sp/maxbot-cpp/graphs/contributors) C++ library for Telegram bot API. -Documentation is located [here](http://reo7sp.github.io/tgbot-cpp). +Documentation is located [here](http://reo7sp.github.io/maxbot-cpp). ## State @@ -22,14 +22,17 @@ Simple echo bot which sends everything it receives: ```cpp #include -#include +#include +#include int main() { - TgBot::Bot bot("PLACE YOUR TOKEN HERE"); - bot.getEvents().onCommand("start", [&bot](TgBot::Message::Ptr message) { + + CurlHttpClient client("PLACE YOUR TOKEN HERE"); + MaxBot::Bot bot(client); + bot.getEvents().onCommand("start", [&bot](MaxBot::Message::Ptr message) { bot.getApi().sendMessage(message->chat->id, "Hi!"); }); - bot.getEvents().onAnyMessage([&bot](TgBot::Message::Ptr message) { + bot.getEvents().onAnyMessage([&bot](MaxBot::Message::Ptr message) { printf("User wrote %s\n", message->text.c_str()); if (StringTools::startsWith(message->text, "/start")) { return; @@ -38,12 +41,12 @@ int main() { }); try { printf("Bot username: %s\n", bot.getApi().getMe()->username.c_str()); - TgBot::TgLongPoll longPoll(bot); + MaxBot::BotLongPoll longPoll(bot); while (true) { printf("Long poll started\n"); longPoll.start(); } - } catch (TgBot::TgException& e) { + } catch (MaxBot::BotException& e) { printf("error: %s\n", e.what()); } return 0; @@ -79,14 +82,14 @@ sudo apt install libboost-test-dev doxygen You can compile and install the library with these commands: ```sh -git clone https://github.com/reo7sp/tgbot-cpp -cd tgbot-cpp +git clone https://github.com/reo7sp/maxbot-cpp +cd maxbot-cpp cmake . make -j4 sudo make install ``` -Alternatively, you can use Docker to build and run your bot. Set the base image of your's Dockerfile to [reo7sp/tgbot-cpp](https://hub.docker.com/r/reo7sp/tgbot-cpp/). +Alternatively, you can use Docker to build and run your bot. Set the base image of your's Dockerfile to [reo7sp/maxbot-cpp](https://hub.docker.com/r/reo7sp/maxbot-cpp/). ## Library installation on MacOS @@ -102,7 +105,7 @@ You can compile and install the library like Linux instructions. ## Library installation on Windows -### Download vcpkg and tgbot-cpp +### Download vcpkg and maxbot-cpp Taken from [Vcpkg - Quick Start: Windows](https://github.com/Microsoft/vcpkg/#quick-start-windows). @@ -127,13 +130,13 @@ In order to use vcpkg with Visual Studio, run the following command (may require To install the libraries for Windows x64, run: ```cmd -> .\vcpkg\vcpkg install tgbot-cpp:x64-windows +> .\vcpkg\vcpkg install maxbot-cpp:x64-windows ``` To install for Windows x86, run: ```cmd -> .\vcpkg\vcpkg install tgbot-cpp +> .\vcpkg\vcpkg install maxbot-cpp ``` The library will now be installed and Visual Studio should be able to find the vcpkg installation. @@ -143,7 +146,7 @@ The library will now be installed and Visual Studio should be able to find the v Use the [example CMakeLists.txt](samples/echobot/CMakeLists.txt) with changes: 1. Remove `/usr/local/include` -2. Change `/usr/local/lib/libTgBot.a` to `C:/src/vcpkg/installed/x64-windows/lib/TgBot.lib` or something simmilar according to your own installation path. +2. Change `/usr/local/lib/libMaxBot.a` to `C:/src/vcpkg/installed/x64-windows/lib/MaxBot.lib` or something simmilar according to your own installation path. ## Bot compilation @@ -157,17 +160,17 @@ Also, you can treat this repository as a submodule of your project, for example, ### Without CMake ```sh -g++ telegram_bot.cpp -o telegram_bot --std=c++14 -I/usr/local/include -lTgBot -lboost_system -lssl -lcrypto -lpthread +g++ telegram_bot.cpp -o telegram_bot --std=c++14 -I/usr/local/include -lMaxBot -lboost_system -lssl -lcrypto -lpthread ``` ### Build options ``` --DTGBOT_DISABLE_NAGLES_ALGORITHM # Disable 'Nagle's algorithm' --DTGBOT_CHANGE_SOCKET_BUFFER_SIZE # Socket Buffer Size Expansion --DTGBOT_CHANGE_READ_BUFFER_SIZE # Read Buffer Size Expansion +-DMAXBOT_DISABLE_NAGLES_ALGORITHM # Disable 'Nagle's algorithm' +-DMAXBOT_CHANGE_SOCKET_BUFFER_SIZE # Socket Buffer Size Expansion +-DMAXBOT_CHANGE_READ_BUFFER_SIZE # Read Buffer Size Expansion ``` ## Licence -[The MIT License](https://github.com/reo7sp/tgbot-cpp/blob/master/LICENSE). +[The MIT License](https://github.com/reo7sp/maxbot-cpp/blob/master/LICENSE). diff --git a/include/tgbot/Api.h b/include/maxbot/Api.h similarity index 68% rename from include/tgbot/Api.h rename to include/maxbot/Api.h index 2288f5c0b..ddab40dc0 100644 --- a/include/tgbot/Api.h +++ b/include/maxbot/Api.h @@ -1,32 +1,25 @@ -#ifndef TGBOT_API_H -#define TGBOT_API_H - -#include "tgbot/TgException.h" -#include "tgbot/TgTypeParser.h" -#include "tgbot/net/HttpClient.h" -#include "tgbot/net/HttpReqArg.h" -#include "tgbot/tools/StringTools.h" -#include "tgbot/types/User.h" -#include "tgbot/types/Message.h" -#include "tgbot/types/MessageId.h" -#include "tgbot/types/GenericReply.h" -#include "tgbot/types/InputFile.h" -#include "tgbot/types/UserProfilePhotos.h" -#include "tgbot/types/Update.h" -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/Venue.h" -#include "tgbot/types/WebhookInfo.h" -#include "tgbot/types/ChatMember.h" -#include "tgbot/types/Sticker.h" -#include "tgbot/types/StickerSet.h" -#include "tgbot/types/File.h" -#include "tgbot/types/InputMedia.h" -#include "tgbot/types/GameHighScore.h" -#include "tgbot/types/SentWebAppMessage.h" -#include "tgbot/types/LabeledPrice.h" -#include "tgbot/types/ShippingOption.h" -#include "tgbot/types/BotCommand.h" -#include "tgbot/types/ForumTopic.h" +#ifndef MAXBOT_API_H +#define MAXBOT_API_H + +#include "maxbot/BotException.h" +#include "maxbot/BotTypeParser.h" +#include "maxbot/net/HttpClient.h" +#include "maxbot/net/HttpReqArg.h" +#include "maxbot/tools/StringTools.h" +#include "maxbot/types/User.h" +#include "maxbot/types/NewMessageBody.h" +#include "maxbot/types/Message.h" +#include "maxbot/types/MessageId.h" +#include "maxbot/types/GenericReply.h" +#include "maxbot/types/InputFile.h" +#include "maxbot/types/UserProfilePhotos.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/WebhookInfo.h" +#include "maxbot/types/ChatMember.h" +#include "maxbot/types/File.h" +#include "maxbot/types/InputMedia.h" +#include "maxbot/types/SentWebAppMessage.h" +#include "maxbot/types/BotCommand.h" #include #include @@ -37,7 +30,7 @@ #include #include -namespace TgBot { +namespace MaxBot { class Bot; @@ -46,14 +39,14 @@ class Bot; * * @ingroup general */ -class TGBOT_API Api { +class MAXBOT_API Api { typedef std::shared_ptr> StringArrayPtr; friend class Bot; public: - Api(std::string token, const HttpClient& httpClient, const std::string& url); + Api(const HttpClient& httpClient, const std::string& url); /** * @brief Use this method to receive incoming updates using long polling ([wiki](https://en.wikipedia.org/wiki/Push_technology#Long_polling)). @@ -69,7 +62,7 @@ friend class Bot; * * @return Returns an Array of Update objects. */ - std::vector getUpdates(std::int32_t offset = 0, + Updates::Ptr getUpdates(std::int64_t marker = 0, std::int32_t limit = 100, std::int32_t timeout = 0, const StringArrayPtr& allowedUpdates = nullptr) const; @@ -101,11 +94,7 @@ friend class Bot; * @return Returns True on success. */ bool setWebhook(const std::string& url, - InputFile::Ptr certificate = nullptr, - std::int32_t maxConnections = 40, const StringArrayPtr& allowedUpdates = nullptr, - const std::string& ipAddress = "", - bool dropPendingUpdates = false, const std::string& secretToken = "") const; /** @@ -115,7 +104,7 @@ friend class Bot; * * @return Returns True on success. */ - bool deleteWebhook(bool dropPendingUpdates = false) const; + bool deleteWebhook(const std::string& url) const; /** * @brief Use this method to get current webhook status. @@ -175,17 +164,10 @@ friend class Bot; * * @return On success, the sent Message is returned. */ - Message::Ptr sendMessage(boost::variant chatId, - const std::string& text, - LinkPreviewOptions::Ptr linkPreviewOptions = nullptr, - ReplyParameters::Ptr replyParameters = nullptr, - GenericReply::Ptr replyMarkup = nullptr, - const std::string& parseMode = "", - bool disableNotification = false, - const std::vector& entities = std::vector(), - std::int32_t messageThreadId = 0, - bool protectContent = false, - const std::string& businessConnectionId = "") const; + Message::Ptr sendMessage(std::int64_t chatId, + NewMessageBody::Ptr msg, + bool disableLinkPreview = false) const; + bool editMessage(const std::string& msgId, NewMessageBody::Ptr msg) const; /** * @brief Use this method to forward messages of any kind. @@ -646,43 +628,6 @@ friend class Bot; const std::string& inlineMessageId = "", InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared()) const; - /** - * @brief Use this method to send information about a venue. - * - * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) - * @param latitude Latitude of the venue - * @param longitude Longitude of the venue - * @param title Name of the venue - * @param address Address of the venue - * @param foursquareId Optional. Foursquare identifier of the venue - * @param foursquareType Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) - * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound. - * @param replyParameters Optional. Description of the message to reply to - * @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards), [custom reply keyboard](https://core.telegram.org/bots/features#keyboards), instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account - * @param googlePlaceId Optional. Google Places identifier of the venue - * @param googlePlaceType Optional. Google Places type of the venue. (See https://developers.google.com/places/web-service/supported_types) - * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving - * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent - * - * @return On success, the sent Message is returned. - */ - Message::Ptr sendVenue(boost::variant chatId, - float latitude, - float longitude, - const std::string& title, - const std::string& address, - const std::string& foursquareId = "", - const std::string& foursquareType = "", - bool disableNotification = false, - ReplyParameters::Ptr replyParameters = nullptr, - GenericReply::Ptr replyMarkup = nullptr, - const std::string& googlePlaceId = "", - const std::string& googlePlaceType = "", - std::int32_t messageThreadId = 0, - bool protectContent = false, - const std::string& businessConnectionId = "") const; - /** * @brief Use this method to send phone contacts. * @@ -757,29 +702,6 @@ friend class Bot; bool protectContent = false, const std::string& businessConnectionId = "") const; - /** - * @brief Use this method to send an animated emoji that will display a random value. - * - * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) - * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound. - * @param replyParameters Optional. Description of the message to reply to - * @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards), [custom reply keyboard](https://core.telegram.org/bots/features#keyboards), instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account - * @param emoji Optional. Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” - * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - * @param protectContent Optional. Protects the contents of the sent message from forwarding - * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent - * - * @return On success, the sent Message is returned. - */ - Message::Ptr sendDice(boost::variant chatId, - bool disableNotification = false, - ReplyParameters::Ptr replyParameters = nullptr, - GenericReply::Ptr replyMarkup = nullptr, - const std::string& emoji = "", - std::int32_t messageThreadId = 0, - bool protectContent = false, - const std::string& businessConnectionId = "") const; - /** * @brief Use this method to change the chosen reactions on a message. * @@ -1245,195 +1167,6 @@ friend class Bot; ChatMember::Ptr getChatMember(boost::variant chatId, std::int64_t userId) const; - /** - * @brief Use this method to set a new group sticker set for a supergroup. - * - * The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. - * Use the field canSetStickerSet optionally returned in Api::getChat requests to check if the bot can use this method. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * @param stickerSetName Name of the sticker set to be set as the group sticker set - * - * @return Returns True on success. - */ - bool setChatStickerSet(boost::variant chatId, - const std::string& stickerSetName) const; - - /** - * @brief Use this method to delete a group sticker set from a supergroup. - * - * The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. - * Use the field canSetSticker_set optionally returned in Api::getChat requests to check if the bot can use this method. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * - * @return Returns True on success. - */ - bool deleteChatStickerSet(boost::variant chatId) const; - - /** - * @brief Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. - * - * @return Returns an Array of Sticker objects. - */ - std::vector getForumTopicIconStickers() const; - - /** - * @brief Use this method to create a topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * @param name Topic name, 1-128 characters - * @param iconColor Optional. Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F) - * @param iconCustomEmojiId Optional. Unique identifier of the custom emoji shown as the topic icon. Use Api::getForumTopicIconStickers to get all allowed custom emoji identifiers. - * - * @return Returns information about the created topic as a ForumTopic object. - */ - ForumTopic::Ptr createForumTopic(boost::variant chatId, - const std::string& name, - std::int32_t iconColor = 0, - const std::string& iconCustomEmojiId = "") const; - - /** - * @brief Use this method to edit name and icon of a topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have canManageTopics administrator rights, unless it is the creator of the topic. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * @param messageThreadId Unique identifier for the target message thread of the forum topic - * @param name Optional. New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept - * @param iconCustomEmojiId Optional. New unique identifier of the custom emoji shown as the topic icon. Use Api::getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept - * - * @return Returns True on success. - */ - bool editForumTopic(boost::variant chatId, - std::int32_t messageThreadId, - const std::string& name = "", - boost::variant iconCustomEmojiId = 0) const; - - /** - * @brief Use this method to close an open topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights, unless it is the creator of the topic. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * @param messageThreadId Unique identifier for the target message thread of the forum topic - * - * @return Returns True on success. - */ - bool closeForumTopic(boost::variant chatId, - std::int32_t messageThreadId) const; - - /** - * @brief Use this method to reopen a closed topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights, unless it is the creator of the topic. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * @param messageThreadId Unique identifier for the target message thread of the forum topic - * - * @return Returns True on success. - */ - bool reopenForumTopic(boost::variant chatId, - std::int32_t messageThreadId) const; - - /** - * @brief Use this method to delete a forum topic along with all its messages in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have the canDeleteMessages administrator rights. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * @param messageThreadId Unique identifier for the target message thread of the forum topic - * - * @return Returns True on success. - */ - bool deleteForumTopic(boost::variant chatId, - std::int32_t messageThreadId) const; - - /** - * @brief Use this method to clear the list of pinned messages in a forum topic. - * - * The bot must be an administrator in the chat for this to work and must have the canPinMessages administrator right in the supergroup. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * @param messageThreadId Unique identifier for the target message thread of the forum topic - * - * @return Returns True on success. - */ - bool unpinAllForumTopicMessages(boost::variant chatId, - std::int32_t messageThreadId) const; - - /** - * @brief Use this method to edit the name of the 'General' topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have canManageTopics administrator rights. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * @param name New topic name, 1-128 characters - * - * @return Returns True on success. - */ - bool editGeneralForumTopic(boost::variant chatId, - std::string name) const; - - /** - * @brief Use this method to close an open 'General' topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * - * @return Returns True on success. - */ - bool closeGeneralForumTopic(boost::variant chatId) const; - - /** - * @brief Use this method to reopen a closed 'General' topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights. - * The topic will be automatically unhidden if it was hidden. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * - * @return Returns True on success. - */ - bool reopenGeneralForumTopic(boost::variant chatId) const; - - /** - * @brief Use this method to hide the 'General' topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights. - * The topic will be automatically closed if it was open. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * - * @return Returns True on success. - */ - bool hideGeneralForumTopic(boost::variant chatId) const; - - /** - * @brief Use this method to unhide the 'General' topic in a forum supergroup chat. - * - * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * - * @return Returns True on success. - */ - bool unhideGeneralForumTopic(boost::variant chatId) const; - - /** - * @brief Use this method to clear the list of pinned messages in a General forum topic. - * - * The bot must be an administrator in the chat for this to work and must have the canPinMessages administrator right in the supergroup. - * - * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - * - * @return Returns True on success. - */ - bool unpinAllGeneralForumTopicMessages(boost::variant chatId) const; - /** * @brief Use this method to send answers to callback queries sent from inline keyboards. * @@ -1443,19 +1176,12 @@ friend class Bot; * For this option to work, you must first create a game for your bot via @BotFather and accept the terms. * Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. * - * @param callbackQueryId Unique identifier for the query to be answered - * @param text Optional. Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters - * @param showAlert Optional. If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. - * @param url Optional. URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from an InlineKeyboardButton button. - * @param cacheTime Optional. The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. + * @param callbackId Unique identifier for the query to be answered + * @param answer body * * @return On success, True is returned. */ - bool answerCallbackQuery(const std::string& callbackQueryId, - const std::string& text = "", - bool showAlert = false, - const std::string& url = "", - std::int32_t cacheTime = 0) const; + bool answerCallbackQuery(const std::string& callbackId, CallbackAnswer::Ptr answer) const; /** * @brief Use this method to get the list of boosts added to a chat by a user. @@ -1470,15 +1196,6 @@ friend class Bot; UserChatBoosts::Ptr getUserChatBoosts(boost::variant chatId, std::int32_t userId) const; - /** - * @brief Use this method to get information about the connection of the bot with a business account. - * - * @param businessConnectionId Unique identifier of the business connection - * - * @return Returns a BusinessConnection object on success. - */ - BusinessConnection::Ptr getBusinessConnection(const std::string& businessConnectionId) const; - /** * @brief Use this method to change the list of the bot's commands. * @@ -1745,223 +1462,6 @@ friend class Bot; bool deleteMessages(boost::variant chatId, const std::vector& messageIds) const; - /** - * @brief Use this method to send static .WEBP, [animated](https://telegram.org/blog/animated-stickers) .TGS, or [video](https://telegram.org/blog/video-stickers-better-reactions) .WEBM stickers. - * - * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) - * @param sticker Sticker to send. Pass a fileId as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. [More information on Sending Files »](https://core.telegram.org/bots/api#sending-files). Video and animated stickers can't be sent via an HTTP URL. - * @param replyParameters Optional. Description of the message to reply to - * @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards), [custom reply keyboard](https://core.telegram.org/bots/features#keyboards), instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account - * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound. - * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving - * @param emoji Optional. Emoji associated with the sticker; only for just uploaded stickers - * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent - * - * @return On success, the sent Message is returned. - */ - Message::Ptr sendSticker(boost::variant chatId, - boost::variant sticker, - ReplyParameters::Ptr replyParameters = nullptr, - GenericReply::Ptr replyMarkup = nullptr, - bool disableNotification = false, - std::int32_t messageThreadId = 0, - bool protectContent = false, - const std::string& emoji = "", - const std::string& businessConnectionId = "") const; - - /** - * @brief Use this method to get a sticker set. - * - * @param name Name of the sticker set - * - * @return On success, a StickerSet object is returned. - */ - StickerSet::Ptr getStickerSet(const std::string& name) const; - - /** - * @brief Use this method to get information about custom emoji stickers by their identifiers. - * - * @param customEmojiIds A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. - * - * @return Returns an Array of Sticker objects. - */ - std::vector getCustomEmojiStickers(const std::vector& customEmojiIds) const; - - /** - * @brief Use this method to upload a file with a sticker for later use in the Api::createNewStickerSet, Api::addStickerToSet, or Api::replaceStickerInSet methods (the file can be used multiple times). - * - * @param userId User identifier of sticker file owner - * @param sticker A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. https://core.telegram.org/bots/api#sending-files - * @param stickerFormat Format of the sticker, must be one of “static”, “animated”, “video” - * - * @return Returns the uploaded File on success. - */ - File::Ptr uploadStickerFile(std::int64_t userId, - InputFile::Ptr sticker, - const std::string& stickerFormat) const; - - /** - * @brief Use this method to create a new sticker set owned by a user. - * - * The bot will be able to edit the sticker set thus created. - * - * @param userId User identifier of created sticker set owner - * @param name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_". is case insensitive. 1-64 characters. - * @param title Sticker set title, 1-64 characters - * @param stickers A JSON-serialized list of 1-50 initial stickers to be added to the sticker set - * @param stickerType Optional. Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created. - * @param needsRepainting Optional. Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only - * - * @return Returns True on success. - */ - bool createNewStickerSet(std::int64_t userId, - const std::string& name, - const std::string& title, - const std::vector& stickers, - Sticker::Type stickerType = Sticker::Type::Regular, - bool needsRepainting = false) const; - - /** - * @brief Use this method to add a new sticker to a set created by the bot. - * - * Emoji sticker sets can have up to 200 stickers. - * Other sticker sets can have up to 120 stickers. - * - * @param userId User identifier of sticker set owner - * @param name Sticker set name - * @param sticker A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed. - * - * @return Returns True on success. - */ - bool addStickerToSet(std::int64_t userId, - const std::string& name, - InputSticker::Ptr sticker) const; - - /** - * @brief Use this method to move a sticker in a set created by the bot to a specific position. - * - * @param sticker File identifier of the sticker - * @param position New sticker position in the set, zero-based - * - * @return Returns True on success. - */ - bool setStickerPositionInSet(const std::string& sticker, - std::int32_t position) const; - - /** - * @brief Use this method to delete a sticker from a set created by the bot. - * - * @param sticker File identifier of the sticker - * - * @return Returns True on success. - */ - bool deleteStickerFromSet(const std::string& sticker) const; - - /** - * @brief Use this method to replace an existing sticker in a sticker set with a new one. - * - * The method is equivalent to calling Api::deleteStickerFromSet, then Api::addStickerToSet, then Api::setStickerPositionInSet. - * - * @param userId User identifier of the sticker set owner - * @param name Sticker set name - * @param oldSticker File identifier of the replaced sticker - * @param sticker A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged. - * - * @return Returns True on success. - */ - bool replaceStickerInSet(std::int64_t userId, - const std::string& name, - const std::string& oldSticker, - InputSticker::Ptr sticker) const; - - /** - * @brief Use this method to change the list of emoji assigned to a regular or custom emoji sticker. - * - * The sticker must belong to a sticker set created by the bot. - * - * @param sticker File identifier of the sticker - * @param emojiList A JSON-serialized list of 1-20 emoji associated with the sticker - * - * @return Returns True on success. - */ - bool setStickerEmojiList(const std::string& sticker, - const std::vector& emojiList) const; - - /** - * @brief Use this method to change search keywords assigned to a regular or custom emoji sticker. - * - * The sticker must belong to a sticker set created by the bot. - * - * @param sticker File identifier of the sticker - * @param keywords Optional. A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters - * - * @return Returns True on success. - */ - bool setStickerKeywords(const std::string& sticker, - const std::vector& keywords = std::vector()) const; - - /** - * @brief Use this method to change the mask position of a mask sticker. - * - * The sticker must belong to a sticker set that was created by the bot. - * - * @param sticker File identifier of the sticker - * @param maskPosition A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position. - * - * @return Returns True on success. - */ - bool setStickerMaskPosition(const std::string& sticker, - MaskPosition::Ptr maskPosition = nullptr) const; - - /** - * @brief Use this method to set the title of a created sticker set. - * - * @param name Sticker set name - * @param title Sticker set title, 1-64 characters - * - * @return Returns True on success. - */ - bool setStickerSetTitle(const std::string& name, - const std::string& title) const; - - /** - * @brief Use this method to set the thumbnail of a regular or mask sticker set. - * - * The format of the thumbnail file must match the format of the stickers in the set. - * - * @param name Sticker set name - * @param userId User identifier of the sticker set owner - * @param format Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video - * @param thumbnail Optional. A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a fileId as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. - * - * @return Returns True on success. - */ - bool setStickerSetThumbnail(const std::string& name, - std::int64_t userId, - const std::string& format, - boost::variant thumbnail = "") const; - - /** - * @brief Use this method to set the thumbnail of a custom emoji sticker set. - * - * @param name Sticker set name - * @param customEmojiId Optional. Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail. - * - * @return Returns True on success. - */ - bool setCustomEmojiStickerSetThumbnail(const std::string& name, - const std::string& customEmojiId = "") const; - - /** - * @brief Use this method to delete a sticker set that was created by the bot. - * - * @param name Sticker set name - * - * @return Returns True on success. - */ - bool deleteStickerSet(const std::string& name) const; - /** * @brief Use this method to send answers to an inline query. * @@ -1994,230 +1494,6 @@ friend class Bot; SentWebAppMessage::Ptr answerWebAppQuery(const std::string& webAppQueryId, InlineQueryResult::Ptr result) const; - /** - * @brief Use this method to send invoices. - * - * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) - * @param title Product name, 1-32 characters - * @param description Product description, 1-255 characters - * @param payload Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - * @param providerToken Payments provider token, obtained via Botfather - * @param currency Three-letter ISO 4217 currency code, see https://core.telegram.org/bots/payments#supported-currencies - * @param prices Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - * @param providerData Optional. A JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. - * @param photoUrl Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. - * @param photoSize Optional. Photo size - * @param photoWidth Optional. Photo width - * @param photoHeight Optional. Photo height - * @param needName Optional. Pass True, if you require the user's full name to complete the order - * @param needPhoneNumber Optional. Pass True, if you require the user's phone number to complete the order - * @param needEmail Optional. Pass True, if you require the user's email address to complete the order - * @param needShippingAddress Optional. Pass True, if you require the user's shipping address to complete the order - * @param sendPhoneNumberToProvider Optional. Pass True, if user's phone number should be sent to provider - * @param sendEmailToProvider Optional. Pass True, if user's email address should be sent to provider - * @param isFlexible Optional. Pass True, if the final price depends on the shipping method - * @param replyParameters Optional. Description of the message to reply to - * @param replyMarkup Optional. A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. - * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound. - * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - * @param maxTipAmount Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in https://core.telegram.org/bots/payments/currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 - * @param suggestedTipAmounts Optional. A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed maxTipAmount. - * @param startParameter Optional. Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter - * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving - * - * @return On success, the sent Message is returned. - */ - Message::Ptr sendInvoice(boost::variant chatId, - const std::string& title, - const std::string& description, - const std::string& payload, - const std::string& providerToken, - const std::string& currency, - const std::vector& prices, - const std::string& providerData = "", - const std::string& photoUrl = "", - std::int32_t photoSize = 0, - std::int32_t photoWidth = 0, - std::int32_t photoHeight = 0, - bool needName = false, - bool needPhoneNumber = false, - bool needEmail = false, - bool needShippingAddress = false, - bool sendPhoneNumberToProvider = false, - bool sendEmailToProvider = false, - bool isFlexible = false, - ReplyParameters::Ptr replyParameters = nullptr, - GenericReply::Ptr replyMarkup = nullptr, - bool disableNotification = false, - std::int32_t messageThreadId = 0, - std::int32_t maxTipAmount = 0, - const std::vector& suggestedTipAmounts = std::vector(), - const std::string& startParameter = "", - bool protectContent = false) const; - - /** - * @brief Use this method to create a link for an invoice. - * - * @param title Product name, 1-32 characters - * @param description Product description, 1-255 characters - * @param payload Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - * @param providerToken Payment provider token, obtained via BotFather - * @param currency Three-letter ISO 4217 currency code, see https://core.telegram.org/bots/payments#supported-currencies - * @param prices Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - * @param maxTipAmount Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass maxTipAmount = 145. See the exp parameter in https://core.telegram.org/bots/payments/currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 - * @param suggestedTipAmounts Optional. A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed maxTipAmount. - * @param providerData Optional. JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. - * @param photoUrl Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. - * @param photoSize Optional. Photo size in bytes - * @param photoWidth Optional. Photo width - * @param photoHeight Optional. Photo height - * @param needName Optional. Pass True, if you require the user's full name to complete the order - * @param needPhoneNumber Optional. Pass True, if you require the user's phone number to complete the order - * @param needEmail Optional. Pass True, if you require the user's email address to complete the order - * @param needShippingAddress Optional. Pass True, if you require the user's shipping address to complete the order - * @param sendPhoneNumberToProvider Optional. Pass True, if the user's phone number should be sent to the provider - * @param sendEmailToProvider Optional. Pass True, if the user's email address should be sent to the provider - * @param isFlexible Optional. Pass True, if the final price depends on the shipping method - * - * @return Returns the created invoice link as String on success. - */ - std::string createInvoiceLink(const std::string& title, - const std::string& description, - const std::string& payload, - const std::string& providerToken, - const std::string& currency, - const std::vector& prices, - std::int32_t maxTipAmount = 0, - const std::vector& suggestedTipAmounts = std::vector(), - const std::string& providerData = "", - const std::string& photoUrl = "", - std::int32_t photoSize = 0, - std::int32_t photoWidth = 0, - std::int32_t photoHeight = 0, - bool needName = false, - bool needPhoneNumber = false, - bool needEmail = false, - bool needShippingAddress = false, - bool sendPhoneNumberToProvider = false, - bool sendEmailToProvider = false, - bool isFlexible = false) const; - - /** - * @brief Use this method to reply to shipping queries. - * - * If you sent an invoice requesting a shipping address and the parameter isFlexible was specified, the Bot API will send an Update with a shippingQuery field to the bot. - * - * @param shippingQueryId Unique identifier for the query to be answered - * @param ok Pass True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible) - * @param shippingOptions Optional. Required if ok is True. A JSON-serialized array of available shipping options. - * @param errorMessage Optional. Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. - * - * @return On success, True is returned. - */ - bool answerShippingQuery(const std::string& shippingQueryId, - bool ok, - const std::vector& shippingOptions = std::vector(), - const std::string& errorMessage = "") const; - - /** - * @brief Use this method to respond to such pre-checkout queries. - * - * Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field preCheckoutQuery. - * Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent. - * - * @param preCheckoutQueryId Unique identifier for the query to be answered - * @param ok Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems. - * @param errorMessage Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. - * - * @return On success, True is returned. - */ - bool answerPreCheckoutQuery(const std::string& preCheckoutQueryId, - bool ok, - const std::string& errorMessage = "") const; - - /** - * @brief Informs a user that some of the Telegram Passport elements they provided contains errors. - * - * The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). - * Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. - * For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. - * Supply some details in the error message to make sure the user knows how to correct the issues. - * - * @param userId User identifier - * @param errors A JSON-serialized array describing the errors - * - * @return Returns True on success. - */ - bool setPassportDataErrors(std::int64_t userId, - const std::vector& errors) const; - - /** - * @brief Use this method to send a game. - * - * @param chatId Unique identifier for the target chat - * @param gameShortName Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather. - * @param replyParameters Optional. Description of the message to reply to - * @param replyMarkup Optional. A JSON-serialized object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards). If empty, one 'Play gameTitle' button will be shown. If not empty, the first button must launch the game. Not supported for messages sent on behalf of a business account. - * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound. - * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving - * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent - * - * @return On success, the sent Message is returned. - */ - Message::Ptr sendGame(std::int64_t chatId, - const std::string& gameShortName, - ReplyParameters::Ptr replyParameters = nullptr, - InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared(), - bool disableNotification = false, - std::int32_t messageThreadId = 0, - bool protectContent = false, - const std::string& businessConnectionId = "") const; - - /** - * @brief Use this method to set the score of the specified user in a game message. - * - * Returns an error, if the new score is not greater than the user's current score in the chat and force is False. - * - * @param userId User identifier - * @param score New score, must be non-negative - * @param force Optional. Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters - * @param disableEditMessage Optional. Pass True if the game message should not be automatically edited to include the current scoreboard - * @param chatId Optional. Required if inlineMessageId is not specified. Unique identifier for the target chat - * @param messageId Optional. Required if inlineMessageId is not specified. Identifier of the sent message - * @param inlineMessageId Optional. Required if chatId and messageId are not specified. Identifier of the inline message - * - * @return On success, if the message is not an inline message, the Message is returned, otherwise nullptr is returned. - */ - Message::Ptr setGameScore(std::int64_t userId, - std::int32_t score, - bool force = false, - bool disableEditMessage = false, - std::int64_t chatId = 0, - std::int32_t messageId = 0, - const std::string& inlineMessageId = "") const; - - /** - * @brief Use this method to get data for high score tables. - * - * Will return the score of the specified user and several of their neighbors in a game. - * - * This method will currently return scores for the target user, plus two of their closest neighbors on each side. - * Will also return the top three users if the user and their neighbors are not among them. - * Please note that this behavior is subject to change. - * - * @param userId Target user id - * @param chatId Optional. Required if inlineMessageId is not specified. Unique identifier for the target chat - * @param messageId Optional. Required if inlineMessageId is not specified. Identifier of the sent message - * @param inlineMessageId Optional. Required if chatId and messageId are not specified. Identifier of the inline message - * - * @return Returns an Array of GameHighScore objects. - */ - std::vector getGameHighScores(std::int64_t userId, - std::int64_t chatId = 0, - std::int32_t messageId = 0, - const std::string& inlineMessageId = "") const; - /** * @brief Download a file from Telegram and save it in memory. * @@ -2226,7 +1502,7 @@ friend class Bot; * * @return File content in a string. */ - std::string downloadFile(const std::string& filePath, + std::pair downloadFile(const std::string& url, const std::vector& args = std::vector()) const; /** @@ -2241,12 +1517,12 @@ friend class Bot; const HttpClient& _httpClient; protected: - boost::property_tree::ptree sendRequest(const std::string& method, const std::vector& args = std::vector()) const; + boost::property_tree::ptree sendRequest(const std::string& urlPath, const std::string& json, const std::string& customMethod = {}) const; + boost::property_tree::ptree sendRequest(const std::string& urlPath, const std::vector& args = std::vector(), const std::string& customMethod = {}) const; - const std::string _token; - const TgTypeParser _tgTypeParser; + const BotTypeParser _botTypeParser; const std::string _url; }; } -#endif //TGBOT_API_H +#endif //MAXBOT_API_H diff --git a/include/tgbot/Bot.h b/include/maxbot/Bot.h similarity index 57% rename from include/tgbot/Bot.h rename to include/maxbot/Bot.h index 36d3cb42f..40800f900 100644 --- a/include/tgbot/Bot.h +++ b/include/maxbot/Bot.h @@ -1,14 +1,14 @@ -#ifndef TGBOT_CPP_BOT_H -#define TGBOT_CPP_BOT_H +#ifndef MAXBOT_CPP_BOT_H +#define MAXBOT_CPP_BOT_H -#include "tgbot/Api.h" -#include "tgbot/EventHandler.h" +#include "maxbot/Api.h" +#include "maxbot/EventHandler.h" #include #include #include -namespace TgBot { +namespace MaxBot { class EventBroadcaster; class HttpClient; @@ -18,17 +18,10 @@ class HttpClient; * * @ingroup general */ -class TGBOT_API Bot { +class MAXBOT_API Bot { public: - explicit Bot(std::string token, const HttpClient &httpClient = _getDefaultHttpClient(), const std::string& url="https://api.telegram.org"); - - /** - * @return Token for accessing api. - */ - inline const std::string& getToken() const { - return _token; - } + explicit Bot(const HttpClient &httpClient, const std::string& url="https://platform-api.max.ru"); /** * @return Object which can execute Telegram Bot API methods. @@ -45,16 +38,13 @@ class TGBOT_API Bot { } /** - * @return Object which handles new update objects. Usually it's only needed for TgLongPoll, TgWebhookLocalServer and TgWebhookTcpServer objects. + * @return Object which handles new update objects. Usually it's only needed for BotLongPoll, BotWebhookLocalServer and BotWebhookTcpServer objects. */ inline const EventHandler& getEventHandler() const { return _eventHandler; } private: - static HttpClient &_getDefaultHttpClient(); - - const std::string _token; const Api _api; std::unique_ptr _eventBroadcaster; const EventHandler _eventHandler; @@ -62,4 +52,4 @@ class TGBOT_API Bot { } -#endif //TGBOT_CPP_BOT_H +#endif //MAXBOT_CPP_BOT_H diff --git a/include/tgbot/TgException.h b/include/maxbot/BotException.h similarity index 65% rename from include/tgbot/TgException.h rename to include/maxbot/BotException.h index 0fbda9391..d6aca79d6 100644 --- a/include/tgbot/TgException.h +++ b/include/maxbot/BotException.h @@ -1,19 +1,19 @@ -#ifndef TGBOT_TGEXCEPTION_H -#define TGBOT_TGEXCEPTION_H +#ifndef MAXBOT_TGEXCEPTION_H +#define MAXBOT_TGEXCEPTION_H -#include "tgbot/export.h" +#include "maxbot/export.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Exception type which is only thrown when Telegram refuses API request. * * @ingroup general */ -class TGBOT_API TgException : public std::runtime_error { +class MAXBOT_API BotException : public std::runtime_error { public: @@ -28,11 +28,11 @@ class TGBOT_API TgException : public std::runtime_error { HtmlResponse = 100, InvalidJson = 101 }; - explicit TgException(const std::string& description, ErrorCode errorCode); + explicit BotException(const std::string& description, ErrorCode errorCode); const ErrorCode errorCode; }; } -#endif //TGBOT_TGEXCEPTION_H +#endif //MAXBOT_TGEXCEPTION_H diff --git a/include/maxbot/BotTypeParser.h b/include/maxbot/BotTypeParser.h new file mode 100644 index 000000000..d1e286a74 --- /dev/null +++ b/include/maxbot/BotTypeParser.h @@ -0,0 +1,601 @@ +#ifndef MAXBOT_TGTYPEPARSER_H +#define MAXBOT_TGTYPEPARSER_H + +#include "maxbot/BotTypeParserUpdates.h" +#include "maxbot/types/WebhookInfo.h" +#include "maxbot/types/Chat.h" +#include "maxbot/types/Message.h" +#include "maxbot/types/CallbackAnswer.h" +#include "maxbot/types/MessageId.h" +#include "maxbot/types/AttachmentRequest.h" +#include "maxbot/types/NewMessageBody.h" +#include "maxbot/types/InaccessibleMessage.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/TextQuote.h" +#include "maxbot/types/ExternalReplyInfo.h" +#include "maxbot/types/ReplyParameters.h" +#include "maxbot/types/MessageOrigin.h" +#include "maxbot/types/MessageOriginUser.h" +#include "maxbot/types/MessageOriginHiddenUser.h" +#include "maxbot/types/MessageOriginChat.h" +#include "maxbot/types/MessageOriginChannel.h" +#include "maxbot/types/PhotoSize.h" +#include "maxbot/types/Animation.h" +#include "maxbot/types/Audio.h" +#include "maxbot/types/Document.h" +#include "maxbot/types/Story.h" +#include "maxbot/types/Video.h" +#include "maxbot/types/VideoNote.h" +#include "maxbot/types/Voice.h" +#include "maxbot/types/Contact.h" +#include "maxbot/types/PollOption.h" +#include "maxbot/types/PollAnswer.h" +#include "maxbot/types/Poll.h" +#include "maxbot/types/Location.h" +#include "maxbot/types/WebAppData.h" +#include "maxbot/types/ProximityAlertTriggered.h" +#include "maxbot/types/MessageAutoDeleteTimerChanged.h" +#include "maxbot/types/ChatBoostAdded.h" +#include "maxbot/types/SharedUser.h" +#include "maxbot/types/UsersShared.h" +#include "maxbot/types/ChatShared.h" +#include "maxbot/types/WriteAccessAllowed.h" +#include "maxbot/types/VideoChatScheduled.h" +#include "maxbot/types/VideoChatStarted.h" +#include "maxbot/types/VideoChatEnded.h" +#include "maxbot/types/VideoChatParticipantsInvited.h" +#include "maxbot/types/GiveawayCreated.h" +#include "maxbot/types/Giveaway.h" +#include "maxbot/types/GiveawayWinners.h" +#include "maxbot/types/GiveawayCompleted.h" +#include "maxbot/types/LinkPreviewOptions.h" +#include "maxbot/types/UserProfilePhotos.h" +#include "maxbot/types/File.h" +#include "maxbot/types/WebAppInfo.h" +#include "maxbot/types/ReplyKeyboardMarkup.h" +#include "maxbot/types/KeyboardButton.h" +#include "maxbot/types/KeyboardButtonRequestUsers.h" +#include "maxbot/types/KeyboardButtonRequestChat.h" +#include "maxbot/types/KeyboardButtonPollType.h" +#include "maxbot/types/ReplyKeyboardRemove.h" +#include "maxbot/types/InlineKeyboardMarkup.h" +#include "maxbot/types/InlineKeyboardButton.h" +#include "maxbot/types/LoginUrl.h" +#include "maxbot/types/SwitchInlineQueryChosenChat.h" +#include "maxbot/types/CallbackQuery.h" +#include "maxbot/types/ForceReply.h" +#include "maxbot/types/ChatPhoto.h" +#include "maxbot/types/ChatInviteLink.h" +#include "maxbot/types/ChatAdministratorRights.h" +#include "maxbot/types/ChatMemberUpdated.h" +#include "maxbot/types/ChatMember.h" +#include "maxbot/types/ChatMemberOwner.h" +#include "maxbot/types/ChatMemberAdministrator.h" +#include "maxbot/types/ChatMemberMember.h" +#include "maxbot/types/ChatMemberRestricted.h" +#include "maxbot/types/ChatMemberLeft.h" +#include "maxbot/types/ChatMemberBanned.h" +#include "maxbot/types/ChatJoinRequest.h" +#include "maxbot/types/ChatPermissions.h" +#include "maxbot/types/Birthdate.h" +#include "maxbot/types/ChatLocation.h" +#include "maxbot/types/ReactionType.h" +#include "maxbot/types/ReactionTypeEmoji.h" +#include "maxbot/types/ReactionTypeCustomEmoji.h" +#include "maxbot/types/ReactionCount.h" +#include "maxbot/types/MessageReactionUpdated.h" +#include "maxbot/types/MessageReactionCountUpdated.h" +#include "maxbot/types/BotCommand.h" +#include "maxbot/types/BotCommandScope.h" +#include "maxbot/types/BotCommandScopeDefault.h" +#include "maxbot/types/BotCommandScopeAllPrivateChats.h" +#include "maxbot/types/BotCommandScopeAllGroupChats.h" +#include "maxbot/types/BotCommandScopeAllChatAdministrators.h" +#include "maxbot/types/BotCommandScopeChat.h" +#include "maxbot/types/BotCommandScopeChatAdministrators.h" +#include "maxbot/types/BotCommandScopeChatMember.h" +#include "maxbot/types/BotName.h" +#include "maxbot/types/BotDescription.h" +#include "maxbot/types/BotShortDescription.h" +#include "maxbot/types/MenuButton.h" +#include "maxbot/types/MenuButtonCommands.h" +#include "maxbot/types/MenuButtonWebApp.h" +#include "maxbot/types/MenuButtonDefault.h" +#include "maxbot/types/ChatBoostSource.h" +#include "maxbot/types/ChatBoostSourcePremium.h" +#include "maxbot/types/ChatBoostSourceGiftCode.h" +#include "maxbot/types/ChatBoostSourceGiveaway.h" +#include "maxbot/types/ChatBoost.h" +#include "maxbot/types/ChatBoostUpdated.h" +#include "maxbot/types/ChatBoostRemoved.h" +#include "maxbot/types/UserChatBoosts.h" +#include "maxbot/types/ResponseParameters.h" +#include "maxbot/types/InputMedia.h" +#include "maxbot/types/InputMediaPhoto.h" +#include "maxbot/types/InputMediaVideo.h" +#include "maxbot/types/InputMediaAnimation.h" +#include "maxbot/types/InputMediaAudio.h" +#include "maxbot/types/InputMediaDocument.h" +#include "maxbot/types/Sticker.h" +#include "maxbot/types/StickerSet.h" +#include "maxbot/types/MaskPosition.h" +#include "maxbot/types/InputSticker.h" +#include "maxbot/types/InlineQuery.h" +#include "maxbot/types/InlineQueryResultsButton.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/InlineQueryResultArticle.h" +#include "maxbot/types/InlineQueryResultPhoto.h" +#include "maxbot/types/InlineQueryResultGif.h" +#include "maxbot/types/InlineQueryResultMpeg4Gif.h" +#include "maxbot/types/InlineQueryResultVideo.h" +#include "maxbot/types/InlineQueryResultAudio.h" +#include "maxbot/types/InlineQueryResultVoice.h" +#include "maxbot/types/InlineQueryResultDocument.h" +#include "maxbot/types/InlineQueryResultLocation.h" +#include "maxbot/types/InlineQueryResultVenue.h" +#include "maxbot/types/InlineQueryResultContact.h" +#include "maxbot/types/InlineQueryResultGame.h" +#include "maxbot/types/InlineQueryResultCachedPhoto.h" +#include "maxbot/types/InlineQueryResultCachedGif.h" +#include "maxbot/types/InlineQueryResultCachedMpeg4Gif.h" +#include "maxbot/types/InlineQueryResultCachedSticker.h" +#include "maxbot/types/InlineQueryResultCachedDocument.h" +#include "maxbot/types/InlineQueryResultCachedVideo.h" +#include "maxbot/types/InlineQueryResultCachedVoice.h" +#include "maxbot/types/InlineQueryResultCachedAudio.h" +#include "maxbot/types/InputMessageContent.h" +#include "maxbot/types/InputTextMessageContent.h" +#include "maxbot/types/InputLocationMessageContent.h" +#include "maxbot/types/InputVenueMessageContent.h" +#include "maxbot/types/InputContactMessageContent.h" +#include "maxbot/types/InputInvoiceMessageContent.h" +#include "maxbot/types/ChosenInlineResult.h" +#include "maxbot/types/SentWebAppMessage.h" +#include "maxbot/types/LabeledPrice.h" +#include "maxbot/types/Invoice.h" +#include "maxbot/types/PreCheckoutQuery.h" +#include "maxbot/types/GenericReply.h" + +namespace MaxBot { + +class MAXBOT_API BotTypeParser : public BotTypeParserUpdates { + +public: + static WebhookInfo::Ptr parseJsonAndGetWebhookInfo(const boost::property_tree::ptree& data); + static std::string parseWebhookInfo(const WebhookInfo::Ptr& object); + + static Chat::Ptr parseJsonAndGetChat(const boost::property_tree::ptree& data); + + static std::string parseNewMessageBody(const NewMessageBody::Ptr& msg); + static std::string parseAttachmentRequest(const AttachmentRequest::Ptr& object); + static std::string parseNewMessageLink(const NewMessageLink::Ptr& object); + static std::string parseCallbackAnswer(const CallbackAnswer::Ptr& obj); + + static MessageId::Ptr parseJsonAndGetMessageId(const boost::property_tree::ptree& data); + static std::string parseMessageId(const MessageId::Ptr& object); + + static InaccessibleMessage::Ptr parseJsonAndGetInaccessibleMessage(const boost::property_tree::ptree& data); + + static MessageEntity::Ptr parseJsonAndGetMessageEntity(const boost::property_tree::ptree& data); + static std::string parseMessageEntity(const MessageEntity::Ptr& object); + + static TextQuote::Ptr parseJsonAndGetTextQuote(const boost::property_tree::ptree& data); + static std::string parseTextQuote(const TextQuote::Ptr& object); + + static ExternalReplyInfo::Ptr parseJsonAndGetExternalReplyInfo(const boost::property_tree::ptree& data); + + static ReplyParameters::Ptr parseJsonAndGetReplyParameters(const boost::property_tree::ptree& data); + static std::string parseReplyParameters(const ReplyParameters::Ptr& object); + + static MessageOrigin::Ptr parseJsonAndGetMessageOrigin(const boost::property_tree::ptree& data); + + static MessageOriginUser::Ptr parseJsonAndGetMessageOriginUser(const boost::property_tree::ptree& data); + static std::string parseMessageOriginUser(const MessageOriginUser::Ptr& object); + + static MessageOriginHiddenUser::Ptr parseJsonAndGetMessageOriginHiddenUser(const boost::property_tree::ptree& data); + static std::string parseMessageOriginHiddenUser(const MessageOriginHiddenUser::Ptr& object); + + static MessageOriginChat::Ptr parseJsonAndGetMessageOriginChat(const boost::property_tree::ptree& data); + + static MessageOriginChannel::Ptr parseJsonAndGetMessageOriginChannel(const boost::property_tree::ptree& data); + + static PhotoSize::Ptr parseJsonAndGetPhotoSize(const boost::property_tree::ptree& data); + static std::string parsePhotoSize(const PhotoSize::Ptr& object); + + static Animation::Ptr parseJsonAndGetAnimation(const boost::property_tree::ptree& data); + static std::string parseAnimation(const Animation::Ptr& object); + + static Audio::Ptr parseJsonAndGetAudio(const boost::property_tree::ptree& data); + static std::string parseAudio(const Audio::Ptr& object); + + static Document::Ptr parseJsonAndGetDocument(const boost::property_tree::ptree& data); + static std::string parseDocument(const Document::Ptr& object); + + static Story::Ptr parseJsonAndGetStory(const boost::property_tree::ptree& data); + + static Video::Ptr parseJsonAndGetVideo(const boost::property_tree::ptree& data); + static std::string parseVideo(const Video::Ptr& object); + + static VideoNote::Ptr parseJsonAndGetVideoNote(const boost::property_tree::ptree& data); + static std::string parseVideoNote(const VideoNote::Ptr& object); + + static Voice::Ptr parseJsonAndGetVoice(const boost::property_tree::ptree& data); + static std::string parseVoice(const Voice::Ptr& object); + + static Contact::Ptr parseJsonAndGetContact(const boost::property_tree::ptree& data); + static std::string parseContact(const Contact::Ptr& object); + + static PollOption::Ptr parseJsonAndGetPollOption(const boost::property_tree::ptree& data); + static std::string parsePollOption(const PollOption::Ptr& object); + + static PollAnswer::Ptr parseJsonAndGetPollAnswer(const boost::property_tree::ptree& data); + + static Poll::Ptr parseJsonAndGetPoll(const boost::property_tree::ptree& data); + static std::string parsePoll(const Poll::Ptr& object); + + static Location::Ptr parseJsonAndGetLocation(const boost::property_tree::ptree& data); + static std::string parseLocation(const Location::Ptr& object); + + static WebAppData::Ptr parseJsonAndGetWebAppData(const boost::property_tree::ptree& data); + static std::string parseWebAppData(const WebAppData::Ptr& object); + + static ProximityAlertTriggered::Ptr parseJsonAndGetProximityAlertTriggered(const boost::property_tree::ptree& data); + static std::string parseProximityAlertTriggered(const ProximityAlertTriggered::Ptr& object); + + static MessageAutoDeleteTimerChanged::Ptr parseJsonAndGetMessageAutoDeleteTimerChanged(const boost::property_tree::ptree& data); + static std::string parseMessageAutoDeleteTimerChanged(const MessageAutoDeleteTimerChanged::Ptr& object); + + static ChatBoostAdded::Ptr parseJsonAndGetChatBoostAdded(const boost::property_tree::ptree& data); + static std::string parseChatBoostAdded(const ChatBoostAdded::Ptr& object); + + static SharedUser::Ptr parseJsonAndGetSharedUser(const boost::property_tree::ptree& data); + static std::string parseSharedUser(const SharedUser::Ptr& object); + + static UsersShared::Ptr parseJsonAndGetUsersShared(const boost::property_tree::ptree& data); + static std::string parseUsersShared(const UsersShared::Ptr& object); + + static ChatShared::Ptr parseJsonAndGetChatShared(const boost::property_tree::ptree& data); + static std::string parseChatShared(const ChatShared::Ptr& object); + + static WriteAccessAllowed::Ptr parseJsonAndGetWriteAccessAllowed(const boost::property_tree::ptree& data); + static std::string parseWriteAccessAllowed(const WriteAccessAllowed::Ptr& object); + + static VideoChatScheduled::Ptr parseJsonAndGetVideoChatScheduled(const boost::property_tree::ptree& data); + static std::string parseVideoChatScheduled(const VideoChatScheduled::Ptr& object); + + static VideoChatStarted::Ptr parseJsonAndGetVideoChatStarted(const boost::property_tree::ptree& data); + static std::string parseVideoChatStarted(const VideoChatStarted::Ptr& object); + + static VideoChatEnded::Ptr parseJsonAndGetVideoChatEnded(const boost::property_tree::ptree& data); + static std::string parseVideoChatEnded(const VideoChatEnded::Ptr& object); + + static VideoChatParticipantsInvited::Ptr parseJsonAndGetVideoChatParticipantsInvited(const boost::property_tree::ptree& data); + static std::string parseVideoChatParticipantsInvited(const VideoChatParticipantsInvited::Ptr& object); + + static GiveawayCreated::Ptr parseJsonAndGetGiveawayCreated(const boost::property_tree::ptree& data); + static std::string parseGiveawayCreated(const GiveawayCreated::Ptr& object); + + static Giveaway::Ptr parseJsonAndGetGiveaway(const boost::property_tree::ptree& data); + + static GiveawayWinners::Ptr parseJsonAndGetGiveawayWinners(const boost::property_tree::ptree& data); + + static GiveawayCompleted::Ptr parseJsonAndGetGiveawayCompleted(const boost::property_tree::ptree& data); + + static LinkPreviewOptions::Ptr parseJsonAndGetLinkPreviewOptions(const boost::property_tree::ptree& data); + static std::string parseLinkPreviewOptions(const LinkPreviewOptions::Ptr& object); + + static UserProfilePhotos::Ptr parseJsonAndGetUserProfilePhotos(const boost::property_tree::ptree& data); + static std::string parseUserProfilePhotos(const UserProfilePhotos::Ptr& object); + + static File::Ptr parseJsonAndGetFile(const boost::property_tree::ptree& data); + static std::string parseFile(const File::Ptr& object); + + static WebAppInfo::Ptr parseJsonAndGetWebAppInfo(const boost::property_tree::ptree& data); + static std::string parseWebAppInfo(const WebAppInfo::Ptr& object); + + static ReplyKeyboardMarkup::Ptr parseJsonAndGetReplyKeyboardMarkup(const boost::property_tree::ptree& data); + static std::string parseReplyKeyboardMarkup(const ReplyKeyboardMarkup::Ptr& object); + + static KeyboardButton::Ptr parseJsonAndGetKeyboardButton(const boost::property_tree::ptree& data); + static std::string parseKeyboardButton(const KeyboardButton::Ptr& object); + + static KeyboardButtonRequestUsers::Ptr parseJsonAndGetKeyboardButtonRequestUsers(const boost::property_tree::ptree& data); + static std::string parseKeyboardButtonRequestUsers(const KeyboardButtonRequestUsers::Ptr& object); + + static KeyboardButtonRequestChat::Ptr parseJsonAndGetKeyboardButtonRequestChat(const boost::property_tree::ptree& data); + static std::string parseKeyboardButtonRequestChat(const KeyboardButtonRequestChat::Ptr& object); + + static KeyboardButtonPollType::Ptr parseJsonAndGetKeyboardButtonPollType(const boost::property_tree::ptree& data); + static std::string parseKeyboardButtonPollType(const KeyboardButtonPollType::Ptr& object); + + static ReplyKeyboardRemove::Ptr parseJsonAndGetReplyKeyboardRemove(const boost::property_tree::ptree& data); + static std::string parseReplyKeyboardRemove(const ReplyKeyboardRemove::Ptr& object); + + static InlineKeyboardMarkup::Ptr parseJsonAndGetInlineKeyboardMarkup(const boost::property_tree::ptree& data); + static std::string parseInlineKeyboardMarkup(const InlineKeyboardMarkup::Ptr& object); + + static InlineKeyboardButton::Ptr parseJsonAndGetInlineKeyboardButton(const boost::property_tree::ptree& data); + static std::string parseInlineKeyboardButton(const InlineKeyboardButton::Ptr& object); + + static LoginUrl::Ptr parseJsonAndGetLoginUrl(const boost::property_tree::ptree& data); + static std::string parseLoginUrl(const LoginUrl::Ptr& object); + + static SwitchInlineQueryChosenChat::Ptr parseJsonAndGetSwitchInlineQueryChosenChat(const boost::property_tree::ptree& data); + static std::string parseSwitchInlineQueryChosenChat(const SwitchInlineQueryChosenChat::Ptr& object); + + static CallbackQuery::Ptr parseJsonAndGetCallbackQuery(const boost::property_tree::ptree& data); + + static ForceReply::Ptr parseJsonAndGetForceReply(const boost::property_tree::ptree& data); + static std::string parseForceReply(const ForceReply::Ptr& object); + + static ChatPhoto::Ptr parseJsonAndGetChatPhoto(const boost::property_tree::ptree& data); + static std::string parseChatPhoto(const ChatPhoto::Ptr& object); + + static ChatInviteLink::Ptr parseJsonAndGetChatInviteLink(const boost::property_tree::ptree& data); + static std::string parseChatInviteLink(const ChatInviteLink::Ptr& object); + + static ChatAdministratorRights::Ptr parseJsonAndGetChatAdministratorRights(const boost::property_tree::ptree& data); + static std::string parseChatAdministratorRights(const ChatAdministratorRights::Ptr& object); + + static ChatMemberUpdated::Ptr parseJsonAndGetChatMemberUpdated(const boost::property_tree::ptree& data); + + static ChatMember::Ptr parseJsonAndGetChatMember(const boost::property_tree::ptree& data); + static std::string parseChatMember(const ChatMember::Ptr& object); + + static ChatMemberOwner::Ptr parseJsonAndGetChatMemberOwner(const boost::property_tree::ptree& data); + static std::string parseChatMemberOwner(const ChatMemberOwner::Ptr& object); + + static ChatMemberAdministrator::Ptr parseJsonAndGetChatMemberAdministrator(const boost::property_tree::ptree& data); + static std::string parseChatMemberAdministrator(const ChatMemberAdministrator::Ptr& object); + + static ChatMemberMember::Ptr parseJsonAndGetChatMemberMember(const boost::property_tree::ptree& data); + static std::string parseChatMemberMember(const ChatMemberMember::Ptr& object); + + static ChatMemberRestricted::Ptr parseJsonAndGetChatMemberRestricted(const boost::property_tree::ptree& data); + static std::string parseChatMemberRestricted(const ChatMemberRestricted::Ptr& object); + + static ChatMemberLeft::Ptr parseJsonAndGetChatMemberLeft(const boost::property_tree::ptree& data); + static std::string parseChatMemberLeft(const ChatMemberLeft::Ptr& object); + + static ChatMemberBanned::Ptr parseJsonAndGetChatMemberBanned(const boost::property_tree::ptree& data); + static std::string parseChatMemberBanned(const ChatMemberBanned::Ptr& object); + + static ChatJoinRequest::Ptr parseJsonAndGetChatJoinRequest(const boost::property_tree::ptree& data); + + static ChatPermissions::Ptr parseJsonAndGetChatPermissions(const boost::property_tree::ptree& data); + static std::string parseChatPermissions(const ChatPermissions::Ptr& object); + + static Birthdate::Ptr parseJsonAndGetBirthdate(const boost::property_tree::ptree& data); + static std::string parseBirthdate(const Birthdate::Ptr& object); + + static ChatLocation::Ptr parseJsonAndGetChatLocation(const boost::property_tree::ptree& data); + static std::string parseChatLocation(const ChatLocation::Ptr& object); + + static ReactionType::Ptr parseJsonAndGetReactionType(const boost::property_tree::ptree& data); + static std::string parseReactionType(const ReactionType::Ptr& object); + + static ReactionTypeEmoji::Ptr parseJsonAndGetReactionTypeEmoji(const boost::property_tree::ptree& data); + static std::string parseReactionTypeEmoji(const ReactionTypeEmoji::Ptr& object); + + static ReactionTypeCustomEmoji::Ptr parseJsonAndGetReactionTypeCustomEmoji(const boost::property_tree::ptree& data); + static std::string parseReactionTypeCustomEmoji(const ReactionTypeCustomEmoji::Ptr& object); + + static ReactionCount::Ptr parseJsonAndGetReactionCount(const boost::property_tree::ptree& data); + static std::string parseReactionCount(const ReactionCount::Ptr& object); + + static MessageReactionUpdated::Ptr parseJsonAndGetMessageReactionUpdated(const boost::property_tree::ptree& data); + + static MessageReactionCountUpdated::Ptr parseJsonAndGetMessageReactionCountUpdated(const boost::property_tree::ptree& data); + + static BotCommand::Ptr parseJsonAndGetBotCommand(const boost::property_tree::ptree& data); + static std::string parseBotCommand(const BotCommand::Ptr& object); + + static BotCommandScope::Ptr parseJsonAndGetBotCommandScope(const boost::property_tree::ptree& data); + static std::string parseBotCommandScope(const BotCommandScope::Ptr& object); + + static BotCommandScopeDefault::Ptr parseJsonAndGetBotCommandScopeDefault(const boost::property_tree::ptree& data); + static std::string parseBotCommandScopeDefault(const BotCommandScopeDefault::Ptr& object); + + static BotCommandScopeAllPrivateChats::Ptr parseJsonAndGetBotCommandScopeAllPrivateChats(const boost::property_tree::ptree& data); + static std::string parseBotCommandScopeAllPrivateChats(const BotCommandScopeAllPrivateChats::Ptr& object); + + static BotCommandScopeAllGroupChats::Ptr parseJsonAndGetBotCommandScopeAllGroupChats(const boost::property_tree::ptree& data); + static std::string parseBotCommandScopeAllGroupChats(const BotCommandScopeAllGroupChats::Ptr& object); + + static BotCommandScopeAllChatAdministrators::Ptr parseJsonAndGetBotCommandScopeAllChatAdministrators(const boost::property_tree::ptree& data); + static std::string parseBotCommandScopeAllChatAdministrators(const BotCommandScopeAllChatAdministrators::Ptr& object); + + static BotCommandScopeChat::Ptr parseJsonAndGetBotCommandScopeChat(const boost::property_tree::ptree& data); + static std::string parseBotCommandScopeChat(const BotCommandScopeChat::Ptr& object); + + static BotCommandScopeChatAdministrators::Ptr parseJsonAndGetBotCommandScopeChatAdministrators(const boost::property_tree::ptree& data); + static std::string parseBotCommandScopeChatAdministrators(const BotCommandScopeChatAdministrators::Ptr& object); + + static BotCommandScopeChatMember::Ptr parseJsonAndGetBotCommandScopeChatMember(const boost::property_tree::ptree& data); + static std::string parseBotCommandScopeChatMember(const BotCommandScopeChatMember::Ptr& object); + + static BotName::Ptr parseJsonAndGetBotName(const boost::property_tree::ptree& data); + static std::string parseBotName(const BotName::Ptr& object); + + static BotDescription::Ptr parseJsonAndGetBotDescription(const boost::property_tree::ptree& data); + static std::string parseBotDescription(const BotDescription::Ptr& object); + + static BotShortDescription::Ptr parseJsonAndGetBotShortDescription(const boost::property_tree::ptree& data); + static std::string parseBotShortDescription(const BotShortDescription::Ptr& object); + + static MenuButton::Ptr parseJsonAndGetMenuButton(const boost::property_tree::ptree& data); + static std::string parseMenuButton(const MenuButton::Ptr& object); + + static MenuButtonCommands::Ptr parseJsonAndGetMenuButtonCommands(const boost::property_tree::ptree& data); + static std::string parseMenuButtonCommands(const MenuButtonCommands::Ptr& object); + + static MenuButtonWebApp::Ptr parseJsonAndGetMenuButtonWebApp(const boost::property_tree::ptree& data); + static std::string parseMenuButtonWebApp(const MenuButtonWebApp::Ptr& object); + + static MenuButtonDefault::Ptr parseJsonAndGetMenuButtonDefault(const boost::property_tree::ptree& data); + static std::string parseMenuButtonDefault(const MenuButtonDefault::Ptr& object); + + static ChatBoostSource::Ptr parseJsonAndGetChatBoostSource(const boost::property_tree::ptree& data); + static std::string parseChatBoostSource(const ChatBoostSource::Ptr& object); + + static ChatBoostSourcePremium::Ptr parseJsonAndGetChatBoostSourcePremium(const boost::property_tree::ptree& data); + static std::string parseChatBoostSourcePremium(const ChatBoostSourcePremium::Ptr& object); + + static ChatBoostSourceGiftCode::Ptr parseJsonAndGetChatBoostSourceGiftCode(const boost::property_tree::ptree& data); + static std::string parseChatBoostSourceGiftCode(const ChatBoostSourceGiftCode::Ptr& object); + + static ChatBoostSourceGiveaway::Ptr parseJsonAndGetChatBoostSourceGiveaway(const boost::property_tree::ptree& data); + static std::string parseChatBoostSourceGiveaway(const ChatBoostSourceGiveaway::Ptr& object); + + static ChatBoost::Ptr parseJsonAndGetChatBoost(const boost::property_tree::ptree& data); + static std::string parseChatBoost(const ChatBoost::Ptr& object); + + static ChatBoostUpdated::Ptr parseJsonAndGetChatBoostUpdated(const boost::property_tree::ptree& data); + + static ChatBoostRemoved::Ptr parseJsonAndGetChatBoostRemoved(const boost::property_tree::ptree& data); + + static UserChatBoosts::Ptr parseJsonAndGetUserChatBoosts(const boost::property_tree::ptree& data); + static std::string parseUserChatBoosts(const UserChatBoosts::Ptr& object); + + static ResponseParameters::Ptr parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data); + static std::string parseResponseParameters(const ResponseParameters::Ptr& object); + + static InputMedia::Ptr parseJsonAndGetInputMedia(const boost::property_tree::ptree& data); + static std::string parseInputMedia(const InputMedia::Ptr& object); + + static InputMediaPhoto::Ptr parseJsonAndGetInputMediaPhoto(const boost::property_tree::ptree& data); + static std::string parseInputMediaPhoto(const InputMediaPhoto::Ptr& object); + + static InputMediaVideo::Ptr parseJsonAndGetInputMediaVideo(const boost::property_tree::ptree& data); + static std::string parseInputMediaVideo(const InputMediaVideo::Ptr& object); + + static InputMediaAnimation::Ptr parseJsonAndGetInputMediaAnimation(const boost::property_tree::ptree& data); + static std::string parseInputMediaAnimation(const InputMediaAnimation::Ptr& object); + + static InputMediaAudio::Ptr parseJsonAndGetInputMediaAudio(const boost::property_tree::ptree& data); + static std::string parseInputMediaAudio(const InputMediaAudio::Ptr& object); + + static InputMediaDocument::Ptr parseJsonAndGetInputMediaDocument(const boost::property_tree::ptree& data); + static std::string parseInputMediaDocument(const InputMediaDocument::Ptr& object); + + static Sticker::Ptr parseJsonAndGetSticker(const boost::property_tree::ptree& data); + static std::string parseSticker(const Sticker::Ptr& object); + + static StickerSet::Ptr parseJsonAndGetStickerSet(const boost::property_tree::ptree& data); + static std::string parseStickerSet(const StickerSet::Ptr& object); + + static MaskPosition::Ptr parseJsonAndGetMaskPosition(const boost::property_tree::ptree& data); + static std::string parseMaskPosition(const MaskPosition::Ptr& object); + + static InputSticker::Ptr parseJsonAndGetInputSticker(const boost::property_tree::ptree& data); + static std::string parseInputSticker(const InputSticker::Ptr& object); + + static InlineQuery::Ptr parseJsonAndGetInlineQuery(const boost::property_tree::ptree& data); + static std::string parseInlineQuery(const InlineQuery::Ptr& object); + + static InlineQueryResultsButton::Ptr parseJsonAndGetInlineQueryResultsButton(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultsButton(const InlineQueryResultsButton::Ptr& object); + + static InlineQueryResult::Ptr parseJsonAndGetInlineQueryResult(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResult(const InlineQueryResult::Ptr& object); + + static InlineQueryResultArticle::Ptr parseJsonAndGetInlineQueryResultArticle(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultArticle(const InlineQueryResultArticle::Ptr& object); + + static InlineQueryResultPhoto::Ptr parseJsonAndGetInlineQueryResultPhoto(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultPhoto(const InlineQueryResultPhoto::Ptr& object); + + static InlineQueryResultGif::Ptr parseJsonAndGetInlineQueryResultGif(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultGif(const InlineQueryResultGif::Ptr& object); + + static InlineQueryResultMpeg4Gif::Ptr parseJsonAndGetInlineQueryResultMpeg4Gif(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultMpeg4Gif(const InlineQueryResultMpeg4Gif::Ptr& object); + + static InlineQueryResultVideo::Ptr parseJsonAndGetInlineQueryResultVideo(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultVideo(const InlineQueryResultVideo::Ptr& object); + + static InlineQueryResultAudio::Ptr parseJsonAndGetInlineQueryResultAudio(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultAudio(const InlineQueryResultAudio::Ptr& object); + + static InlineQueryResultVoice::Ptr parseJsonAndGetInlineQueryResultVoice(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultVoice(const InlineQueryResultVoice::Ptr& object); + + static InlineQueryResultDocument::Ptr parseJsonAndGetInlineQueryResultDocument(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultDocument(const InlineQueryResultDocument::Ptr& object); + + static InlineQueryResultLocation::Ptr parseJsonAndGetInlineQueryResultLocation(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultLocation(const InlineQueryResultLocation::Ptr& object); + + static InlineQueryResultVenue::Ptr parseJsonAndGetInlineQueryResultVenue(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultVenue(const InlineQueryResultVenue::Ptr& object); + + static InlineQueryResultContact::Ptr parseJsonAndGetInlineQueryResultContact(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultContact(const InlineQueryResultContact::Ptr& object); + + static InlineQueryResultGame::Ptr parseJsonAndGetInlineQueryResultGame(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultGame(const InlineQueryResultGame::Ptr& object); + + static InlineQueryResultCachedPhoto::Ptr parseJsonAndGetInlineQueryResultCachedPhoto(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultCachedPhoto(const InlineQueryResultCachedPhoto::Ptr& object); + + static InlineQueryResultCachedGif::Ptr parseJsonAndGetInlineQueryResultCachedGif(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultCachedGif(const InlineQueryResultCachedGif::Ptr& object); + + static InlineQueryResultCachedMpeg4Gif::Ptr parseJsonAndGetInlineQueryResultCachedMpeg4Gif(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultCachedMpeg4Gif(const InlineQueryResultCachedMpeg4Gif::Ptr& object); + + static InlineQueryResultCachedSticker::Ptr parseJsonAndGetInlineQueryResultCachedSticker(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultCachedSticker(const InlineQueryResultCachedSticker::Ptr& object); + + static InlineQueryResultCachedDocument::Ptr parseJsonAndGetInlineQueryResultCachedDocument(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultCachedDocument(const InlineQueryResultCachedDocument::Ptr& object); + + static InlineQueryResultCachedVideo::Ptr parseJsonAndGetInlineQueryResultCachedVideo(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultCachedVideo(const InlineQueryResultCachedVideo::Ptr& object); + + static InlineQueryResultCachedVoice::Ptr parseJsonAndGetInlineQueryResultCachedVoice(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultCachedVoice(const InlineQueryResultCachedVoice::Ptr& object); + + static InlineQueryResultCachedAudio::Ptr parseJsonAndGetInlineQueryResultCachedAudio(const boost::property_tree::ptree& data); + static std::string parseInlineQueryResultCachedAudio(const InlineQueryResultCachedAudio::Ptr& object); + + static InputMessageContent::Ptr parseJsonAndGetInputMessageContent(const boost::property_tree::ptree& data); + static std::string parseInputMessageContent(const InputMessageContent::Ptr& object); + + static InputTextMessageContent::Ptr parseJsonAndGetInputTextMessageContent(const boost::property_tree::ptree& data); + static std::string parseInputTextMessageContent(const InputTextMessageContent::Ptr& object); + + static InputLocationMessageContent::Ptr parseJsonAndGetInputLocationMessageContent(const boost::property_tree::ptree& data); + static std::string parseInputLocationMessageContent(const InputLocationMessageContent::Ptr& object); + + static InputVenueMessageContent::Ptr parseJsonAndGetInputVenueMessageContent(const boost::property_tree::ptree& data); + static std::string parseInputVenueMessageContent(const InputVenueMessageContent::Ptr& object); + + static InputContactMessageContent::Ptr parseJsonAndGetInputContactMessageContent(const boost::property_tree::ptree& data); + static std::string parseInputContactMessageContent(const InputContactMessageContent::Ptr& object); + + static InputInvoiceMessageContent::Ptr parseJsonAndGetInputInvoiceMessageContent(const boost::property_tree::ptree& data); + static std::string parseInputInvoiceMessageContent(const InputInvoiceMessageContent::Ptr& object); + + static ChosenInlineResult::Ptr parseJsonAndGetChosenInlineResult(const boost::property_tree::ptree& data); + static std::string parseChosenInlineResult(const ChosenInlineResult::Ptr& object); + + static SentWebAppMessage::Ptr parseJsonAndGetSentWebAppMessage(const boost::property_tree::ptree& data); + static std::string parseSentWebAppMessage(const SentWebAppMessage::Ptr& object); + + static LabeledPrice::Ptr parseJsonAndGetLabeledPrice(const boost::property_tree::ptree& data); + static std::string parseLabeledPrice(const LabeledPrice::Ptr& object); + + static Invoice::Ptr parseJsonAndGetInvoice(const boost::property_tree::ptree& data); + static std::string parseInvoice(const Invoice::Ptr& object); + + static PreCheckoutQuery::Ptr parseJsonAndGetPreCheckoutQuery(const boost::property_tree::ptree& data); + static std::string parsePreCheckoutQuery(const PreCheckoutQuery::Ptr& object); + + static GenericReply::Ptr parseJsonAndGetGenericReply(const boost::property_tree::ptree& data); + static std::string parseGenericReply(const GenericReply::Ptr& object); +}; + +} + +#endif //MAXBOT_TGTYPEPARSER_H diff --git a/include/maxbot/BotTypeParserBase.h b/include/maxbot/BotTypeParserBase.h new file mode 100644 index 000000000..23de78d0f --- /dev/null +++ b/include/maxbot/BotTypeParserBase.h @@ -0,0 +1,203 @@ +#pragma once + +#include "maxbot/export.h" + +#include +#include + +#include +#include +#include +#include +#include + +namespace MaxBot { + +class MAXBOT_API BotTypeParserBase { + +public: + template + using JsonToBotTypeFunc = std::shared_ptr (*)(const boost::property_tree::ptree&); + + template + using BotTypeToJsonFunc = std::string (*)(const std::shared_ptr&); + + static inline boost::property_tree::ptree parseJson(const std::string& json) { + boost::property_tree::ptree tree; + std::istringstream input(json); + boost::property_tree::read_json(input, tree); + return tree; + } + + template + static std::shared_ptr tryParseJson(JsonToBotTypeFunc parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) { + auto treeItem = data.find(keyName); + if (treeItem == data.not_found()) { + return std::shared_ptr(); + } + return parseFunc(treeItem->second); + } + + template + static std::vector> parseJsonAndGetArray(JsonToBotTypeFunc parseFunc, const boost::property_tree::ptree& data) { + std::vector> result; + result.reserve(data.size()); + for (const std::pair& innerTreeItem : data) { + result.push_back(parseFunc(innerTreeItem.second)); + } + return result; + } + + template + static std::vector parseJsonAndGetArray(std::function parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) { + std::vector result; + auto treeItem = data.find(keyName); + if (treeItem == data.not_found()) { + return result; + } + result.reserve(treeItem->second.size()); + for (const std::pair& innerTreeItem : treeItem->second) { + result.push_back(parseFunc(innerTreeItem.second)); + } + return result; + } + + template + static std::vector> parseJsonAndGetArray(JsonToBotTypeFunc parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) { + std::vector> result; + auto treeItem = data.find(keyName); + if (treeItem == data.not_found()) { + return result; + } + result.reserve(treeItem->second.size()); + for (const std::pair& innerTreeItem : treeItem->second) { + result.push_back(parseFunc(innerTreeItem.second)); + } + return result; + } + + template + static std::vector>> parseJsonAndGet2DArray(JsonToBotTypeFunc parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) { + std::vector>> result; + auto treeItem = data.find(keyName); + if (treeItem == data.not_found()) { + return result; + } + result.reserve(treeItem->second.size()); + for (const std::pair& innerTreeItem : treeItem->second) { + std::vector> innerResult; + for (const std::pair& innerInnerTreeItem : innerTreeItem.second) { + innerResult.push_back(parseFunc(innerInnerTreeItem.second)); + } + result.push_back(innerResult); + } + return result; + } + + template + static std::string parseArray(BotTypeToJsonFunc parseFunc, const std::vector>& objects) { + if (objects.empty()) + return ""; + std::string result; + result += '['; + for (const std::shared_ptr& item : objects) { + result += parseFunc(item); + result += ','; + } + result.erase(result.length() - 1); + result += ']'; + return result; + } + + template + static std::string parseArray(std::function parseFunc, const std::vector& objects) { + if (objects.empty()) + return ""; + std::string result; + result += '['; + for (const T& item : objects) { + result += parseFunc(item); + result += ','; + } + result.erase(result.length() - 1); + result += ']'; + return result; + } + + template + static std::string parse2DArray(BotTypeToJsonFunc parseFunc, const std::vector>>& objects) { + if (objects.empty()) + return ""; + std::string result; + result += '['; + for (const std::vector>& item : objects) { + result += parseArray(parseFunc, item); + result += ','; + } + result.erase(result.length() - 1); + result += ']'; + return result; + } + + static inline void removeLastComma(std::string& input) { + input.erase(input.length() - 1); + } + + template + static inline void appendToJson(std::string& json, const std::string& varName, const std::shared_ptr& value) { + if (value == nullptr) { + return; + } + json += '"'; + json += varName; + json += R"(":)"; + json += value; + json += ','; + } + + template + static inline void appendToJson(std::string& json, const std::string& varName, const T& value) { + json += '"'; + json += varName; + json += R"(":)"; + json += value; + json += ','; + } + + template + static inline void appendToJsonNumber(std::string& json, const std::string& varName, const T& value) { + json += '"'; + json += varName; + json += R"(":)"; + json += std::to_string(value); + json += ','; + } + + static inline void appendToJson(std::string &json, const std::string &varName, const int &value) { appendToJsonNumber(json, varName, value); } + static inline void appendToJson(std::string &json, const std::string &varName, const long &value) { appendToJsonNumber(json, varName, value); } + static inline void appendToJson(std::string &json, const std::string &varName, const long long &value) { appendToJsonNumber(json, varName, value); } + static inline void appendToJson(std::string &json, const std::string &varName, const unsigned &value) { appendToJsonNumber(json, varName, value); } + static inline void appendToJson(std::string &json, const std::string &varName, const unsigned long &value) { appendToJsonNumber(json, varName, value); } + static inline void appendToJson(std::string &json, const std::string &varName, const unsigned long long &value) { appendToJsonNumber(json, varName, value); } + static inline void appendToJson(std::string &json, const std::string &varName, const float &value) { appendToJsonNumber(json, varName, value); } + static inline void appendToJson(std::string &json, const std::string &varName, const double &value) { appendToJsonNumber(json, varName, value); } + static inline void appendToJson(std::string &json, const std::string &varName, const long double &value) { appendToJsonNumber(json, varName, value); } + + static inline void appendToJson(std::string& json, const std::string& varName, const bool& value) { + json += '"'; + json += varName; + json += R"(":)"; + json += (value ? "true" : "false"); + json += ','; + } + + static inline void appendToJson(std::string& json, const std::string& varName, const char* value) { + if (value != nullptr){ + std::string strValue(value); + appendToJson(json, varName, strValue); + } + } + + static void appendToJson(std::string& json, const std::string& varName, const std::string& value); +}; +} diff --git a/include/maxbot/BotTypeParserUpdates.h b/include/maxbot/BotTypeParserUpdates.h new file mode 100644 index 000000000..dd7620913 --- /dev/null +++ b/include/maxbot/BotTypeParserUpdates.h @@ -0,0 +1,73 @@ +#pragma once + +#include "maxbot/export.h" +#include "maxbot/types/Updates.h" +#include "maxbot/BotTypeParserBase.h" + +namespace MaxBot { + +class MAXBOT_API BotTypeParserUpdates : public BotTypeParserBase { + +public: + static Updates::Ptr parseJsonAndGetUpdates(const boost::property_tree::ptree& data); + + static Update::Ptr parseJsonAndGetUpdate(const boost::property_tree::ptree& data); + static UpdateBotAddedToChat::Ptr parseJsonAndGetUpdateBotAddedToChat(const boost::property_tree::ptree& data); + static UpdateBotStarted::Ptr parseJsonAndGetUpdateBotStarted(const boost::property_tree::ptree& data); + static UpdateBotStopped::Ptr parseJsonAndGetUpdateBotStopped(const boost::property_tree::ptree& data); + static UpdateBotRemovedFromChat::Ptr parseJsonAndGetUpdateBotRemovedFromChat(const boost::property_tree::ptree& data); + static UpdateChatTitleChanged::Ptr parseJsonAndGetUpdateChatTitleChanged(const boost::property_tree::ptree& data); + static UpdateDialogCleared::Ptr parseJsonAndGetUpdateDialogCleared(const boost::property_tree::ptree& data); + static UpdateDialogMuted::Ptr parseJsonAndGetUpdateDialogMuted(const boost::property_tree::ptree& data); + static UpdateDialogUnmuted::Ptr parseJsonAndGetUpdateDialogUnmuted(const boost::property_tree::ptree& data); + static UpdateDialogRemoved::Ptr parseJsonAndGetUpdateDialogRemoved(const boost::property_tree::ptree& data); + static UpdateMessageCallback::Ptr parseJsonAndGetUpdateMessageCallback(const boost::property_tree::ptree& data); + static UpdateMessageCreated::Ptr parseJsonAndGetUpdateMessageCreated(const boost::property_tree::ptree& data); + static UpdateMessageEdited::Ptr parseJsonAndGetUpdateMessageEdited(const boost::property_tree::ptree& data); + static UpdateMessageRemoved::Ptr parseJsonAndGetUpdateMessageRemoved(const boost::property_tree::ptree& data); + static UpdateUserAddedToChat::Ptr parseJsonAndGetUpdateUserAddedToChat(const boost::property_tree::ptree& data); + static UpdateUserRemovedFromChat::Ptr parseJsonAndGetUpdateUserRemovedFromChat(const boost::property_tree::ptree& data); + + static Message::Ptr parseJsonAndGetMessage(const boost::property_tree::ptree& data); + + static Callback::Ptr parseJsonAndGetCallback(const boost::property_tree::ptree& data); + static Recipient::Ptr parseJsonAndGetRecipient(const boost::property_tree::ptree& data); + static MessageStat::Ptr parseJsonAndGetMessageStat(const boost::property_tree::ptree& data); + static AttachmentPayload::Ptr parseJsonAndGetAttachmentPayload(const boost::property_tree::ptree& data); + static PhotoAttachmentPayload::Ptr parseJsonAndGetPhotoAttachmentPayload(const boost::property_tree::ptree& data); + static MediaAttachmentPayload::Ptr parseJsonAndGetMediaAttachmentPayload(const boost::property_tree::ptree& data); + static FileAttachmentPayload::Ptr parseJsonAndGetFileAttachmentPayload(const boost::property_tree::ptree& data); + static ContactAttachmentPayload::Ptr parseJsonAndGetContactAttachmentPayload(const boost::property_tree::ptree& data); + static StickerAttachmentPayload::Ptr parseJsonAndGetStickerAttachmentPayload(const boost::property_tree::ptree& data); + static ShareAttachmentPayload::Ptr parseJsonAndGetShareAttachmentPayload(const boost::property_tree::ptree& data); + static VideoThumbnail::Ptr parseJsonAndGetVideoThumbnail(const boost::property_tree::ptree& data); + static PhotoAttachment::Ptr parseJsonAndGetPhotoAttachment(const boost::property_tree::ptree& data); + static VideoAttachment::Ptr parseJsonAndGetVideoAttachment(const boost::property_tree::ptree& data); + static AudioAttachment::Ptr parseJsonAndGetAudioAttachment(const boost::property_tree::ptree& data); + static FileAttachment::Ptr parseJsonAndGetFileAttachment(const boost::property_tree::ptree& data); + static StickerAttachment::Ptr parseJsonAndGetStickerAttachment(const boost::property_tree::ptree& data); + static ContactAttachment::Ptr parseJsonAndGetContactAttachment(const boost::property_tree::ptree& data); + static ShareAttachment::Ptr parseJsonAndGetShareAttachment(const boost::property_tree::ptree& data); + static LocationAttachment::Ptr parseJsonAndGetLocationAttachment(const boost::property_tree::ptree& data); + static CallbackButton::Ptr parseJsonAndGetCallbackButton(const boost::property_tree::ptree& data); + static LinkButton::Ptr parseJsonAndGetLinkButton(const boost::property_tree::ptree& data); + static RequestGeoLocationButton::Ptr parseJsonAndGetRequestGeoLocationButton(const boost::property_tree::ptree& data); + static RequestContactButton::Ptr parseJsonAndGetRequestContactButton(const boost::property_tree::ptree& data); + static OpenAppButton::Ptr parseJsonAndGetOpenAppButton(const boost::property_tree::ptree& data); + static MessageButton::Ptr parseJsonAndGetMessageButton(const boost::property_tree::ptree& data); + static ClipboardButton::Ptr parseJsonAndGetClipboardButton(const boost::property_tree::ptree& data); + static Button::Ptr parseJsonAndGetButton(const boost::property_tree::ptree& data); + static Keyboard::Ptr parseJsonAndGetKeyboard(const boost::property_tree::ptree& data); + static InlineKeyboardAttachment::Ptr parseJsonAndGetInlineKeyboardAttachment(const boost::property_tree::ptree& data); + static Attachment::Ptr parseJsonAndGetAttachment(const boost::property_tree::ptree& data); + static LinkMarkup::Ptr parseJsonAndGetLinkMarkup(const boost::property_tree::ptree& data); + static UserMentionMarkup::Ptr parseJsonAndGetUserMentionMarkup(const boost::property_tree::ptree& data); + static MarkupElement::Ptr parseJsonAndGetMarkupElement(const boost::property_tree::ptree& data); + static MessageBody::Ptr parseJsonAndGetMessageBody(const boost::property_tree::ptree& data); + static LinkedMessage::Ptr parseJsonAndGetLinkedMessage(const boost::property_tree::ptree& data); + + static User::Ptr parseJsonAndGetUser(const boost::property_tree::ptree& data); + static std::string parseUser(const User::Ptr& object); +}; + +} diff --git a/include/maxbot/EventBroadcaster.h b/include/maxbot/EventBroadcaster.h new file mode 100644 index 000000000..a2b07c9e5 --- /dev/null +++ b/include/maxbot/EventBroadcaster.h @@ -0,0 +1,334 @@ +#ifndef MAXBOT_EVENTBROADCASTER_H +#define MAXBOT_EVENTBROADCASTER_H + +#include "maxbot/export.h" +#include "maxbot/types/Message.h" +#include "maxbot/types/UpdateBotAddedToChat.h" +#include "maxbot/types/UpdateBotStarted.h" +#include "maxbot/types/UpdateBotStopped.h" +#include "maxbot/types/UpdateBotRemovedFromChat.h" +#include "maxbot/types/UpdateChatTitleChanged.h" +#include "maxbot/types/UpdateDialogCleared.h" +#include "maxbot/types/UpdateDialogMuted.h" +#include "maxbot/types/UpdateDialogUnmuted.h" +#include "maxbot/types/UpdateDialogRemoved.h" +#include "maxbot/types/UpdateMessageCallback.h" +#include "maxbot/types/UpdateMessageRemoved.h" +#include "maxbot/types/UpdateUserAddedToChat.h" +#include "maxbot/types/UpdateUserRemovedFromChat.h" + +#include +#include +#include +#include +#include + +namespace MaxBot { + +class EventHandler; + +/** + * @brief This class holds all event listeners. + * + * @ingroup general + */ +class MAXBOT_API EventBroadcaster { + +friend EventHandler; + +public: + typedef std::function MessageListener; + typedef std::function UpdateBotAddedToChatListener; + typedef std::function UpdateBotStartedListener; + typedef std::function UpdateBotStoppedListener; + typedef std::function UpdateBotRemovedFromChatListener; + typedef std::function UpdateChatTitleChangedListener; + typedef std::function UpdateDialogClearedListener; + typedef std::function UpdateDialogMutedListener; + typedef std::function UpdateDialogUnmutedListener; + typedef std::function UpdateDialogRemovedListener; + typedef std::function MessageCallbackListener; + typedef std::function UpdateMessageRemovedListener; + typedef std::function UpdateUserAddedToChatListener; + typedef std::function UpdateUserRemovedFromChatListener; + + /** + * @brief Registers listener which receives new incoming message of any kind - text, photo, sticker, etc. + * @param listener Listener. + */ + inline void onAnyMessage(const MessageListener& listener) { + _onAnyMessageListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives all messages with commands (messages with leading '/' char). + * @param commandName Command name which listener can handle. + * @param listener Listener. Pass nullptr to remove listener of command + */ + inline void onCommand(const std::string& commandName, const MessageListener& listener) { + if (listener) { + _onCommandListeners[commandName] = listener; + } else { + _onCommandListeners.erase(commandName); + } + } + + /** + * @brief Registers listener which receives all messages with commands (messages with leading '/' char). + * @param commandsList Commands names which listener can handle. + * @param listener Listener. Pass nullptr to remove listener of commands + */ + inline void onCommand(const std::initializer_list& commandsList, const MessageListener& listener) { + if (listener) { + for (const auto& command : commandsList) { + _onCommandListeners[command] = listener; + } + } else { + for (const auto& command : commandsList) { + _onCommandListeners.erase(command); + } + } + } + + /** + * @brief Registers listener which receives all messages with commands (messages with leading '/' char) which haven't been handled by other listeners. + * @param listener Listener. + */ + inline void onUnknownCommand(const MessageListener& listener) { + _onUnknownCommandListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives all messages without commands (messages with no leading '/' char) + * @param listener Listener. + */ + inline void onNonCommandMessage(const MessageListener& listener) { + _onNonCommandMessageListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives new versions of a message that is known to the bot and was edited + * @param listener Listener. + */ + inline void onEditedMessage(const MessageListener& listener) { + _onEditedMessageListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when bot is added to a chat or channel. + * @param listener Listener. + */ + inline void onBotAddedToChat(const UpdateBotAddedToChatListener& listener) { + _onBotAddedToChatListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when user presses the Start button. + * @param listener Listener. + */ + inline void onBotStarted(const UpdateBotStartedListener& listener) { + _onBotStartedListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when user stops the bot. + * @param listener Listener. + */ + inline void onBotStopped(const UpdateBotStoppedListener& listener) { + _onBotStoppedListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when bot is removed from a chat or channel. + * @param listener Listener. + */ + inline void onBotRemovedFromChat(const UpdateBotRemovedFromChatListener& listener) { + _onBotRemovedFromChatListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when chat title is changed. + * @param listener Listener. + */ + inline void onChatTitleChanged(const UpdateChatTitleChangedListener& listener) { + _onChatTitleChangedListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when dialog history is cleared. + * @param listener Listener. + */ + inline void onDialogCleared(const UpdateDialogClearedListener& listener) { + _onDialogClearedListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when dialog is muted. + * @param listener Listener. + */ + inline void onDialogMuted(const UpdateDialogMutedListener& listener) { + _onDialogMutedListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when dialog is unmuted. + * @param listener Listener. + */ + inline void onDialogUnmuted(const UpdateDialogUnmutedListener& listener) { + _onDialogUnmutedListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when dialog is removed. + * @param listener Listener. + */ + inline void onDialogRemoved(const UpdateDialogRemovedListener& listener) { + _onDialogRemovedListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives new incoming callback queries. + * @param listener Listener. + */ + inline void onMessageCallback(const MessageCallbackListener& listener) { + _onMessageCallbackListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when message is removed. + * @param listener Listener. + */ + inline void onMessageRemoved(const UpdateMessageRemovedListener& listener) { + _onMessageRemovedListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when user is added to chat. + * @param listener Listener. + */ + inline void onUserAddedToChat(const UpdateUserAddedToChatListener& listener) { + _onUserAddedToChatListeners.push_back(listener); + } + + /** + * @brief Registers listener which receives event when user is removed from chat. + * @param listener Listener. + */ + inline void onUserRemovedFromChat(const UpdateUserRemovedFromChatListener& listener) { + _onUserRemovedFromChatListeners.push_back(listener); + } + + +private: + template + inline void broadcast(const std::vector& listeners, const ObjectType object) const { + if (!object) + return; + + for (const ListenerType& item : listeners) { + item(object); + } + } + + inline void broadcastAnyMessage(const Message::Ptr& message) const { + broadcast(_onAnyMessageListeners, message); + } + + inline bool broadcastCommand(const std::string& command, const Message::Ptr& message) const { + auto iter = _onCommandListeners.find(command); + if (iter == _onCommandListeners.end()) { + return false; + } + iter->second(message); + return true; + } + + inline void broadcastUnknownCommand(const Message::Ptr& message) const { + broadcast(_onUnknownCommandListeners, message); + } + + inline void broadcastNonCommandMessage(const Message::Ptr& message) const { + broadcast(_onNonCommandMessageListeners, message); + } + + inline void broadcastEditedMessage(const Message::Ptr& message) const { + broadcast(_onEditedMessageListeners, message); + } + + inline void broadcastBotAddedToChat(const UpdateBotAddedToChat::Ptr& update) const { + broadcast(_onBotAddedToChatListeners, update); + } + + inline void broadcastBotStarted(const UpdateBotStarted::Ptr& update) const { + broadcast(_onBotStartedListeners, update); + } + + inline void broadcastBotStopped(const UpdateBotStopped::Ptr& update) const { + broadcast(_onBotStoppedListeners, update); + } + + inline void broadcastBotRemovedFromChat(const UpdateBotRemovedFromChat::Ptr& update) const { + broadcast(_onBotRemovedFromChatListeners, update); + } + + inline void broadcastChatTitleChanged(const UpdateChatTitleChanged::Ptr& update) const { + broadcast(_onChatTitleChangedListeners, update); + } + + inline void broadcastDialogCleared(const UpdateDialogCleared::Ptr& update) const { + broadcast(_onDialogClearedListeners, update); + } + + inline void broadcastDialogMuted(const UpdateDialogMuted::Ptr& update) const { + broadcast(_onDialogMutedListeners, update); + } + + inline void broadcastDialogUnmuted(const UpdateDialogUnmuted::Ptr& update) const { + broadcast(_onDialogUnmutedListeners, update); + } + + inline void broadcastDialogRemoved(const UpdateDialogRemoved::Ptr& update) const { + broadcast(_onDialogRemovedListeners, update); + } + + inline void broadcastCallbackQuery(const UpdateMessageCallback::Ptr& callback) const { + broadcast(_onMessageCallbackListeners, callback); + } + + inline void broadcastMessageRemoved(const UpdateMessageRemoved::Ptr& update) const { + broadcast(_onMessageRemovedListeners, update); + } + + inline void broadcastUserAddedToChat(const UpdateUserAddedToChat::Ptr& update) const { + broadcast(_onUserAddedToChatListeners, update); + } + + inline void broadcastUserRemovedFromChat(const UpdateUserRemovedFromChat::Ptr& update) const { + broadcast(_onUserRemovedFromChatListeners, update); + } + + + std::vector _onAnyMessageListeners; + std::unordered_map _onCommandListeners; + std::vector _onUnknownCommandListeners; + std::vector _onNonCommandMessageListeners; + std::vector _onEditedMessageListeners; + std::vector _onBotAddedToChatListeners; + std::vector _onBotStartedListeners; + std::vector _onBotStoppedListeners; + std::vector _onBotRemovedFromChatListeners; + std::vector _onChatTitleChangedListeners; + std::vector _onDialogClearedListeners; + std::vector _onDialogMutedListeners; + std::vector _onDialogUnmutedListeners; + std::vector _onDialogRemovedListeners; + std::vector _onMessageCallbackListeners; + std::vector _onMessageRemovedListeners; + std::vector _onUserAddedToChatListeners; + std::vector _onUserRemovedFromChatListeners; + +}; + +} + +#endif //MAXBOT_EVENTBROADCASTER_H diff --git a/include/tgbot/EventHandler.h b/include/maxbot/EventHandler.h similarity index 58% rename from include/tgbot/EventHandler.h rename to include/maxbot/EventHandler.h index 88a9bcebc..62b407278 100644 --- a/include/tgbot/EventHandler.h +++ b/include/maxbot/EventHandler.h @@ -1,17 +1,17 @@ -#ifndef TGBOT_EVENTHANDLER_H -#define TGBOT_EVENTHANDLER_H +#ifndef MAXBOT_EVENTHANDLER_H +#define MAXBOT_EVENTHANDLER_H -#include "tgbot/EventBroadcaster.h" -#include "tgbot/types/Update.h" -#include "tgbot/tools/StringTools.h" +#include "maxbot/EventBroadcaster.h" +#include "maxbot/types/Update.h" +#include "maxbot/tools/StringTools.h" #include #include #include -namespace TgBot { +namespace MaxBot { -class TGBOT_API EventHandler { +class MAXBOT_API EventHandler { public: explicit EventHandler(const EventBroadcaster& broadcaster) : _broadcaster(broadcaster) { @@ -27,4 +27,4 @@ class TGBOT_API EventHandler { } -#endif //TGBOT_EVENTHANDLER_H +#endif //MAXBOT_EVENTHANDLER_H diff --git a/include/maxbot/export.h b/include/maxbot/export.h new file mode 100644 index 000000000..b023e3e20 --- /dev/null +++ b/include/maxbot/export.h @@ -0,0 +1,28 @@ +#ifndef MAXBOT_EXPORT_H +#define MAXBOT_EXPORT_H + +#ifndef MAXBOT_API + #ifdef MAXBOT_DLL + #if defined _WIN32 || defined __CYGWIN__ + #define MAXBOT_HELPER_DLL_EXPORT __declspec(dllexport) + #define MAXBOT_HELPER_DLL_IMPORT __declspec(dllimport) + #else + #if __GNUC__ >= 4 + #define MAXBOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) + #define MAXBOT_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) + #else + #define MAXBOT_HELPER_DLL_EXPORT + #define MAXBOT_HELPER_DLL_IMPORT + #endif + #endif + #ifdef MaxBot_EXPORTS + #define MAXBOT_API MAXBOT_HELPER_DLL_EXPORT + #else + #define MAXBOT_API MAXBOT_HELPER_DLL_IMPORT + #endif + #else + #define MAXBOT_API + #endif +#endif + +#endif //MAXBOT_EXPORT_H diff --git a/include/maxbot/maxbot.h b/include/maxbot/maxbot.h new file mode 100644 index 000000000..384374ad6 --- /dev/null +++ b/include/maxbot/maxbot.h @@ -0,0 +1,113 @@ +#ifndef MAXBOT_MAXBOT_H +#define MAXBOT_MAXBOT_H + +#include "maxbot/Api.h" +#include "maxbot/Bot.h" +#include "maxbot/EventBroadcaster.h" +#include "maxbot/EventHandler.h" +#include "maxbot/BotException.h" +#include "maxbot/BotTypeParser.h" +#include "maxbot/net/BoostHttpOnlySslClient.h" +#include "maxbot/net/CurlHttpClient.h" +#include "maxbot/net/HttpClient.h" +#include "maxbot/net/HttpParser.h" +#include "maxbot/net/HttpReqArg.h" +#include "maxbot/net/HttpServer.h" +#include "maxbot/net/BotLongPoll.h" +#include "maxbot/net/BotWebhookLocalServer.h" +#include "maxbot/net/BotWebhookServer.h" +#include "maxbot/net/BotWebhookTcpServer.h" +#include "maxbot/net/Url.h" +#include "maxbot/maxbot.h" +#include "maxbot/tools/FileTools.h" +#include "maxbot/tools/StringTools.h" +#include "maxbot/types/Animation.h" +#include "maxbot/types/Audio.h" +#include "maxbot/types/CallbackGame.h" +#include "maxbot/types/CallbackQuery.h" +#include "maxbot/types/Chat.h" +#include "maxbot/types/ChatMember.h" +#include "maxbot/types/ChatPhoto.h" +#include "maxbot/types/ChosenInlineResult.h" +#include "maxbot/types/Contact.h" +#include "maxbot/types/Document.h" +#include "maxbot/types/File.h" +#include "maxbot/types/ForceReply.h" +#include "maxbot/types/Game.h" +#include "maxbot/types/GameHighScore.h" +#include "maxbot/types/GenericReply.h" +#include "maxbot/types/InlineKeyboardButton.h" +#include "maxbot/types/InlineKeyboardMarkup.h" +#include "maxbot/types/InlineQuery.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/InlineQueryResultArticle.h" +#include "maxbot/types/InlineQueryResultAudio.h" +#include "maxbot/types/InlineQueryResultCachedAudio.h" +#include "maxbot/types/InlineQueryResultCachedDocument.h" +#include "maxbot/types/InlineQueryResultCachedGif.h" +#include "maxbot/types/InlineQueryResultCachedMpeg4Gif.h" +#include "maxbot/types/InlineQueryResultCachedPhoto.h" +#include "maxbot/types/InlineQueryResultCachedSticker.h" +#include "maxbot/types/InlineQueryResultCachedVideo.h" +#include "maxbot/types/InlineQueryResultCachedVoice.h" +#include "maxbot/types/InlineQueryResultContact.h" +#include "maxbot/types/InlineQueryResultDocument.h" +#include "maxbot/types/InlineQueryResultGame.h" +#include "maxbot/types/InlineQueryResultGif.h" +#include "maxbot/types/InlineQueryResultLocation.h" +#include "maxbot/types/InlineQueryResultMpeg4Gif.h" +#include "maxbot/types/InlineQueryResultPhoto.h" +#include "maxbot/types/InlineQueryResultVenue.h" +#include "maxbot/types/InlineQueryResultVideo.h" +#include "maxbot/types/InlineQueryResultVoice.h" +#include "maxbot/types/InputContactMessageContent.h" +#include "maxbot/types/InputFile.h" +#include "maxbot/types/InputLocationMessageContent.h" +#include "maxbot/types/InputMedia.h" +#include "maxbot/types/InputMediaPhoto.h" +#include "maxbot/types/InputMediaVideo.h" +#include "maxbot/types/InputMessageContent.h" +#include "maxbot/types/InputTextMessageContent.h" +#include "maxbot/types/InputVenueMessageContent.h" +#include "maxbot/types/Invoice.h" +#include "maxbot/types/KeyboardButton.h" +#include "maxbot/types/LabeledPrice.h" +#include "maxbot/types/Location.h" +#include "maxbot/types/MaskPosition.h" +#include "maxbot/types/Message.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/OrderInfo.h" +#include "maxbot/types/PhotoSize.h" +#include "maxbot/types/PreCheckoutQuery.h" +#include "maxbot/types/ReplyKeyboardMarkup.h" +#include "maxbot/types/ReplyKeyboardRemove.h" +#include "maxbot/types/ResponseParameters.h" +#include "maxbot/types/ShippingAddress.h" +#include "maxbot/types/ShippingOption.h" +#include "maxbot/types/ShippingQuery.h" +#include "maxbot/types/Sticker.h" +#include "maxbot/types/StickerSet.h" +#include "maxbot/types/SuccessfulPayment.h" +#include "maxbot/types/Update.h" +#include "maxbot/types/User.h" +#include "maxbot/types/UserProfilePhotos.h" +#include "maxbot/types/Venue.h" +#include "maxbot/types/Video.h" +#include "maxbot/types/VideoNote.h" +#include "maxbot/types/Voice.h" +#include "maxbot/types/WebhookInfo.h" +#include "maxbot/types/BotCommand.h" + + +/** + * @defgroup general + * @defgroup types + * @defgroup net + * @defgroup tools + * + * @mainpage + * [Go to GitHub](https://github.com/reo7sp/maxbot-cpp) + * + */ + +#endif //MAXBOT_MAXBOT_H diff --git a/include/tgbot/net/BoostHttpOnlySslClient.h b/include/maxbot/net/BoostHttpOnlySslClient.h similarity index 55% rename from include/tgbot/net/BoostHttpOnlySslClient.h rename to include/maxbot/net/BoostHttpOnlySslClient.h index fe170e2cb..df4a046b2 100644 --- a/include/tgbot/net/BoostHttpOnlySslClient.h +++ b/include/maxbot/net/BoostHttpOnlySslClient.h @@ -1,27 +1,27 @@ -#ifndef TGBOT_BOOSTHTTPCLIENT_H -#define TGBOT_BOOSTHTTPCLIENT_H +#ifndef MAXBOT_BOOSTHTTPCLIENT_H +#define MAXBOT_BOOSTHTTPCLIENT_H -#include "tgbot/net/HttpClient.h" -#include "tgbot/net/Url.h" -#include "tgbot/net/HttpReqArg.h" -#include "tgbot/net/HttpParser.h" +#include "maxbot/net/HttpClient.h" +#include "maxbot/net/Url.h" +#include "maxbot/net/HttpReqArg.h" +#include "maxbot/net/HttpParser.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This class makes http requests via boost::asio. * * @ingroup net */ -class TGBOT_API BoostHttpOnlySslClient : public HttpClient { +class MAXBOT_API BoostHttpOnlySslClient : public HttpClient { public: - BoostHttpOnlySslClient(); + BoostHttpOnlySslClient(const std::string& token); ~BoostHttpOnlySslClient() override; /** @@ -30,7 +30,7 @@ class TGBOT_API BoostHttpOnlySslClient : public HttpClient { * If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. * If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded. */ - std::string makeRequest(const Url& url, const std::vector& args) const override; + std::pair makeRequest(const Url& url, const std::vector& args, const std::string& customMethod = {}) const override; private: #if BOOST_VERSION >= 108700 @@ -39,8 +39,9 @@ class TGBOT_API BoostHttpOnlySslClient : public HttpClient { mutable boost::asio::io_service _ioService; #endif const HttpParser _httpParser; + std::unordered_map _headers; }; } -#endif //TGBOT_BOOSTHTTPCLIENT_H +#endif //MAXBOT_BOOSTHTTPCLIENT_H diff --git a/include/maxbot/net/BotLongPoll.h b/include/maxbot/net/BotLongPoll.h new file mode 100644 index 000000000..215341faf --- /dev/null +++ b/include/maxbot/net/BotLongPoll.h @@ -0,0 +1,43 @@ +#ifndef MAXBOT_TGLONGPOLL_H +#define MAXBOT_TGLONGPOLL_H + +#include "maxbot/Api.h" +#include "maxbot/export.h" + +#include +#include + +namespace MaxBot { + +class Bot; +class EventHandler; + +/** + * @brief This class handles long polling and updates parsing. + * + * @ingroup net + */ +class MAXBOT_API BotLongPoll { + +public: + BotLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t limit, std::int32_t timeout); + BotLongPoll(const Bot& bot, std::int32_t limit = 100, std::int32_t timeout = 10); + + /** + * @brief Starts long poll. After new update will come, this method will parse it and send to EventHandler which invokes your listeners. Designed to be executed in a loop. + */ + void start(); + +private: + const Api* _api; + const EventHandler* _eventHandler; + std::int64_t _marker = 0; + std::int32_t _limit; + std::int32_t _timeout; + + std::vector _updates; +}; + +} + +#endif //MAXBOT_TGLONGPOLL_H diff --git a/include/maxbot/net/BotWebhookLocalServer.h b/include/maxbot/net/BotWebhookLocalServer.h new file mode 100644 index 000000000..5958b233a --- /dev/null +++ b/include/maxbot/net/BotWebhookLocalServer.h @@ -0,0 +1,37 @@ +#ifndef MAXBOT_TGWEBHOOKLOCALSERVER_H +#define MAXBOT_TGWEBHOOKLOCALSERVER_H + +#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS + +#include "maxbot/net/BotWebhookServer.h" + +#include + +namespace MaxBot { + +/** + * @brief This class setups HTTP server for receiving Telegram Update objects from unix socket. + * + * @ingroup net + */ +class BotWebhookLocalServer : public BotWebhookServer { + +public: + BotWebhookLocalServer(const std::string& unixSocketPath, const std::string& path, const EventHandler& eventHandler) + : BotWebhookServer(boost::asio::local::stream_protocol::endpoint(unixSocketPath), + path, eventHandler) + { + } + + BotWebhookLocalServer(const std::string& unixSocketPath, const Bot& bot) + : BotWebhookServer(boost::asio::local::stream_protocol::endpoint(unixSocketPath), + bot) + { + } +}; + +} + +#endif //BOOST_ASIO_HAS_LOCAL_SOCKETS + +#endif //MAXBOT_TGWEBHOOKLOCALSERVER_H diff --git a/include/maxbot/net/BotWebhookServer.h b/include/maxbot/net/BotWebhookServer.h new file mode 100644 index 000000000..3fd6b3843 --- /dev/null +++ b/include/maxbot/net/BotWebhookServer.h @@ -0,0 +1,48 @@ +#ifndef MAXBOT_TGHTTPSERVER_H +#define MAXBOT_TGHTTPSERVER_H + +#include "maxbot/Bot.h" +#include "maxbot/EventHandler.h" +#include "maxbot/BotTypeParser.h" +#include "maxbot/net/HttpServer.h" + +#include +#include +#include + +namespace MaxBot { + +template +class BotWebhookServer : public HttpServer { + +public: + BotWebhookServer(const typename boost::asio::basic_socket_acceptor::endpoint_type& endpoint, const typename HttpServer::ServerHandler& handler) = delete; + + BotWebhookServer(const typename boost::asio::basic_socket_acceptor::endpoint_type& endpoint, std::string path, const EventHandler& eventHandler) + : HttpServer(endpoint, + [this](const std::string& _1, const std::unordered_map& _2) { return _handle(_1, _2); }), + _path(std::move(path)), _eventHandler(eventHandler), _botTypeParser() + { + } + + BotWebhookServer(const typename boost::asio::basic_socket_acceptor::endpoint_type& endpoint, const Bot& bot, const std::string& token) + : BotWebhookServer(endpoint, "/" + token, bot.getEventHandler()) + { + } + +private: + std::string _handle(const std::string& data, const std::unordered_map& headers) { + if (headers.at("_method") == "POST" && headers.at("_path") == _path) { + _eventHandler.handleUpdate(_botTypeParser.parseJsonAndGetUpdate(_botTypeParser.parseJson(data))); + } + return HttpServer::_httpParser.generateResponse("", "text/plain", 200, "OK", false); + } + + const std::string _path; + const EventHandler& _eventHandler; + const BotTypeParser _botTypeParser; +}; + +} + +#endif //MAXBOT_TGHTTPSERVER_H diff --git a/include/maxbot/net/BotWebhookTcpServer.h b/include/maxbot/net/BotWebhookTcpServer.h new file mode 100644 index 000000000..aea335637 --- /dev/null +++ b/include/maxbot/net/BotWebhookTcpServer.h @@ -0,0 +1,31 @@ +#ifndef MAXBOT_TGWEBHOOKTCPSERVER_H +#define MAXBOT_TGWEBHOOKTCPSERVER_H + +#include "maxbot/net/BotWebhookServer.h" + +#include + +namespace MaxBot { + +/** + * This class setups HTTP server for receiving Telegram Update objects from tcp connections. + * @ingroup net + */ +class BotWebhookTcpServer : public BotWebhookServer { + +public: + BotWebhookTcpServer(unsigned short port, const std::string& path, const EventHandler& eventHandler) + : BotWebhookServer(boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port), + path, eventHandler) + { + } + + BotWebhookTcpServer(unsigned short port, const Bot& bot, const std::string& token) + : BotWebhookServer(boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port), bot, token) + { + } +}; + +} + +#endif //MAXBOT_TGWEBHOOKTCPSERVER_H diff --git a/include/tgbot/net/CurlHttpClient.h b/include/maxbot/net/CurlHttpClient.h similarity index 67% rename from include/tgbot/net/CurlHttpClient.h rename to include/maxbot/net/CurlHttpClient.h index 393e3436d..84a91ba27 100644 --- a/include/tgbot/net/CurlHttpClient.h +++ b/include/maxbot/net/CurlHttpClient.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CURLHTTPCLIENT_H -#define TGBOT_CURLHTTPCLIENT_H +#ifndef MAXBOT_CURLHTTPCLIENT_H +#define MAXBOT_CURLHTTPCLIENT_H #ifdef HAVE_CURL -#include "tgbot/net/HttpClient.h" -#include "tgbot/net/Url.h" -#include "tgbot/net/HttpReqArg.h" -#include "tgbot/net/HttpParser.h" +#include "maxbot/net/HttpClient.h" +#include "maxbot/net/Url.h" +#include "maxbot/net/HttpReqArg.h" +#include "maxbot/net/HttpParser.h" #include @@ -16,17 +16,17 @@ #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This class makes http requests via libcurl. * * @ingroup net */ -class TGBOT_API CurlHttpClient : public HttpClient { +class MAXBOT_API CurlHttpClient : public HttpClient { public: - CurlHttpClient(); + CurlHttpClient(const std::string& token); ~CurlHttpClient() override; /** @@ -35,7 +35,7 @@ class TGBOT_API CurlHttpClient : public HttpClient { * If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. * If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded. */ - std::string makeRequest(const Url& url, const std::vector& args) const override; + std::pair makeRequest(const Url& url, const std::vector& args, const std::string& customMethod = {}) const override; /** * @brief Raw curl handles, each thread has its own handle. @@ -59,6 +59,7 @@ class TGBOT_API CurlHttpClient : public HttpClient { const HttpParser _httpParser; const char* _proxyUrl = NULL; long _connectTimeout = 20L; + const std::string _authHeader; }; @@ -66,4 +67,4 @@ class TGBOT_API CurlHttpClient : public HttpClient { #endif -#endif //TGBOT_CURLHTTPCLIENT_H +#endif //MAXBOT_CURLHTTPCLIENT_H diff --git a/include/tgbot/net/HttpClient.h b/include/maxbot/net/HttpClient.h similarity index 74% rename from include/tgbot/net/HttpClient.h rename to include/maxbot/net/HttpClient.h index 1f1b2a267..f7484d63e 100644 --- a/include/tgbot/net/HttpClient.h +++ b/include/maxbot/net/HttpClient.h @@ -1,21 +1,21 @@ -#ifndef TGBOT_HTTPCLIENT_H -#define TGBOT_HTTPCLIENT_H +#ifndef MAXBOT_HTTPCLIENT_H +#define MAXBOT_HTTPCLIENT_H -#include "tgbot/net/Url.h" -#include "tgbot/net/HttpReqArg.h" +#include "maxbot/net/Url.h" +#include "maxbot/net/HttpReqArg.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This class makes http requests. * * @ingroup net */ -class TGBOT_API HttpClient { +class MAXBOT_API HttpClient { public: virtual ~HttpClient() = default; @@ -26,7 +26,7 @@ class TGBOT_API HttpClient { * If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. * If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded. */ - virtual std::string makeRequest(const Url& url, const std::vector& args) const = 0; + virtual std::pair makeRequest(const Url& url, const std::vector& args, const std::string& customMethod = {}) const = 0; std::int32_t _timeout = 25; @@ -52,4 +52,4 @@ class TGBOT_API HttpClient { } -#endif //TGBOT_HTTPCLIENT_H +#endif //MAXBOT_HTTPCLIENT_H diff --git a/include/tgbot/net/HttpParser.h b/include/maxbot/net/HttpParser.h similarity index 63% rename from include/tgbot/net/HttpParser.h rename to include/maxbot/net/HttpParser.h index 870ac3853..8b05e6ec6 100644 --- a/include/tgbot/net/HttpParser.h +++ b/include/maxbot/net/HttpParser.h @@ -1,19 +1,19 @@ -#ifndef TGBOT_HTTPPARSER_H -#define TGBOT_HTTPPARSER_H +#ifndef MAXBOT_HTTPPARSER_H +#define MAXBOT_HTTPPARSER_H -#include "tgbot/net/Url.h" -#include "tgbot/net/HttpReqArg.h" +#include "maxbot/net/Url.h" +#include "maxbot/net/HttpReqArg.h" #include #include #include -namespace TgBot { +namespace MaxBot { -class TGBOT_API HttpParser { +class MAXBOT_API HttpParser { public: - std::string generateRequest(const Url& url, const std::vector& args, bool isKeepAlive = false) const; + std::string generateRequest(const Url& url, const std::unordered_map& headers, const std::vector& args, bool isKeepAlive = false, const std::string& customMethod = {}) const; std::string generateMultipartFormData(const std::vector& args, const std::string& boundary) const; std::string generateMultipartBoundary(const std::vector& args) const; std::string generateWwwFormUrlencoded(const std::vector& args) const; @@ -24,4 +24,4 @@ class TGBOT_API HttpParser { } -#endif //TGBOT_HTTPPARSER_H +#endif //MAXBOT_HTTPPARSER_H diff --git a/include/tgbot/net/HttpReqArg.h b/include/maxbot/net/HttpReqArg.h similarity index 86% rename from include/tgbot/net/HttpReqArg.h rename to include/maxbot/net/HttpReqArg.h index fcdd42498..30d551603 100644 --- a/include/tgbot/net/HttpReqArg.h +++ b/include/maxbot/net/HttpReqArg.h @@ -1,7 +1,7 @@ -#ifndef TGBOT_HTTPPARAMETER_H -#define TGBOT_HTTPPARAMETER_H +#ifndef MAXBOT_HTTPPARAMETER_H +#define MAXBOT_HTTPPARAMETER_H -#include "tgbot/export.h" +#include "maxbot/export.h" #include @@ -9,14 +9,14 @@ #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This class represents argument in POST http requests. * * @ingroup net */ -class TGBOT_API HttpReqArg { +class MAXBOT_API HttpReqArg { public: template @@ -54,4 +54,4 @@ class TGBOT_API HttpReqArg { } -#endif //TGBOT_HTTPPARAMETER_H +#endif //MAXBOT_HTTPPARAMETER_H diff --git a/include/tgbot/net/HttpServer.h b/include/maxbot/net/HttpServer.h similarity index 97% rename from include/tgbot/net/HttpServer.h rename to include/maxbot/net/HttpServer.h index a143be4e5..c88f7170f 100644 --- a/include/tgbot/net/HttpServer.h +++ b/include/maxbot/net/HttpServer.h @@ -1,7 +1,7 @@ -#ifndef TGBOT_HTTPSERVER_H -#define TGBOT_HTTPSERVER_H +#ifndef MAXBOT_HTTPSERVER_H +#define MAXBOT_HTTPSERVER_H -#include "tgbot/net/HttpParser.h" +#include "maxbot/net/HttpParser.h" #include @@ -14,7 +14,7 @@ #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This class handles HTTP requests from the Internet. @@ -172,4 +172,4 @@ class HttpServer { } -#endif //TGBOT_HTTPSERVER_H +#endif //MAXBOT_HTTPSERVER_H diff --git a/include/tgbot/net/Url.h b/include/maxbot/net/Url.h similarity index 82% rename from include/tgbot/net/Url.h rename to include/maxbot/net/Url.h index 818cf692d..cf6390baf 100644 --- a/include/tgbot/net/Url.h +++ b/include/maxbot/net/Url.h @@ -1,18 +1,18 @@ -#ifndef TGBOT_CPP_URL_H -#define TGBOT_CPP_URL_H +#ifndef MAXBOT_CPP_URL_H +#define MAXBOT_CPP_URL_H -#include "tgbot/export.h" +#include "maxbot/export.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief This class parses a string with the url * * @ingroup net */ -class TGBOT_API Url { +class MAXBOT_API Url { public: Url(const std::string& url); @@ -45,4 +45,4 @@ class TGBOT_API Url { } -#endif //TGBOT_CPP_URL_H +#endif //MAXBOT_CPP_URL_H diff --git a/include/tgbot/tools/FileTools.h b/include/maxbot/tools/FileTools.h similarity index 79% rename from include/tgbot/tools/FileTools.h rename to include/maxbot/tools/FileTools.h index 0c3a8380d..c2ecc177d 100644 --- a/include/tgbot/tools/FileTools.h +++ b/include/maxbot/tools/FileTools.h @@ -1,7 +1,7 @@ -#ifndef TGBOT_FILETOOLS_H -#define TGBOT_FILETOOLS_H +#ifndef MAXBOT_FILETOOLS_H +#define MAXBOT_FILETOOLS_H -#include "tgbot/export.h" +#include "maxbot/export.h" #include @@ -16,7 +16,7 @@ namespace FileTools { * @throws exception of type std::ifstream::failure if reading fails * @return string with file contents */ -TGBOT_API +MAXBOT_API std::string read(const std::string& filePath); /** @@ -24,10 +24,10 @@ std::string read(const std::string& filePath); * @param filePath Path to a file * @throws exception of type std::ifstream::failure if writing fails */ -TGBOT_API +MAXBOT_API void write(const std::string& content, const std::string& filePath); } -#endif //TGBOT_FILETOOLS_H +#endif //MAXBOT_FILETOOLS_H diff --git a/include/tgbot/tools/StringTools.h b/include/maxbot/tools/StringTools.h similarity index 91% rename from include/tgbot/tools/StringTools.h rename to include/maxbot/tools/StringTools.h index a833fc2f1..b046f492d 100644 --- a/include/tgbot/tools/StringTools.h +++ b/include/maxbot/tools/StringTools.h @@ -1,7 +1,7 @@ -#ifndef TGBOT_CPP_STRINGTOOLS_H -#define TGBOT_CPP_STRINGTOOLS_H +#ifndef MAXBOT_CPP_STRINGTOOLS_H +#define MAXBOT_CPP_STRINGTOOLS_H -#include "tgbot/export.h" +#include "maxbot/export.h" #include #include @@ -18,7 +18,7 @@ namespace StringTools { * @param str1 First string * @param str2 Second string */ -TGBOT_API +MAXBOT_API bool startsWith(const std::string& str1, const std::string& str2); /** @@ -26,7 +26,7 @@ bool startsWith(const std::string& str1, const std::string& str2); * @param str1 First string * @param str2 Second string */ -TGBOT_API +MAXBOT_API bool endsWith(const std::string& str1, const std::string& str2); /** @@ -35,14 +35,14 @@ bool endsWith(const std::string& str1, const std::string& str2); * @param delimiter Delimiter * @param dest Array to which substrings will be saved. */ -TGBOT_API +MAXBOT_API void split(const std::string& str, char delimiter, std::vector& dest); /** * Generates pseudo random string. It's recommended to call srand before this method. * @param length Length of resulting string. */ -TGBOT_API +MAXBOT_API std::string generateRandomString(std::size_t length); /** @@ -51,7 +51,7 @@ std::string generateRandomString(std::size_t length); * @param additionalLegitChars Optional. String of chars which will be not encoded in source url string. * @return Encoded url string */ -TGBOT_API +MAXBOT_API std::string urlEncode(const std::string& value, const std::string& additionalLegitChars = ""); /** @@ -59,7 +59,7 @@ std::string urlEncode(const std::string& value, const std::string& additionalLeg * @param value Encoded url string * @return Decoded url string */ -TGBOT_API +MAXBOT_API std::string urlDecode(const std::string& value); /** @@ -85,4 +85,4 @@ inline std::vector split(const std::string& str, char delimiter) { } -#endif //TGBOT_CPP_STRINGTOOLS_H +#endif //MAXBOT_CPP_STRINGTOOLS_H diff --git a/include/tgbot/types/Animation.h b/include/maxbot/types/Animation.h similarity index 92% rename from include/tgbot/types/Animation.h rename to include/maxbot/types/Animation.h index 104b3e46f..6dacf6ca5 100644 --- a/include/tgbot/types/Animation.h +++ b/include/maxbot/types/Animation.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_ANIMATION_H -#define TGBOT_ANIMATION_H +#ifndef MAXBOT_ANIMATION_H +#define MAXBOT_ANIMATION_H -#include "tgbot/types/PhotoSize.h" +#include "maxbot/types/PhotoSize.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). @@ -69,4 +69,4 @@ class Animation { }; } -#endif //TGBOT_ANIMATION_H +#endif //MAXBOT_ANIMATION_H diff --git a/include/maxbot/types/Attachment.h b/include/maxbot/types/Attachment.h new file mode 100644 index 000000000..c46a5fc54 --- /dev/null +++ b/include/maxbot/types/Attachment.h @@ -0,0 +1,313 @@ +#pragma once + +#include "maxbot/types/User.h" +#include "maxbot/types/Keyboard.h" +#include "maxbot/types/ReplyButton.h" +#include +#include + +namespace MaxBot { + +/// @brief Базовая полезная нагрузка вложения +struct AttachmentPayload +{ + typedef std::shared_ptr Ptr; + + /// @brief URL медиа-вложения + std::string url; +}; + +/// @brief Полезная нагрузка для PhotoAttachment +struct PhotoAttachmentPayload +{ + typedef std::shared_ptr Ptr; + + /// @brief Уникальный ID этого изображения + std::int64_t photo_id; + + /// @brief Токен изображения + std::string token; + + /// @brief URL изображения + std::string url; +}; + +/// @brief Вложение изображения +struct PhotoAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Полезная нагрузка изображения + PhotoAttachmentPayload::Ptr payload; +}; + +/// @brief Миниатюра видео +struct VideoThumbnail +{ + typedef std::shared_ptr Ptr; + + /// @brief URL изображения + std::string url; +}; + +/// @brief Полезная нагрузка медиа-вложения (видео/аудио) +struct MediaAttachmentPayload : public AttachmentPayload +{ + typedef std::shared_ptr Ptr; + + /// @brief Используйте token, если вы пытаетесь повторно использовать одно и то же вложение в другом сообщении. + std::string token; +}; + +/// @brief Вложение видео +struct VideoAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Полезная нагрузка видео + MediaAttachmentPayload::Ptr payload; + + /// @brief Миниатюра видео + VideoThumbnail::Ptr thumbnail; + + /// @brief Ширина видео + std::int64_t width; + + /// @brief Высота видео + std::int64_t height; + + /// @brief Длина видео в секундах + std::int64_t duration; +}; + +/// @brief URL-ы видео в разных разрешениях +struct VideoUrls +{ + typedef std::shared_ptr Ptr; + + /// @brief URL видео в разрешении 1080p, если доступно + std::string mp4_1080; + + /// @brief URL видео в разрешении 720p, если доступно + std::string mp4_720; + + /// @brief URL видео в разрешении 480p, если доступно + std::string mp4_480; + + /// @brief URL видео в разрешении 360p, если доступно + std::string mp4_360; + + /// @brief URL видео в разрешении 240p, если доступно + std::string mp4_240; + + /// @brief URL видео в разрешении 144p, если доступно + std::string mp4_144; + + /// @brief URL трансляции, если доступна + std::string hls; +}; + +/// @brief Детали видео-вложения (альтернативное представление) +struct VideoAttachmentDetails +{ + typedef std::shared_ptr Ptr; + + /// @brief Токен видео-вложения + std::string token; + + /// @brief URL-ы для скачивания или воспроизведения видео. Может быть null, если видео недоступно + VideoUrls::Ptr urls; + + /// @brief Миниатюра видео + PhotoAttachmentPayload::Ptr thumbnail; + + /// @brief Ширина видео + std::int64_t width; + + /// @brief Высота видео + std::int64_t height; + + /// @brief Длина видео в секундах + std::int64_t duration; +}; + +/// @brief Вложение аудио +struct AudioAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Полезная нагрузка аудио + MediaAttachmentPayload::Ptr payload; + + /// @brief Аудио транскрипция + std::string transcription; +}; + +/// @brief Полезная нагрузка файлового вложения +struct FileAttachmentPayload : public AttachmentPayload +{ + typedef std::shared_ptr Ptr; + + /// @brief Используйте token, если вы пытаетесь повторно использовать одно и то же вложение в другом сообщении. + std::string token; +}; + +/// @brief Вложение файла +struct FileAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Полезная нагрузка файла + FileAttachmentPayload::Ptr payload; + + /// @brief Имя загруженного файла + std::string filename; + + /// @brief Размер файла в байтах + std::int64_t size; +}; + +/// @brief Полезная нагрузка контакта +struct ContactAttachmentPayload +{ + typedef std::shared_ptr Ptr; + + /// @brief Информация о пользователе в формате VCF + std::string vcf_info; + + /// @brief Хеш информации о пользователе в формате VCF. + std::string hash; + + /// @brief Информация о пользователе + User::Ptr max_info; +}; + +/// @brief Вложение контакта +struct ContactAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Полезная нагрузка контакта + ContactAttachmentPayload::Ptr payload; +}; + +/// @brief Полезная нагрузка стикера +struct StickerAttachmentPayload : public AttachmentPayload +{ + typedef std::shared_ptr Ptr; + + /// @brief ID стикера + std::string code; +}; + +/// @brief Вложение стикера +struct StickerAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Полезная нагрузка стикера + StickerAttachmentPayload::Ptr payload; + + /// @brief Ширина стикера + std::int64_t width; + + /// @brief Высота стикера + std::int64_t height; +}; + +/// @brief Полезная нагрузка запроса ShareAttachment +struct ShareAttachmentPayload +{ + typedef std::shared_ptr Ptr; + + /// @brief URL, прикрепленный к сообщению в качестве предпросмотра медиа + std::string url; + + /// @brief Токен вложения + std::string token; +}; + +/// @brief Вложение "поделиться" +struct ShareAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Полезная нагрузка + ShareAttachmentPayload::Ptr payload; + + /// @brief Заголовок предпросмотра ссылки. + std::string title; + + /// @brief Описание предпросмотра ссылки + std::string description; + + /// @brief Изображение предпросмотра ссылки + std::string image_url; +}; + +/// @brief Вложение геолокации +struct LocationAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Широта + double latitude; + + /// @brief Долгота + double longitude; +}; + +/// @brief Кнопки в сообщении (инлайн-клавиатура) +struct InlineKeyboardAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Полезная нагрузка — клавиатура + Keyboard::Ptr payload; +}; + +/// @brief Custom reply keyboard in message +struct ReplyKeyboardAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Матрица кнопок + std::vector> buttons; +}; + +/// @brief Attachment contains payload sent through SendMessageButton +struct DataAttachment +{ + typedef std::shared_ptr Ptr; + + /// @brief Данные, переданные через кнопку + std::string data; +}; + +/** + * @brief Дискриминаторный класс для всех типов вложений. + * Использует std::variant для хранения конкретного типа вложения. + */ +class Attachment +{ +public: + typedef std::shared_ptr Ptr; + + /// @brief Тип вложения (текстовый дискриминатор) + std::string type; + + /// @brief Вариант, содержащий одно из возможных вложений + std::variant< + PhotoAttachment::Ptr, + VideoAttachment::Ptr, + AudioAttachment::Ptr, + FileAttachment::Ptr, + StickerAttachment::Ptr, + ContactAttachment::Ptr, + InlineKeyboardAttachment::Ptr, + ShareAttachment::Ptr, + LocationAttachment::Ptr + > _data; +}; + +} // namespace MaxBot diff --git a/include/maxbot/types/AttachmentRequest.h b/include/maxbot/types/AttachmentRequest.h new file mode 100644 index 000000000..1c5d863b2 --- /dev/null +++ b/include/maxbot/types/AttachmentRequest.h @@ -0,0 +1,291 @@ +#pragma once + +#include "maxbot/types/Attachment.h" + +#include + +namespace MaxBot { + +/** + * @brief Информация о загруженном изображении + */ +class PhotoToken +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Закодированная информация загруженного изображения + */ + std::string token; +}; + +/** + * @brief Запрос на прикрепление изображения + */ +class PhotoAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Полезная нагрузка запроса на прикрепление изображения + */ + class Payload + { + public: + typedef std::shared_ptr Ptr; + + /** + * @brief Любой внешний URL изображения, которое вы хотите прикрепить + */ + std::string url; + + /** + * @brief Токен существующего вложения + */ + std::string token; + + /** + * @brief Токены, полученные после загрузки изображений + */ + std::unordered_map photos; + }; + + Payload payload; +}; + +/** + * @brief Это информация, которую вы получите, как только изображение будет загружено + */ +class PhotoTokens +{ +public: + typedef std::shared_ptr Ptr; + + std::unordered_map photos; +}; + +/** + * @brief Это информация, которую вы получите, как только аудио/видео будет загружено + */ +class UploadedInfo +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Токен — уникальный ID загруженного медиафайла + */ + std::string token; +}; + +/** + * @brief Запрос на прикрепление видео к сообщению + */ +class VideoAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + UploadedInfo::Ptr payload; +}; + +/** + * @brief Запрос на прикрепление аудио к сообщению. ДОЛЖЕН быть единственным вложением в сообщении + */ +class AudioAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + UploadedInfo::Ptr payload; +}; + +/** + * @brief Запрос на прикрепление файла к сообщению. ДОЛЖЕН быть единственным вложением в сообщении + */ +class FileAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + UploadedInfo::Ptr payload; +}; + +/** + * @brief Тип загружаемого файла + */ +enum class UploadType +{ + image, ///< JPG, JPEG, PNG, GIF, TIFF, BMP, HEIC + video, ///< MP4, MOV, MKV, WEBM, MATROSKA + audio, ///< MP3, WAV, M4A и другие + file ///< любые типы файлов +}; + +/** + * @brief Запрос на прикрепление карточки контакта к сообщению. ДОЛЖЕН быть единственным вложением в сообщении + */ +class ContactAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + class Payload + { + public: + typedef std::shared_ptr Ptr; + + /** + * @brief Имя контакта + */ + std::string name; + + /** + * @brief ID контакта, если он зарегистрирован в MAX + */ + std::int64_t contact_id; + + /** + * @brief Полная информация о контакте в формате VCF + */ + std::string vcf_info; + + /** + * @brief Телефон контакта в формате VCF + */ + std::string vcf_phone; + }; + + Payload::Ptr payload; +}; + +/** + * @brief Запрос на прикрепление стикера. ДОЛЖЕН быть единственным вложением в сообщении + */ +class StickerAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + class Payload + { + public: + typedef std::shared_ptr Ptr; + + /** + * @brief Код стикера + */ + std::string code; + }; + + Payload::Ptr payload; +}; + +/** + * @brief Запрос на прикрепление клавиатуры к сообщению + */ +class InlineKeyboardAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + class Payload + { + public: + typedef std::shared_ptr Ptr; + + /** + * @brief Двумерный массив кнопок + */ + std::vector> buttons; + }; + + Payload payload; +}; + +/** + * @brief Request to attach reply keyboard to message + */ +class ReplyKeyboardAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Applicable only for chats. If `true` keyboard will be shown only for user bot mentioned or replied + */ + bool direct = false; + + /** + * @brief If set to `true`, reply keyboard will only be shown to this participant in chat + */ + std::int64_t direct_user_id; + + /** + * @brief Двумерный массив кнопок + */ + std::vector> buttons; +}; + +/** + * @brief Запрос на прикрепление клавиатуры к сообщению + */ +class LocationAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Широта + */ + double latitude; + + /** + * @brief Долгота + */ + double longitude; +}; + +/** + * @brief Запрос на прикрепление предпросмотра медиафайла по внешнему URL + */ +class ShareAttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + ShareAttachmentPayload::Ptr payload; +}; + +/** + * @brief Запрос на прикрепление данных к сообщению (базовый тип с дискриминатором) + */ +class AttachmentRequest +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Тип вложения + */ + std::string type; + + using VariantType = std::variant< + std::monostate, // для случая, если тип не задан + PhotoAttachmentRequest::Ptr, + VideoAttachmentRequest::Ptr, + AudioAttachmentRequest::Ptr, + FileAttachmentRequest::Ptr, + StickerAttachmentRequest::Ptr, + ContactAttachmentRequest::Ptr, + InlineKeyboardAttachmentRequest::Ptr, + LocationAttachmentRequest::Ptr, + ShareAttachmentRequest::Ptr + >; + + VariantType _data; +}; + +} // namespace MaxBot diff --git a/include/tgbot/types/Audio.h b/include/maxbot/types/Audio.h similarity index 92% rename from include/tgbot/types/Audio.h rename to include/maxbot/types/Audio.h index 1554735b5..e403d6321 100644 --- a/include/tgbot/types/Audio.h +++ b/include/maxbot/types/Audio.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_AUDIO_H -#define TGBOT_AUDIO_H +#ifndef MAXBOT_AUDIO_H +#define MAXBOT_AUDIO_H -#include "tgbot/types/PhotoSize.h" +#include "maxbot/types/PhotoSize.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents an audio file to be treated as music by the Telegram clients. @@ -70,4 +70,4 @@ class Audio { }; } -#endif //TGBOT_AUDIO_H +#endif //MAXBOT_AUDIO_H diff --git a/include/tgbot/types/Birthdate.h b/include/maxbot/types/Birthdate.h similarity index 79% rename from include/tgbot/types/Birthdate.h rename to include/maxbot/types/Birthdate.h index af481ccac..6710686e8 100644 --- a/include/tgbot/types/Birthdate.h +++ b/include/maxbot/types/Birthdate.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_BIRTHDATE_H -#define TGBOT_BIRTHDATE_H +#ifndef MAXBOT_BIRTHDATE_H +#define MAXBOT_BIRTHDATE_H #include #include -namespace TgBot { +namespace MaxBot { /** * @ingroup types @@ -31,4 +31,4 @@ class Birthdate { }; } -#endif //TGBOT_BIRTHDATE_H +#endif //MAXBOT_BIRTHDATE_H diff --git a/include/tgbot/types/BotCommand.h b/include/maxbot/types/BotCommand.h similarity index 81% rename from include/tgbot/types/BotCommand.h rename to include/maxbot/types/BotCommand.h index 5ad057b0f..60e56987a 100644 --- a/include/tgbot/types/BotCommand.h +++ b/include/maxbot/types/BotCommand.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_BOTCOMMAND_H -#define TGBOT_BOTCOMMAND_H +#ifndef MAXBOT_BOTCOMMAND_H +#define MAXBOT_BOTCOMMAND_H #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a bot command. @@ -33,4 +33,4 @@ class BotCommand { }; } -#endif //TGBOT_BOTCOMMAND_H +#endif //MAXBOT_BOTCOMMAND_H diff --git a/include/tgbot/types/BotCommandScope.h b/include/maxbot/types/BotCommandScope.h similarity index 77% rename from include/tgbot/types/BotCommandScope.h rename to include/maxbot/types/BotCommandScope.h index 47a3ee9e6..671c1bf6b 100644 --- a/include/tgbot/types/BotCommandScope.h +++ b/include/maxbot/types/BotCommandScope.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_BOTCOMMANDSCOPE_H -#define TGBOT_BOTCOMMANDSCOPE_H +#ifndef MAXBOT_BOTCOMMANDSCOPE_H +#define MAXBOT_BOTCOMMANDSCOPE_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This abstract class is base of all bot command scopes. @@ -28,4 +28,4 @@ class BotCommandScope { }; } -#endif //TGBOT_BOTCOMMANDSCOPE_H +#endif //MAXBOT_BOTCOMMANDSCOPE_H diff --git a/include/tgbot/types/BotCommandScopeAllChatAdministrators.h b/include/maxbot/types/BotCommandScopeAllChatAdministrators.h similarity index 65% rename from include/tgbot/types/BotCommandScopeAllChatAdministrators.h rename to include/maxbot/types/BotCommandScopeAllChatAdministrators.h index bc814bc0b..86ee1be68 100644 --- a/include/tgbot/types/BotCommandScopeAllChatAdministrators.h +++ b/include/maxbot/types/BotCommandScopeAllChatAdministrators.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_BOTCOMMANDSCOPEALLCHATADMINISTRATORS_H -#define TGBOT_BOTCOMMANDSCOPEALLCHATADMINISTRATORS_H +#ifndef MAXBOT_BOTCOMMANDSCOPEALLCHATADMINISTRATORS_H +#define MAXBOT_BOTCOMMANDSCOPEALLCHATADMINISTRATORS_H -#include "tgbot/types/BotCommandScope.h" +#include "maxbot/types/BotCommandScope.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the scope of bot commands, covering all group and supergroup chat administrators. @@ -24,4 +24,4 @@ class BotCommandScopeAllChatAdministrators : public BotCommandScope { }; } -#endif //TGBOT_BOTCOMMANDSCOPEALLCHATADMINISTRATORS_H +#endif //MAXBOT_BOTCOMMANDSCOPEALLCHATADMINISTRATORS_H diff --git a/include/tgbot/types/BotCommandScopeAllGroupChats.h b/include/maxbot/types/BotCommandScopeAllGroupChats.h similarity index 65% rename from include/tgbot/types/BotCommandScopeAllGroupChats.h rename to include/maxbot/types/BotCommandScopeAllGroupChats.h index 8b709d66e..240ce92c9 100644 --- a/include/tgbot/types/BotCommandScopeAllGroupChats.h +++ b/include/maxbot/types/BotCommandScopeAllGroupChats.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_BOTCOMMANDSCOPEALLGROUPCHATS_H -#define TGBOT_BOTCOMMANDSCOPEALLGROUPCHATS_H +#ifndef MAXBOT_BOTCOMMANDSCOPEALLGROUPCHATS_H +#define MAXBOT_BOTCOMMANDSCOPEALLGROUPCHATS_H -#include "tgbot/types/BotCommandScope.h" +#include "maxbot/types/BotCommandScope.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the scope of bot commands, covering all group and supergroup chats. @@ -24,4 +24,4 @@ class BotCommandScopeAllGroupChats : public BotCommandScope { }; } -#endif //TGBOT_BOTCOMMANDSCOPEALLGROUPCHATS_H +#endif //MAXBOT_BOTCOMMANDSCOPEALLGROUPCHATS_H diff --git a/include/tgbot/types/BotCommandScopeAllPrivateChats.h b/include/maxbot/types/BotCommandScopeAllPrivateChats.h similarity index 64% rename from include/tgbot/types/BotCommandScopeAllPrivateChats.h rename to include/maxbot/types/BotCommandScopeAllPrivateChats.h index b2e36b865..3cc27b240 100644 --- a/include/tgbot/types/BotCommandScopeAllPrivateChats.h +++ b/include/maxbot/types/BotCommandScopeAllPrivateChats.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_BOTCOMMANDSCOPEALLPRIVATECHATS_H -#define TGBOT_BOTCOMMANDSCOPEALLPRIVATECHATS_H +#ifndef MAXBOT_BOTCOMMANDSCOPEALLPRIVATECHATS_H +#define MAXBOT_BOTCOMMANDSCOPEALLPRIVATECHATS_H -#include "tgbot/types/BotCommandScope.h" +#include "maxbot/types/BotCommandScope.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the scope of bot commands, covering all private chats. @@ -24,4 +24,4 @@ class BotCommandScopeAllPrivateChats : public BotCommandScope { }; } -#endif //TGBOT_BOTCOMMANDSCOPEALLPRIVATECHATS_H +#endif //MAXBOT_BOTCOMMANDSCOPEALLPRIVATECHATS_H diff --git a/include/tgbot/types/BotCommandScopeChat.h b/include/maxbot/types/BotCommandScopeChat.h similarity index 75% rename from include/tgbot/types/BotCommandScopeChat.h rename to include/maxbot/types/BotCommandScopeChat.h index fd36125c5..19d748458 100644 --- a/include/tgbot/types/BotCommandScopeChat.h +++ b/include/maxbot/types/BotCommandScopeChat.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_BOTCOMMANDSCOPECHAT_H -#define TGBOT_BOTCOMMANDSCOPECHAT_H +#ifndef MAXBOT_BOTCOMMANDSCOPECHAT_H +#define MAXBOT_BOTCOMMANDSCOPECHAT_H -#include "tgbot/types/BotCommandScope.h" +#include "maxbot/types/BotCommandScope.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the scope of bot commands, covering a specific chat. @@ -30,4 +30,4 @@ class BotCommandScopeChat : public BotCommandScope { }; } -#endif //TGBOT_BOTCOMMANDSCOPECHAT_H +#endif //MAXBOT_BOTCOMMANDSCOPECHAT_H diff --git a/include/tgbot/types/BotCommandScopeChatAdministrators.h b/include/maxbot/types/BotCommandScopeChatAdministrators.h similarity index 74% rename from include/tgbot/types/BotCommandScopeChatAdministrators.h rename to include/maxbot/types/BotCommandScopeChatAdministrators.h index f046e317b..4ab787183 100644 --- a/include/tgbot/types/BotCommandScopeChatAdministrators.h +++ b/include/maxbot/types/BotCommandScopeChatAdministrators.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_BOTCOMMANDSCOPECHATADMINISTRATORS_H -#define TGBOT_BOTCOMMANDSCOPECHATADMINISTRATORS_H +#ifndef MAXBOT_BOTCOMMANDSCOPECHATADMINISTRATORS_H +#define MAXBOT_BOTCOMMANDSCOPECHATADMINISTRATORS_H -#include "tgbot/types/BotCommandScope.h" +#include "maxbot/types/BotCommandScope.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. @@ -30,4 +30,4 @@ class BotCommandScopeChatAdministrators : public BotCommandScope { }; } -#endif //TGBOT_BOTCOMMANDSCOPECHATADMINISTRATORS_H +#endif //MAXBOT_BOTCOMMANDSCOPECHATADMINISTRATORS_H diff --git a/include/tgbot/types/BotCommandScopeChatMember.h b/include/maxbot/types/BotCommandScopeChatMember.h similarity index 77% rename from include/tgbot/types/BotCommandScopeChatMember.h rename to include/maxbot/types/BotCommandScopeChatMember.h index 5beaee642..5d336dae8 100644 --- a/include/tgbot/types/BotCommandScopeChatMember.h +++ b/include/maxbot/types/BotCommandScopeChatMember.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_BOTCOMMANDSCOPECHATMEMBER_H -#define TGBOT_BOTCOMMANDSCOPECHATMEMBER_H +#ifndef MAXBOT_BOTCOMMANDSCOPECHATMEMBER_H +#define MAXBOT_BOTCOMMANDSCOPECHATMEMBER_H -#include "tgbot/types/BotCommandScope.h" +#include "maxbot/types/BotCommandScope.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the scope of bot commands, covering a specific member of a group or supergroup chat. @@ -35,4 +35,4 @@ class BotCommandScopeChatMember : public BotCommandScope { }; } -#endif //TGBOT_BOTCOMMANDSCOPECHATMEMBER_H +#endif //MAXBOT_BOTCOMMANDSCOPECHATMEMBER_H diff --git a/include/tgbot/types/BotCommandScopeDefault.h b/include/maxbot/types/BotCommandScopeDefault.h similarity index 70% rename from include/tgbot/types/BotCommandScopeDefault.h rename to include/maxbot/types/BotCommandScopeDefault.h index 76b81923c..c126da79f 100644 --- a/include/tgbot/types/BotCommandScopeDefault.h +++ b/include/maxbot/types/BotCommandScopeDefault.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_BOTCOMMANDSCOPEDEFAULT_H -#define TGBOT_BOTCOMMANDSCOPEDEFAULT_H +#ifndef MAXBOT_BOTCOMMANDSCOPEDEFAULT_H +#define MAXBOT_BOTCOMMANDSCOPEDEFAULT_H -#include "tgbot/types/BotCommandScope.h" +#include "maxbot/types/BotCommandScope.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the default scope of bot commands. @@ -25,4 +25,4 @@ class BotCommandScopeDefault : public BotCommandScope { }; } -#endif //TGBOT_BOTCOMMANDSCOPEDEFAULT_H +#endif //MAXBOT_BOTCOMMANDSCOPEDEFAULT_H diff --git a/include/tgbot/types/BotDescription.h b/include/maxbot/types/BotDescription.h similarity index 71% rename from include/tgbot/types/BotDescription.h rename to include/maxbot/types/BotDescription.h index 1c769a4b4..d2a80b057 100644 --- a/include/tgbot/types/BotDescription.h +++ b/include/maxbot/types/BotDescription.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_BOTDESCRIPTION_H -#define TGBOT_BOTDESCRIPTION_H +#ifndef MAXBOT_BOTDESCRIPTION_H +#define MAXBOT_BOTDESCRIPTION_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents the bot's description. @@ -22,4 +22,4 @@ class BotDescription { }; } -#endif //TGBOT_BOTDESCRIPTION_H +#endif //MAXBOT_BOTDESCRIPTION_H diff --git a/include/tgbot/types/BotName.h b/include/maxbot/types/BotName.h similarity index 73% rename from include/tgbot/types/BotName.h rename to include/maxbot/types/BotName.h index d89ee5c4d..0dc198c86 100644 --- a/include/tgbot/types/BotName.h +++ b/include/maxbot/types/BotName.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_BOTNAME_H -#define TGBOT_BOTNAME_H +#ifndef MAXBOT_BOTNAME_H +#define MAXBOT_BOTNAME_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents the bot's name. @@ -22,4 +22,4 @@ class BotName { }; } -#endif //TGBOT_BOTNAME_H +#endif //MAXBOT_BOTNAME_H diff --git a/include/tgbot/types/BotShortDescription.h b/include/maxbot/types/BotShortDescription.h similarity index 70% rename from include/tgbot/types/BotShortDescription.h rename to include/maxbot/types/BotShortDescription.h index d3e33b30e..0a27b67a8 100644 --- a/include/tgbot/types/BotShortDescription.h +++ b/include/maxbot/types/BotShortDescription.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_BOTSHORTDESCRIPTION_H -#define TGBOT_BOTSHORTDESCRIPTION_H +#ifndef MAXBOT_BOTSHORTDESCRIPTION_H +#define MAXBOT_BOTSHORTDESCRIPTION_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents the bot's short description. @@ -22,4 +22,4 @@ class BotShortDescription { }; } -#endif //TGBOT_BOTSHORTDESCRIPTION_H +#endif //MAXBOT_BOTSHORTDESCRIPTION_H diff --git a/include/maxbot/types/Callback.h b/include/maxbot/types/Callback.h new file mode 100644 index 000000000..89bbaed49 --- /dev/null +++ b/include/maxbot/types/Callback.h @@ -0,0 +1,39 @@ +#pragma once + +#include "maxbot/types/User.h" + +#include +#include + +namespace MaxBot { + +/** + * @brief Объект, отправленный боту, когда пользователь нажимает кнопку + */ +class Callback +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Unix-время, когда пользователь нажал кнопку + */ + std::int64_t timestamp; + + /** + * @brief Текущий ID клавиатуры + */ + std::string callback_id; + + /** + * @brief Токен кнопки + */ + std::string payload; + + /** + * @brief Пользователь, нажавший на кнопку + */ + User::Ptr user; +}; + +} // namespace MaxBot diff --git a/include/maxbot/types/CallbackAnswer.h b/include/maxbot/types/CallbackAnswer.h new file mode 100644 index 000000000..32c45d5d1 --- /dev/null +++ b/include/maxbot/types/CallbackAnswer.h @@ -0,0 +1,26 @@ +#pragma once + +#include "maxbot/types/NewMessageBody.h" + +namespace MaxBot { + +/** + * @brief Отправьте этот объект, когда ваш бот хочет отреагировать на нажатие кнопки + */ +class CallbackAnswer +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Заполните это, если хотите изменить текущее сообщение + */ + NewMessageBody::Ptr message; + + /** + * @brief Заполните это, если хотите просто отправить одноразовое уведомление пользователю + */ + std::string notification; +}; + +} // namespace MaxBot diff --git a/include/tgbot/types/CallbackGame.h b/include/maxbot/types/CallbackGame.h similarity index 67% rename from include/tgbot/types/CallbackGame.h rename to include/maxbot/types/CallbackGame.h index 99c1b3733..0124b63d9 100644 --- a/include/tgbot/types/CallbackGame.h +++ b/include/maxbot/types/CallbackGame.h @@ -1,9 +1,9 @@ -#ifndef TGBOT_CALLBACKGAME_H -#define TGBOT_CALLBACKGAME_H +#ifndef MAXBOT_CALLBACKGAME_H +#define MAXBOT_CALLBACKGAME_H #include -namespace TgBot { +namespace MaxBot { /** * @brief A placeholder, currently holds no information. @@ -17,4 +17,4 @@ class CallbackGame { }; } -#endif //TGBOT_CALLBACKGAME_H +#endif //MAXBOT_CALLBACKGAME_H diff --git a/include/tgbot/types/CallbackQuery.h b/include/maxbot/types/CallbackQuery.h similarity index 87% rename from include/tgbot/types/CallbackQuery.h rename to include/maxbot/types/CallbackQuery.h index b1367aac3..0651a9ac4 100644 --- a/include/tgbot/types/CallbackQuery.h +++ b/include/maxbot/types/CallbackQuery.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_CALLBACKQUERY_H -#define TGBOT_CALLBACKQUERY_H +#ifndef MAXBOT_CALLBACKQUERY_H +#define MAXBOT_CALLBACKQUERY_H -#include "tgbot/types/User.h" -#include "tgbot/types/Message.h" +#include "maxbot/types/User.h" +#include "maxbot/types/Message.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents an incoming callback query from a callback button in an inline keyboard. @@ -54,4 +54,4 @@ class CallbackQuery { }; } -#endif //TGBOT_CALLBACKQUERY_H +#endif //MAXBOT_CALLBACKQUERY_H diff --git a/include/tgbot/types/Chat.h b/include/maxbot/types/Chat.h similarity index 89% rename from include/tgbot/types/Chat.h rename to include/maxbot/types/Chat.h index 411c01d68..2c25d54af 100644 --- a/include/tgbot/types/Chat.h +++ b/include/maxbot/types/Chat.h @@ -1,22 +1,18 @@ -#ifndef TGBOT_CHAT_H -#define TGBOT_CHAT_H - -#include "tgbot/types/ChatPhoto.h" -#include "tgbot/types/Birthdate.h" -#include "tgbot/types/BusinessIntro.h" -#include "tgbot/types/BusinessLocation.h" -#include "tgbot/types/BusinessOpeningHours.h" -#include "tgbot/types/Chat.h" -#include "tgbot/types/ReactionType.h" -#include "tgbot/types/ChatPermissions.h" -#include "tgbot/types/ChatLocation.h" +#ifndef MAXBOT_CHAT_H +#define MAXBOT_CHAT_H + +#include "maxbot/types/ChatPhoto.h" +#include "maxbot/types/Birthdate.h" +#include "maxbot/types/ReactionType.h" +#include "maxbot/types/ChatPermissions.h" +#include "maxbot/types/ChatLocation.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { class Message; @@ -96,27 +92,6 @@ class Chat { */ Birthdate::Ptr birthdate; - /** - * @brief Optional. For private chats with business accounts, the intro of the business. - * - * Returned only in Api::getChat. - */ - BusinessIntro::Ptr businessIntro; - - /** - * @brief Optional. For private chats with business accounts, the location of the business. - * - * Returned only in Api::getChat. - */ - BusinessLocation::Ptr businessLocation; - - /** - * @brief Optional. For private chats with business accounts, the opening hours of the business. - * - * Returned only in Api::getChat. - */ - BusinessOpeningHours::Ptr businessOpeningHours; - /** * @brief Optional. For private chats, the personal channel of the user. * @@ -330,4 +305,4 @@ class Chat { }; } -#endif //TGBOT_CHAT_H +#endif //MAXBOT_CHAT_H diff --git a/include/tgbot/types/ChatAdministratorRights.h b/include/maxbot/types/ChatAdministratorRights.h similarity index 94% rename from include/tgbot/types/ChatAdministratorRights.h rename to include/maxbot/types/ChatAdministratorRights.h index 3836070da..69340bd97 100644 --- a/include/tgbot/types/ChatAdministratorRights.h +++ b/include/maxbot/types/ChatAdministratorRights.h @@ -1,9 +1,9 @@ -#ifndef TGBOT_CHATADMINISTRATORRIGHTS_H -#define TGBOT_CHATADMINISTRATORRIGHTS_H +#ifndef MAXBOT_CHATADMINISTRATORRIGHTS_H +#define MAXBOT_CHATADMINISTRATORRIGHTS_H #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the rights of an administrator in a chat. @@ -94,4 +94,4 @@ class ChatAdministratorRights { }; } -#endif //TGBOT_CHATADMINISTRATORRIGHTS_H +#endif //MAXBOT_CHATADMINISTRATORRIGHTS_H diff --git a/include/tgbot/types/ChatBoost.h b/include/maxbot/types/ChatBoost.h similarity index 83% rename from include/tgbot/types/ChatBoost.h rename to include/maxbot/types/ChatBoost.h index bd6894463..0a2e2257e 100644 --- a/include/tgbot/types/ChatBoost.h +++ b/include/maxbot/types/ChatBoost.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_CHATBOOST_H -#define TGBOT_CHATBOOST_H +#ifndef MAXBOT_CHATBOOST_H +#define MAXBOT_CHATBOOST_H -#include "tgbot/types/ChatBoostSource.h" +#include "maxbot/types/ChatBoostSource.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object contains information about a chat boost. @@ -41,4 +41,4 @@ class ChatBoost { }; } -#endif //TGBOT_CHATBOOST_H +#endif //MAXBOT_CHATBOOST_H diff --git a/include/tgbot/types/ChatBoostAdded.h b/include/maxbot/types/ChatBoostAdded.h similarity index 74% rename from include/tgbot/types/ChatBoostAdded.h rename to include/maxbot/types/ChatBoostAdded.h index 93a879612..91d1df5dd 100644 --- a/include/tgbot/types/ChatBoostAdded.h +++ b/include/maxbot/types/ChatBoostAdded.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_CHATBOOSTADDED_H -#define TGBOT_CHATBOOSTADDED_H +#ifndef MAXBOT_CHATBOOSTADDED_H +#define MAXBOT_CHATBOOSTADDED_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a service message about a user boosting a chat. @@ -23,4 +23,4 @@ class ChatBoostAdded { }; } -#endif //TGBOT_CHATBOOSTADDED_H +#endif //MAXBOT_CHATBOOSTADDED_H diff --git a/include/tgbot/types/ChatBoostRemoved.h b/include/maxbot/types/ChatBoostRemoved.h similarity index 75% rename from include/tgbot/types/ChatBoostRemoved.h rename to include/maxbot/types/ChatBoostRemoved.h index be5381ee8..fe2e5ae92 100644 --- a/include/tgbot/types/ChatBoostRemoved.h +++ b/include/maxbot/types/ChatBoostRemoved.h @@ -1,14 +1,14 @@ -#ifndef TGBOT_CHATBOOSTREMOVED_H -#define TGBOT_CHATBOOSTREMOVED_H +#ifndef MAXBOT_CHATBOOSTREMOVED_H +#define MAXBOT_CHATBOOSTREMOVED_H -#include "tgbot/types/Chat.h" -#include "tgbot/types/ChatBoostSource.h" +#include "maxbot/types/Chat.h" +#include "maxbot/types/ChatBoostSource.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a boost removed from a chat. @@ -42,4 +42,4 @@ class ChatBoostRemoved { }; } -#endif //TGBOT_CHATBOOSTREMOVED_H +#endif //MAXBOT_CHATBOOSTREMOVED_H diff --git a/include/tgbot/types/ChatBoostSource.h b/include/maxbot/types/ChatBoostSource.h similarity index 77% rename from include/tgbot/types/ChatBoostSource.h rename to include/maxbot/types/ChatBoostSource.h index e531b58a7..74ba9f098 100644 --- a/include/tgbot/types/ChatBoostSource.h +++ b/include/maxbot/types/ChatBoostSource.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CHATBOOSTSOURCE_H -#define TGBOT_CHATBOOSTSOURCE_H +#ifndef MAXBOT_CHATBOOSTSOURCE_H +#define MAXBOT_CHATBOOSTSOURCE_H -#include "tgbot/types/User.h" +#include "maxbot/types/User.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object describes the source of a chat boost. @@ -39,4 +39,4 @@ class ChatBoostSource { }; } -#endif //TGBOT_CHATBOOSTSOURCE_H +#endif //MAXBOT_CHATBOOSTSOURCE_H diff --git a/include/tgbot/types/ChatBoostSourceGiftCode.h b/include/maxbot/types/ChatBoostSourceGiftCode.h similarity index 72% rename from include/tgbot/types/ChatBoostSourceGiftCode.h rename to include/maxbot/types/ChatBoostSourceGiftCode.h index 42bb83bdf..d0d4b6a39 100644 --- a/include/tgbot/types/ChatBoostSourceGiftCode.h +++ b/include/maxbot/types/ChatBoostSourceGiftCode.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_CHATBOOSTSOURCEGIFTCODE_H -#define TGBOT_CHATBOOSTSOURCEGIFTCODE_H +#ifndef MAXBOT_CHATBOOSTSOURCEGIFTCODE_H +#define MAXBOT_CHATBOOSTSOURCEGIFTCODE_H -#include "tgbot/types/ChatBoostSource.h" +#include "maxbot/types/ChatBoostSource.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. @@ -27,4 +27,4 @@ class ChatBoostSourceGiftCode : public ChatBoostSource { }; } -#endif //TGBOT_CHATBOOSTSOURCEGIFTCODE_H +#endif //MAXBOT_CHATBOOSTSOURCEGIFTCODE_H diff --git a/include/tgbot/types/ChatBoostSourceGiveaway.h b/include/maxbot/types/ChatBoostSourceGiveaway.h similarity index 82% rename from include/tgbot/types/ChatBoostSourceGiveaway.h rename to include/maxbot/types/ChatBoostSourceGiveaway.h index 8f86ab7fb..4598d9ab5 100644 --- a/include/tgbot/types/ChatBoostSourceGiveaway.h +++ b/include/maxbot/types/ChatBoostSourceGiveaway.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CHATBOOSTSOURCEGIVEAWAY_H -#define TGBOT_CHATBOOSTSOURCEGIVEAWAY_H +#ifndef MAXBOT_CHATBOOSTSOURCEGIVEAWAY_H +#define MAXBOT_CHATBOOSTSOURCEGIVEAWAY_H -#include "tgbot/types/ChatBoostSource.h" +#include "maxbot/types/ChatBoostSource.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief The boost was obtained by the creation of a Telegram Premium giveaway. @@ -40,4 +40,4 @@ class ChatBoostSourceGiveaway : public ChatBoostSource { }; } -#endif //TGBOT_CHATBOOSTSOURCEGIVEAWAY_H +#endif //MAXBOT_CHATBOOSTSOURCEGIVEAWAY_H diff --git a/include/tgbot/types/ChatBoostSourcePremium.h b/include/maxbot/types/ChatBoostSourcePremium.h similarity index 69% rename from include/tgbot/types/ChatBoostSourcePremium.h rename to include/maxbot/types/ChatBoostSourcePremium.h index 21fda2650..828ece0fa 100644 --- a/include/tgbot/types/ChatBoostSourcePremium.h +++ b/include/maxbot/types/ChatBoostSourcePremium.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_CHATBOOSTSOURCEPREMIUM_H -#define TGBOT_CHATBOOSTSOURCEPREMIUM_H +#ifndef MAXBOT_CHATBOOSTSOURCEPREMIUM_H +#define MAXBOT_CHATBOOSTSOURCEPREMIUM_H -#include "tgbot/types/ChatBoostSource.h" +#include "maxbot/types/ChatBoostSource.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user. @@ -25,4 +25,4 @@ class ChatBoostSourcePremium : public ChatBoostSource { }; } -#endif //TGBOT_CHATBOOSTSOURCEPREMIUM_H +#endif //MAXBOT_CHATBOOSTSOURCEPREMIUM_H diff --git a/include/tgbot/types/ChatBoostUpdated.h b/include/maxbot/types/ChatBoostUpdated.h similarity index 66% rename from include/tgbot/types/ChatBoostUpdated.h rename to include/maxbot/types/ChatBoostUpdated.h index 1fe13db4a..dd28bbc7a 100644 --- a/include/tgbot/types/ChatBoostUpdated.h +++ b/include/maxbot/types/ChatBoostUpdated.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CHATBOOSTUPDATED_H -#define TGBOT_CHATBOOSTUPDATED_H +#ifndef MAXBOT_CHATBOOSTUPDATED_H +#define MAXBOT_CHATBOOSTUPDATED_H -#include "tgbot/types/Chat.h" -#include "tgbot/types/ChatBoost.h" +#include "maxbot/types/Chat.h" +#include "maxbot/types/ChatBoost.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a boost added to a chat or changed. @@ -30,4 +30,4 @@ class ChatBoostUpdated { }; } -#endif //TGBOT_CHATBOOSTUPDATED_H +#endif //MAXBOT_CHATBOOSTUPDATED_H diff --git a/include/tgbot/types/ChatInviteLink.h b/include/maxbot/types/ChatInviteLink.h similarity index 89% rename from include/tgbot/types/ChatInviteLink.h rename to include/maxbot/types/ChatInviteLink.h index b0fb84093..aa511eb42 100644 --- a/include/tgbot/types/ChatInviteLink.h +++ b/include/maxbot/types/ChatInviteLink.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_CPP_CHATINVITELINK_H -#define TGBOT_CPP_CHATINVITELINK_H +#ifndef MAXBOT_CPP_CHATINVITELINK_H +#define MAXBOT_CPP_CHATINVITELINK_H -#include "tgbot/types/User.h" +#include "maxbot/types/User.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents an invite link for a chat. @@ -67,4 +67,4 @@ class ChatInviteLink { }; } -#endif //TGBOT_CPP_CHATINVITELINK_H +#endif //MAXBOT_CPP_CHATINVITELINK_H diff --git a/include/tgbot/types/ChatJoinRequest.h b/include/maxbot/types/ChatJoinRequest.h similarity index 85% rename from include/tgbot/types/ChatJoinRequest.h rename to include/maxbot/types/ChatJoinRequest.h index 301cf6f9d..2b7bd4738 100644 --- a/include/tgbot/types/ChatJoinRequest.h +++ b/include/maxbot/types/ChatJoinRequest.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_CHATJOINREQUEST_H -#define TGBOT_CHATJOINREQUEST_H +#ifndef MAXBOT_CHATJOINREQUEST_H +#define MAXBOT_CHATJOINREQUEST_H -#include "tgbot/types/Chat.h" -#include "tgbot/types/User.h" -#include "tgbot/types/ChatInviteLink.h" +#include "maxbot/types/Chat.h" +#include "maxbot/types/User.h" +#include "maxbot/types/ChatInviteLink.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a join request sent to a chat. @@ -57,4 +57,4 @@ class ChatJoinRequest { }; } -#endif //TGBOT_CHATJOINREQUEST_H +#endif //MAXBOT_CHATJOINREQUEST_H diff --git a/include/tgbot/types/ChatLocation.h b/include/maxbot/types/ChatLocation.h similarity index 74% rename from include/tgbot/types/ChatLocation.h rename to include/maxbot/types/ChatLocation.h index 0abbba0bd..2f287aa3e 100644 --- a/include/tgbot/types/ChatLocation.h +++ b/include/maxbot/types/ChatLocation.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_CPP_CHATLOCATION_H -#define TGBOT_CPP_CHATLOCATION_H +#ifndef MAXBOT_CPP_CHATLOCATION_H +#define MAXBOT_CPP_CHATLOCATION_H -#include "tgbot/types/Location.h" +#include "maxbot/types/Location.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a location to which a chat is connected. @@ -30,4 +30,4 @@ class ChatLocation { }; } -#endif //TGBOT_CPP_CHATLOCATION_H +#endif //MAXBOT_CPP_CHATLOCATION_H diff --git a/include/tgbot/types/ChatMember.h b/include/maxbot/types/ChatMember.h similarity index 78% rename from include/tgbot/types/ChatMember.h rename to include/maxbot/types/ChatMember.h index 183cb8b08..30fabf9e6 100644 --- a/include/tgbot/types/ChatMember.h +++ b/include/maxbot/types/ChatMember.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CHATMEMBER_H -#define TGBOT_CHATMEMBER_H +#ifndef MAXBOT_CHATMEMBER_H +#define MAXBOT_CHATMEMBER_H -#include "tgbot/types/User.h" +#include "maxbot/types/User.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This abstract class is base of all chat members. @@ -36,4 +36,4 @@ class ChatMember { }; } -#endif //TGBOT_CHATMEMBER_H +#endif //MAXBOT_CHATMEMBER_H diff --git a/include/tgbot/types/ChatMemberAdministrator.h b/include/maxbot/types/ChatMemberAdministrator.h similarity index 94% rename from include/tgbot/types/ChatMemberAdministrator.h rename to include/maxbot/types/ChatMemberAdministrator.h index d9f7a45a7..74ab5d019 100644 --- a/include/tgbot/types/ChatMemberAdministrator.h +++ b/include/maxbot/types/ChatMemberAdministrator.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CHATMEMBERADMINISTRATOR_H -#define TGBOT_CHATMEMBERADMINISTRATOR_H +#ifndef MAXBOT_CHATMEMBERADMINISTRATOR_H +#define MAXBOT_CHATMEMBERADMINISTRATOR_H -#include "tgbot/types/ChatMember.h" +#include "maxbot/types/ChatMember.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a [chat member](https://core.telegram.org/bots/api#chatmember) that has some additional privileges. @@ -113,4 +113,4 @@ class ChatMemberAdministrator : public ChatMember { }; } -#endif //TGBOT_CHATMEMBERADMINISTRATOR_H +#endif //MAXBOT_CHATMEMBERADMINISTRATOR_H diff --git a/include/tgbot/types/ChatMemberBanned.h b/include/maxbot/types/ChatMemberBanned.h similarity index 78% rename from include/tgbot/types/ChatMemberBanned.h rename to include/maxbot/types/ChatMemberBanned.h index 1e0f25103..3782b4c32 100644 --- a/include/tgbot/types/ChatMemberBanned.h +++ b/include/maxbot/types/ChatMemberBanned.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CHATMEMBERBANNED_H -#define TGBOT_CHATMEMBERBANNED_H +#ifndef MAXBOT_CHATMEMBERBANNED_H +#define MAXBOT_CHATMEMBERBANNED_H -#include "tgbot/types/ChatMember.h" +#include "maxbot/types/ChatMember.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. @@ -32,4 +32,4 @@ class ChatMemberBanned : public ChatMember { }; } -#endif //TGBOT_CHATMEMBERBANNED_H +#endif //MAXBOT_CHATMEMBERBANNED_H diff --git a/include/tgbot/types/ChatMemberLeft.h b/include/maxbot/types/ChatMemberLeft.h similarity index 70% rename from include/tgbot/types/ChatMemberLeft.h rename to include/maxbot/types/ChatMemberLeft.h index 3431acac7..e472143c5 100644 --- a/include/tgbot/types/ChatMemberLeft.h +++ b/include/maxbot/types/ChatMemberLeft.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_CHATMEMBERLEFT_H -#define TGBOT_CHATMEMBERLEFT_H +#ifndef MAXBOT_CHATMEMBERLEFT_H +#define MAXBOT_CHATMEMBERLEFT_H -#include "tgbot/types/ChatMember.h" +#include "maxbot/types/ChatMember.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a chat member that isn't currently a member of the chat, but may join it themselves. @@ -24,4 +24,4 @@ class ChatMemberLeft : public ChatMember { }; } -#endif //TGBOT_CHATMEMBERLEFT_H +#endif //MAXBOT_CHATMEMBERLEFT_H diff --git a/include/tgbot/types/ChatMemberMember.h b/include/maxbot/types/ChatMemberMember.h similarity index 68% rename from include/tgbot/types/ChatMemberMember.h rename to include/maxbot/types/ChatMemberMember.h index 6bdccd724..fd1a361eb 100644 --- a/include/tgbot/types/ChatMemberMember.h +++ b/include/maxbot/types/ChatMemberMember.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_CHATMEMBERMEMBER_H -#define TGBOT_CHATMEMBERMEMBER_H +#ifndef MAXBOT_CHATMEMBERMEMBER_H +#define MAXBOT_CHATMEMBERMEMBER_H -#include "tgbot/types/ChatMember.h" +#include "maxbot/types/ChatMember.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a chat member that has no additional privileges or restrictions. @@ -24,4 +24,4 @@ class ChatMemberMember : public ChatMember { }; } -#endif //TGBOT_CHATMEMBERMEMBER_H +#endif //MAXBOT_CHATMEMBERMEMBER_H diff --git a/include/tgbot/types/ChatMemberOwner.h b/include/maxbot/types/ChatMemberOwner.h similarity index 78% rename from include/tgbot/types/ChatMemberOwner.h rename to include/maxbot/types/ChatMemberOwner.h index 2881a3388..6cb0295ac 100644 --- a/include/tgbot/types/ChatMemberOwner.h +++ b/include/maxbot/types/ChatMemberOwner.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CHATMEMBEROWNER_H -#define TGBOT_CHATMEMBEROWNER_H +#ifndef MAXBOT_CHATMEMBEROWNER_H +#define MAXBOT_CHATMEMBEROWNER_H -#include "tgbot/types/ChatMember.h" +#include "maxbot/types/ChatMember.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a chat member that owns the chat and has all administrator privileges. @@ -35,4 +35,4 @@ class ChatMemberOwner : public ChatMember { }; } -#endif //TGBOT_CHATMEMBEROWNER_H +#endif //MAXBOT_CHATMEMBEROWNER_H diff --git a/include/tgbot/types/ChatMemberRestricted.h b/include/maxbot/types/ChatMemberRestricted.h similarity index 93% rename from include/tgbot/types/ChatMemberRestricted.h rename to include/maxbot/types/ChatMemberRestricted.h index b02edb3de..d12dac05d 100644 --- a/include/tgbot/types/ChatMemberRestricted.h +++ b/include/maxbot/types/ChatMemberRestricted.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_CHATMEMBERRESTRICTED_H -#define TGBOT_CHATMEMBERRESTRICTED_H +#ifndef MAXBOT_CHATMEMBERRESTRICTED_H +#define MAXBOT_CHATMEMBERRESTRICTED_H -#include "tgbot/types/ChatMember.h" +#include "maxbot/types/ChatMember.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a [chat member](https://core.telegram.org/bots/api#chatmember) that is under certain restrictions in the chat. @@ -110,4 +110,4 @@ class ChatMemberRestricted : public ChatMember { }; } -#endif //TGBOT_CHATMEMBERRESTRICTED_H +#endif //MAXBOT_CHATMEMBERRESTRICTED_H diff --git a/include/tgbot/types/ChatMemberUpdated.h b/include/maxbot/types/ChatMemberUpdated.h similarity index 79% rename from include/tgbot/types/ChatMemberUpdated.h rename to include/maxbot/types/ChatMemberUpdated.h index b45efb1f3..81476b3c6 100644 --- a/include/tgbot/types/ChatMemberUpdated.h +++ b/include/maxbot/types/ChatMemberUpdated.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_CHATMEMBERUPDATED_H -#define TGBOT_CHATMEMBERUPDATED_H +#ifndef MAXBOT_CHATMEMBERUPDATED_H +#define MAXBOT_CHATMEMBERUPDATED_H -#include "tgbot/types/Chat.h" -#include "tgbot/types/User.h" -#include "tgbot/types/ChatMember.h" -#include "tgbot/types/ChatInviteLink.h" +#include "maxbot/types/Chat.h" +#include "maxbot/types/User.h" +#include "maxbot/types/ChatMember.h" +#include "maxbot/types/ChatInviteLink.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents changes in the status of a chat member. @@ -58,4 +58,4 @@ class ChatMemberUpdated { }; } -#endif //TGBOT_CHATMEMBERUPDATED_H +#endif //MAXBOT_CHATMEMBERUPDATED_H diff --git a/include/tgbot/types/ChatPermissions.h b/include/maxbot/types/ChatPermissions.h similarity index 94% rename from include/tgbot/types/ChatPermissions.h rename to include/maxbot/types/ChatPermissions.h index 431586188..887d71843 100644 --- a/include/tgbot/types/ChatPermissions.h +++ b/include/maxbot/types/ChatPermissions.h @@ -1,9 +1,9 @@ -#ifndef TGBOT_CHATPERMISSIONS_H -#define TGBOT_CHATPERMISSIONS_H +#ifndef MAXBOT_CHATPERMISSIONS_H +#define MAXBOT_CHATPERMISSIONS_H #include -namespace TgBot { +namespace MaxBot { /** * @brief Describes actions that a non-administrator user is allowed to take in a chat. @@ -93,4 +93,4 @@ class ChatPermissions { }; } -#endif //TGBOT_CHATPERMISSIONS_H +#endif //MAXBOT_CHATPERMISSIONS_H diff --git a/include/tgbot/types/ChatPhoto.h b/include/maxbot/types/ChatPhoto.h similarity index 91% rename from include/tgbot/types/ChatPhoto.h rename to include/maxbot/types/ChatPhoto.h index 30c702e30..cf92a6da8 100644 --- a/include/tgbot/types/ChatPhoto.h +++ b/include/maxbot/types/ChatPhoto.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_CHATPHOTO_H -#define TGBOT_CHATPHOTO_H +#ifndef MAXBOT_CHATPHOTO_H +#define MAXBOT_CHATPHOTO_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a chat photo. @@ -42,4 +42,4 @@ class ChatPhoto { }; } -#endif //TGBOT_CHATPHOTO_H +#endif //MAXBOT_CHATPHOTO_H diff --git a/include/tgbot/types/ChatShared.h b/include/maxbot/types/ChatShared.h similarity index 90% rename from include/tgbot/types/ChatShared.h rename to include/maxbot/types/ChatShared.h index 6d410d38b..679189ee3 100644 --- a/include/tgbot/types/ChatShared.h +++ b/include/maxbot/types/ChatShared.h @@ -1,14 +1,14 @@ -#ifndef TGBOT_CHATSHARED_H -#define TGBOT_CHATSHARED_H +#ifndef MAXBOT_CHATSHARED_H +#define MAXBOT_CHATSHARED_H -#include "tgbot/types/PhotoSize.h" +#include "maxbot/types/PhotoSize.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button. @@ -52,4 +52,4 @@ class ChatShared { }; } -#endif //TGBOT_CHATSHARED_H +#endif //MAXBOT_CHATSHARED_H diff --git a/include/tgbot/types/ChosenInlineResult.h b/include/maxbot/types/ChosenInlineResult.h similarity index 83% rename from include/tgbot/types/ChosenInlineResult.h rename to include/maxbot/types/ChosenInlineResult.h index d9af6ce91..1a2558f44 100644 --- a/include/tgbot/types/ChosenInlineResult.h +++ b/include/maxbot/types/ChosenInlineResult.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_CHOSENINLINERESULT_H -#define TGBOT_CHOSENINLINERESULT_H +#ifndef MAXBOT_CHOSENINLINERESULT_H +#define MAXBOT_CHOSENINLINERESULT_H -#include "tgbot/types/User.h" -#include "tgbot/types/Location.h" +#include "maxbot/types/User.h" +#include "maxbot/types/Location.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a result of an inline query that was chosen by the user and sent to their chat partner. @@ -48,4 +48,4 @@ class ChosenInlineResult { }; } -#endif //TGBOT_CHOSENINLINERESULT_H +#endif //MAXBOT_CHOSENINLINERESULT_H diff --git a/include/tgbot/types/Contact.h b/include/maxbot/types/Contact.h similarity index 86% rename from include/tgbot/types/Contact.h rename to include/maxbot/types/Contact.h index a6bee7274..95bb1b9f8 100644 --- a/include/tgbot/types/Contact.h +++ b/include/maxbot/types/Contact.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_CPP_CONTACT_H -#define TGBOT_CPP_CONTACT_H +#ifndef MAXBOT_CPP_CONTACT_H +#define MAXBOT_CPP_CONTACT_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a phone contact. @@ -44,4 +44,4 @@ class Contact { } -#endif //TGBOT_CPP_CONTACT_H +#endif //MAXBOT_CPP_CONTACT_H diff --git a/include/tgbot/types/Document.h b/include/maxbot/types/Document.h similarity index 90% rename from include/tgbot/types/Document.h rename to include/maxbot/types/Document.h index c42fe9aac..fbabfec86 100644 --- a/include/tgbot/types/Document.h +++ b/include/maxbot/types/Document.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_DOCUMENT_H -#define TGBOT_DOCUMENT_H +#ifndef MAXBOT_DOCUMENT_H +#define MAXBOT_DOCUMENT_H -#include "tgbot/types/PhotoSize.h" +#include "maxbot/types/PhotoSize.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a general file (as opposed to photos, voice messages and audio files). @@ -55,4 +55,4 @@ class Document { }; } -#endif //TGBOT_DOCUMENT_H +#endif //MAXBOT_DOCUMENT_H diff --git a/include/tgbot/types/EncryptedCredentials.h b/include/maxbot/types/EncryptedCredentials.h similarity index 85% rename from include/tgbot/types/EncryptedCredentials.h rename to include/maxbot/types/EncryptedCredentials.h index f6f323144..c42a2963a 100644 --- a/include/tgbot/types/EncryptedCredentials.h +++ b/include/maxbot/types/EncryptedCredentials.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_CPP_ENCRYPTEDCREDENTIALS_H -#define TGBOT_CPP_ENCRYPTEDCREDENTIALS_H +#ifndef MAXBOT_CPP_ENCRYPTEDCREDENTIALS_H +#define MAXBOT_CPP_ENCRYPTEDCREDENTIALS_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Contains data required for decrypting and authenticating EncryptedPassportElement. @@ -34,4 +34,4 @@ class EncryptedCredentials { }; } -#endif //TGBOT_CPP_ENCRYPTEDCREDENTIALS_H +#endif //MAXBOT_CPP_ENCRYPTEDCREDENTIALS_H diff --git a/include/tgbot/types/EncryptedPassportElement.h b/include/maxbot/types/EncryptedPassportElement.h similarity index 94% rename from include/tgbot/types/EncryptedPassportElement.h rename to include/maxbot/types/EncryptedPassportElement.h index 4547fd5d7..6540a3202 100644 --- a/include/tgbot/types/EncryptedPassportElement.h +++ b/include/maxbot/types/EncryptedPassportElement.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_ENCRYPTEDPASSPORTELEMENT_H -#define TGBOT_ENCRYPTEDPASSPORTELEMENT_H +#ifndef MAXBOT_ENCRYPTEDPASSPORTELEMENT_H +#define MAXBOT_ENCRYPTEDPASSPORTELEMENT_H -#include "tgbot/types/PassportFile.h" +#include "maxbot/types/PassportFile.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Describes documents or other Telegram Passport elements shared with the bot by the user. @@ -83,4 +83,4 @@ class EncryptedPassportElement { }; } -#endif //TGBOT_ENCRYPTEDPASSPORTELEMENT_H +#endif //MAXBOT_ENCRYPTEDPASSPORTELEMENT_H diff --git a/include/tgbot/types/ExternalReplyInfo.h b/include/maxbot/types/ExternalReplyInfo.h similarity index 71% rename from include/tgbot/types/ExternalReplyInfo.h rename to include/maxbot/types/ExternalReplyInfo.h index d2d40f995..d5675f7e4 100644 --- a/include/tgbot/types/ExternalReplyInfo.h +++ b/include/maxbot/types/ExternalReplyInfo.h @@ -1,33 +1,30 @@ -#ifndef TGBOT_EXTERNALREPLYINFO_H -#define TGBOT_EXTERNALREPLYINFO_H - -#include "tgbot/types/MessageOrigin.h" -#include "tgbot/types/Chat.h" -#include "tgbot/types/LinkPreviewOptions.h" -#include "tgbot/types/Animation.h" -#include "tgbot/types/Audio.h" -#include "tgbot/types/Document.h" -#include "tgbot/types/PhotoSize.h" -#include "tgbot/types/Sticker.h" -#include "tgbot/types/Story.h" -#include "tgbot/types/Video.h" -#include "tgbot/types/VideoNote.h" -#include "tgbot/types/Voice.h" -#include "tgbot/types/Contact.h" -#include "tgbot/types/Dice.h" -#include "tgbot/types/Game.h" -#include "tgbot/types/Giveaway.h" -#include "tgbot/types/GiveawayWinners.h" -#include "tgbot/types/Invoice.h" -#include "tgbot/types/Location.h" -#include "tgbot/types/Poll.h" -#include "tgbot/types/Venue.h" +#ifndef MAXBOT_EXTERNALREPLYINFO_H +#define MAXBOT_EXTERNALREPLYINFO_H + +#include "maxbot/types/MessageOrigin.h" +#include "maxbot/types/Chat.h" +#include "maxbot/types/LinkPreviewOptions.h" +#include "maxbot/types/Animation.h" +#include "maxbot/types/Audio.h" +#include "maxbot/types/Document.h" +#include "maxbot/types/PhotoSize.h" +#include "maxbot/types/Sticker.h" +#include "maxbot/types/Story.h" +#include "maxbot/types/Video.h" +#include "maxbot/types/VideoNote.h" +#include "maxbot/types/Voice.h" +#include "maxbot/types/Contact.h" +#include "maxbot/types/Giveaway.h" +#include "maxbot/types/GiveawayWinners.h" +#include "maxbot/types/Invoice.h" +#include "maxbot/types/Location.h" +#include "maxbot/types/Poll.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object contains information about a message that is being replied to, which may come from another chat or forum topic. @@ -118,18 +115,6 @@ class ExternalReplyInfo { */ Contact::Ptr contact; - /** - * @brief Optional. Message is a dice with random value - */ - Dice::Ptr dice; - - /** - * @brief Optional. Message is a game, information about the game. - * - * [More about games »](https://core.telegram.org/bots/api#games) - */ - Game::Ptr game; - /** * @brief Optional. Message is a scheduled giveaway, information about the giveaway */ @@ -156,12 +141,7 @@ class ExternalReplyInfo { * @brief Optional. Message is a native poll, information about the poll */ Poll::Ptr poll; - - /** - * @brief Optional. Message is a venue, information about the venue - */ - Venue::Ptr venue; }; } -#endif //TGBOT_EXTERNALREPLYINFO_H +#endif //MAXBOT_EXTERNALREPLYINFO_H diff --git a/include/tgbot/types/File.h b/include/maxbot/types/File.h similarity index 94% rename from include/tgbot/types/File.h rename to include/maxbot/types/File.h index b1f3ee5a8..09e9ec153 100644 --- a/include/tgbot/types/File.h +++ b/include/maxbot/types/File.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_FILE_H -#define TGBOT_FILE_H +#ifndef MAXBOT_FILE_H +#define MAXBOT_FILE_H #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a file ready to be downloaded. @@ -49,4 +49,4 @@ class File { }; } -#endif //TGBOT_FILE_H +#endif //MAXBOT_FILE_H diff --git a/include/tgbot/types/ForceReply.h b/include/maxbot/types/ForceReply.h similarity index 93% rename from include/tgbot/types/ForceReply.h rename to include/maxbot/types/ForceReply.h index 131e1cb86..fd7e92864 100644 --- a/include/tgbot/types/ForceReply.h +++ b/include/maxbot/types/ForceReply.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_FORCEREPLY_H -#define TGBOT_FORCEREPLY_H +#ifndef MAXBOT_FORCEREPLY_H +#define MAXBOT_FORCEREPLY_H -#include "tgbot/types/GenericReply.h" +#include "maxbot/types/GenericReply.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). @@ -46,4 +46,4 @@ class ForceReply : public GenericReply { }; } -#endif //TGBOT_FORCEREPLY_H +#endif //MAXBOT_FORCEREPLY_H diff --git a/include/tgbot/types/GeneralForumTopicHidden.h b/include/maxbot/types/GeneralForumTopicHidden.h similarity index 66% rename from include/tgbot/types/GeneralForumTopicHidden.h rename to include/maxbot/types/GeneralForumTopicHidden.h index 1a32a773c..db25061bf 100644 --- a/include/tgbot/types/GeneralForumTopicHidden.h +++ b/include/maxbot/types/GeneralForumTopicHidden.h @@ -1,9 +1,9 @@ -#ifndef TGBOT_GENERALFORUMTOPICHIDDEN_H -#define TGBOT_GENERALFORUMTOPICHIDDEN_H +#ifndef MAXBOT_GENERALFORUMTOPICHIDDEN_H +#define MAXBOT_GENERALFORUMTOPICHIDDEN_H #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a service message about General forum topic hidden in the chat. @@ -18,4 +18,4 @@ class GeneralForumTopicHidden { }; } -#endif //TGBOT_GENERALFORUMTOPICHIDDEN_H +#endif //MAXBOT_GENERALFORUMTOPICHIDDEN_H diff --git a/include/tgbot/types/GeneralForumTopicUnhidden.h b/include/maxbot/types/GeneralForumTopicUnhidden.h similarity index 66% rename from include/tgbot/types/GeneralForumTopicUnhidden.h rename to include/maxbot/types/GeneralForumTopicUnhidden.h index e2b33a32c..9b61b5386 100644 --- a/include/tgbot/types/GeneralForumTopicUnhidden.h +++ b/include/maxbot/types/GeneralForumTopicUnhidden.h @@ -1,9 +1,9 @@ -#ifndef TGBOT_GENERALFORUMTOPICUNHIDDEN_H -#define TGBOT_GENERALFORUMTOPICUNHIDDEN_H +#ifndef MAXBOT_GENERALFORUMTOPICUNHIDDEN_H +#define MAXBOT_GENERALFORUMTOPICUNHIDDEN_H #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a service message about General forum topic unhidden in the chat. @@ -18,4 +18,4 @@ class GeneralForumTopicUnhidden { }; } -#endif //TGBOT_GENERALFORUMTOPICUNHIDDEN_H +#endif //MAXBOT_GENERALFORUMTOPICUNHIDDEN_H diff --git a/include/tgbot/types/GenericReply.h b/include/maxbot/types/GenericReply.h similarity index 65% rename from include/tgbot/types/GenericReply.h rename to include/maxbot/types/GenericReply.h index e86e11266..a8fdde5bd 100644 --- a/include/tgbot/types/GenericReply.h +++ b/include/maxbot/types/GenericReply.h @@ -1,9 +1,9 @@ -#ifndef TGBOT_CPP_GENERICREPLY_H -#define TGBOT_CPP_GENERICREPLY_H +#ifndef MAXBOT_CPP_GENERICREPLY_H +#define MAXBOT_CPP_GENERICREPLY_H #include -namespace TgBot { +namespace MaxBot { /** * @brief This abstract class is base of all keyboard related events. @@ -19,4 +19,4 @@ class GenericReply { } -#endif //TGBOT_CPP_GENERICREPLY_H +#endif //MAXBOT_CPP_GENERICREPLY_H diff --git a/include/tgbot/types/Giveaway.h b/include/maxbot/types/Giveaway.h similarity index 92% rename from include/tgbot/types/Giveaway.h rename to include/maxbot/types/Giveaway.h index 672a1bdb6..e8f913650 100644 --- a/include/tgbot/types/Giveaway.h +++ b/include/maxbot/types/Giveaway.h @@ -1,14 +1,14 @@ -#ifndef TGBOT_GIVEAWAY_H -#define TGBOT_GIVEAWAY_H +#ifndef MAXBOT_GIVEAWAY_H +#define MAXBOT_GIVEAWAY_H -#include "tgbot/types/Chat.h" +#include "maxbot/types/Chat.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a message about a scheduled giveaway. @@ -65,4 +65,4 @@ class Giveaway { }; } -#endif //TGBOT_GIVEAWAY_H +#endif //MAXBOT_GIVEAWAY_H diff --git a/include/tgbot/types/GiveawayCompleted.h b/include/maxbot/types/GiveawayCompleted.h similarity index 83% rename from include/tgbot/types/GiveawayCompleted.h rename to include/maxbot/types/GiveawayCompleted.h index c48ea6805..13f245dc2 100644 --- a/include/tgbot/types/GiveawayCompleted.h +++ b/include/maxbot/types/GiveawayCompleted.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_GIVEAWAYCOMPLETED_H -#define TGBOT_GIVEAWAYCOMPLETED_H +#ifndef MAXBOT_GIVEAWAYCOMPLETED_H +#define MAXBOT_GIVEAWAYCOMPLETED_H #include #include -namespace TgBot { +namespace MaxBot { class Message; @@ -35,4 +35,4 @@ class GiveawayCompleted { }; } -#endif //TGBOT_GIVEAWAYCOMPLETED_H +#endif //MAXBOT_GIVEAWAYCOMPLETED_H diff --git a/include/tgbot/types/GiveawayCreated.h b/include/maxbot/types/GiveawayCreated.h similarity index 69% rename from include/tgbot/types/GiveawayCreated.h rename to include/maxbot/types/GiveawayCreated.h index 9ef6f87ea..b72dd90c7 100644 --- a/include/tgbot/types/GiveawayCreated.h +++ b/include/maxbot/types/GiveawayCreated.h @@ -1,9 +1,9 @@ -#ifndef TGBOT_GIVEAWAYCREATED_H -#define TGBOT_GIVEAWAYCREATED_H +#ifndef MAXBOT_GIVEAWAYCREATED_H +#define MAXBOT_GIVEAWAYCREATED_H #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a service message about the creation of a scheduled giveaway. @@ -19,4 +19,4 @@ class GiveawayCreated { }; } -#endif //TGBOT_GIVEAWAYCREATED_H +#endif //MAXBOT_GIVEAWAYCREATED_H diff --git a/include/tgbot/types/GiveawayWinners.h b/include/maxbot/types/GiveawayWinners.h similarity index 90% rename from include/tgbot/types/GiveawayWinners.h rename to include/maxbot/types/GiveawayWinners.h index 05d02f14a..3c22b0f60 100644 --- a/include/tgbot/types/GiveawayWinners.h +++ b/include/maxbot/types/GiveawayWinners.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_GIVEAWAYWINNERS_H -#define TGBOT_GIVEAWAYWINNERS_H +#ifndef MAXBOT_GIVEAWAYWINNERS_H +#define MAXBOT_GIVEAWAYWINNERS_H -#include "tgbot/types/Chat.h" -#include "tgbot/types/User.h" +#include "maxbot/types/Chat.h" +#include "maxbot/types/User.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a message about the completion of a giveaway with public winners. @@ -78,4 +78,4 @@ class GiveawayWinners { }; } -#endif //TGBOT_GIVEAWAYWINNERS_H +#endif //MAXBOT_GIVEAWAYWINNERS_H diff --git a/include/tgbot/types/InaccessibleMessage.h b/include/maxbot/types/InaccessibleMessage.h similarity index 78% rename from include/tgbot/types/InaccessibleMessage.h rename to include/maxbot/types/InaccessibleMessage.h index d0c7a4b21..60aa18fd6 100644 --- a/include/tgbot/types/InaccessibleMessage.h +++ b/include/maxbot/types/InaccessibleMessage.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INACCESSIBLEMESSAGE_H -#define TGBOT_INACCESSIBLEMESSAGE_H +#ifndef MAXBOT_INACCESSIBLEMESSAGE_H +#define MAXBOT_INACCESSIBLEMESSAGE_H -#include "tgbot/types/Chat.h" +#include "maxbot/types/Chat.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object describes a message that was deleted or is otherwise inaccessible to the bot. @@ -37,4 +37,4 @@ class InaccessibleMessage { }; } -#endif //TGBOT_INACCESSIBLEMESSAGE_H +#endif //MAXBOT_INACCESSIBLEMESSAGE_H diff --git a/include/tgbot/types/InlineKeyboardButton.h b/include/maxbot/types/InlineKeyboardButton.h similarity index 91% rename from include/tgbot/types/InlineKeyboardButton.h rename to include/maxbot/types/InlineKeyboardButton.h index c71b5db57..cffdaebfe 100644 --- a/include/tgbot/types/InlineKeyboardButton.h +++ b/include/maxbot/types/InlineKeyboardButton.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INLINEKEYBOARDBUTTON_H -#define TGBOT_INLINEKEYBOARDBUTTON_H +#ifndef MAXBOT_INLINEKEYBOARDBUTTON_H +#define MAXBOT_INLINEKEYBOARDBUTTON_H -#include "tgbot/types/WebAppInfo.h" -#include "tgbot/types/LoginUrl.h" -#include "tgbot/types/SwitchInlineQueryChosenChat.h" -#include "tgbot/types/CallbackGame.h" +#include "maxbot/types/WebAppInfo.h" +#include "maxbot/types/LoginUrl.h" +#include "maxbot/types/SwitchInlineQueryChosenChat.h" +#include "maxbot/types/CallbackGame.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents one button of an inline keyboard. @@ -91,4 +91,4 @@ class InlineKeyboardButton { }; } -#endif //TGBOT_INLINEKEYBOARDBUTTON_H +#endif //MAXBOT_INLINEKEYBOARDBUTTON_H diff --git a/include/tgbot/types/InlineKeyboardMarkup.h b/include/maxbot/types/InlineKeyboardMarkup.h similarity index 71% rename from include/tgbot/types/InlineKeyboardMarkup.h rename to include/maxbot/types/InlineKeyboardMarkup.h index 13466c5ca..063da88c2 100644 --- a/include/tgbot/types/InlineKeyboardMarkup.h +++ b/include/maxbot/types/InlineKeyboardMarkup.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_INLINEKEYBOARDMARKUP_H -#define TGBOT_INLINEKEYBOARDMARKUP_H +#ifndef MAXBOT_INLINEKEYBOARDMARKUP_H +#define MAXBOT_INLINEKEYBOARDMARKUP_H -#include "tgbot/types/GenericReply.h" -#include "tgbot/types/InlineKeyboardButton.h" +#include "maxbot/types/GenericReply.h" +#include "maxbot/types/InlineKeyboardButton.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) that appears right next to the message it belongs to. @@ -27,4 +27,4 @@ class InlineKeyboardMarkup : public GenericReply { }; } -#endif //TGBOT_INLINEKEYBOARDMARKUP_H +#endif //MAXBOT_INLINEKEYBOARDMARKUP_H diff --git a/include/tgbot/types/InlineQuery.h b/include/maxbot/types/InlineQuery.h similarity index 87% rename from include/tgbot/types/InlineQuery.h rename to include/maxbot/types/InlineQuery.h index ad04b8f51..56f78715e 100644 --- a/include/tgbot/types/InlineQuery.h +++ b/include/maxbot/types/InlineQuery.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_INLINEQUERY_H -#define TGBOT_INLINEQUERY_H +#ifndef MAXBOT_INLINEQUERY_H +#define MAXBOT_INLINEQUERY_H -#include "tgbot/types/User.h" -#include "tgbot/types/Location.h" +#include "maxbot/types/User.h" +#include "maxbot/types/Location.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents an incoming inline query. @@ -53,4 +53,4 @@ class InlineQuery { }; } -#endif //TGBOT_INLINEQUERY_H +#endif //MAXBOT_INLINEQUERY_H diff --git a/include/tgbot/types/InlineQueryResult.h b/include/maxbot/types/InlineQueryResult.h similarity index 89% rename from include/tgbot/types/InlineQueryResult.h rename to include/maxbot/types/InlineQueryResult.h index e2049715a..9db151082 100644 --- a/include/tgbot/types/InlineQueryResult.h +++ b/include/maxbot/types/InlineQueryResult.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INLINEQUERYRESULT_H -#define TGBOT_INLINEQUERYRESULT_H +#ifndef MAXBOT_INLINEQUERYRESULT_H +#define MAXBOT_INLINEQUERYRESULT_H -#include "tgbot/types/InlineKeyboardMarkup.h" +#include "maxbot/types/InlineKeyboardMarkup.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents one result of an inline query. @@ -63,4 +63,4 @@ class InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULT_H +#endif //MAXBOT_INLINEQUERYRESULT_H diff --git a/include/tgbot/types/InlineQueryResultArticle.h b/include/maxbot/types/InlineQueryResultArticle.h similarity index 83% rename from include/tgbot/types/InlineQueryResultArticle.h rename to include/maxbot/types/InlineQueryResultArticle.h index 5f61f17f5..e6f8e0d85 100644 --- a/include/tgbot/types/InlineQueryResultArticle.h +++ b/include/maxbot/types/InlineQueryResultArticle.h @@ -1,14 +1,14 @@ -#ifndef TGBOT_INLINEQUERYRESULTARTICLE_H -#define TGBOT_INLINEQUERYRESULTARTICLE_H +#ifndef MAXBOT_INLINEQUERYRESULTARTICLE_H +#define MAXBOT_INLINEQUERYRESULTARTICLE_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to an article of web page. @@ -67,4 +67,4 @@ class InlineQueryResultArticle : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTARTICLE_H +#endif //MAXBOT_INLINEQUERYRESULTARTICLE_H diff --git a/include/tgbot/types/InlineQueryResultAudio.h b/include/maxbot/types/InlineQueryResultAudio.h similarity index 85% rename from include/tgbot/types/InlineQueryResultAudio.h rename to include/maxbot/types/InlineQueryResultAudio.h index e4324d318..68eaaefe1 100644 --- a/include/tgbot/types/InlineQueryResultAudio.h +++ b/include/maxbot/types/InlineQueryResultAudio.h @@ -1,16 +1,16 @@ -#ifndef TGBOT_INLINEQUERYRESULTAUDIO_H -#define TGBOT_INLINEQUERYRESULTAUDIO_H +#ifndef MAXBOT_INLINEQUERYRESULTAUDIO_H +#define MAXBOT_INLINEQUERYRESULTAUDIO_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to an MP3 audio file. @@ -75,4 +75,4 @@ class InlineQueryResultAudio : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTAUDIO_H +#endif //MAXBOT_INLINEQUERYRESULTAUDIO_H diff --git a/include/tgbot/types/InlineQueryResultCachedAudio.h b/include/maxbot/types/InlineQueryResultCachedAudio.h similarity index 82% rename from include/tgbot/types/InlineQueryResultCachedAudio.h rename to include/maxbot/types/InlineQueryResultCachedAudio.h index 303f4a053..9610fe747 100644 --- a/include/tgbot/types/InlineQueryResultCachedAudio.h +++ b/include/maxbot/types/InlineQueryResultCachedAudio.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INLINEQUERYRESULTCACHEDAUDIO_H -#define TGBOT_INLINEQUERYRESULTCACHEDAUDIO_H +#ifndef MAXBOT_INLINEQUERYRESULTCACHEDAUDIO_H +#define MAXBOT_INLINEQUERYRESULTCACHEDAUDIO_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to an MP3 audio file stored on the Telegram servers. @@ -59,4 +59,4 @@ class InlineQueryResultCachedAudio : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCACHEDAUDIO_H +#endif //MAXBOT_INLINEQUERYRESULTCACHEDAUDIO_H diff --git a/include/tgbot/types/InlineQueryResultCachedDocument.h b/include/maxbot/types/InlineQueryResultCachedDocument.h similarity index 84% rename from include/tgbot/types/InlineQueryResultCachedDocument.h rename to include/maxbot/types/InlineQueryResultCachedDocument.h index 950369d39..e7c12aa65 100644 --- a/include/tgbot/types/InlineQueryResultCachedDocument.h +++ b/include/maxbot/types/InlineQueryResultCachedDocument.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INLINEQUERYRESULTCACHEDDOCUMENT_H -#define TGBOT_INLINEQUERYRESULTCACHEDDOCUMENT_H +#ifndef MAXBOT_INLINEQUERYRESULTCACHEDDOCUMENT_H +#define MAXBOT_INLINEQUERYRESULTCACHEDDOCUMENT_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a file stored on the Telegram servers. @@ -69,4 +69,4 @@ class InlineQueryResultCachedDocument : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCACHEDDOCUMENT_H +#endif //MAXBOT_INLINEQUERYRESULTCACHEDDOCUMENT_H diff --git a/include/tgbot/types/InlineQueryResultCachedGif.h b/include/maxbot/types/InlineQueryResultCachedGif.h similarity index 84% rename from include/tgbot/types/InlineQueryResultCachedGif.h rename to include/maxbot/types/InlineQueryResultCachedGif.h index b75ca397f..bba7a86e1 100644 --- a/include/tgbot/types/InlineQueryResultCachedGif.h +++ b/include/maxbot/types/InlineQueryResultCachedGif.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INLINEQUERYRESULTCACHEDGIF_H -#define TGBOT_INLINEQUERYRESULTCACHEDGIF_H +#ifndef MAXBOT_INLINEQUERYRESULTCACHEDGIF_H +#define MAXBOT_INLINEQUERYRESULTCACHEDGIF_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to an animated GIF file stored on the Telegram servers. @@ -61,4 +61,4 @@ class InlineQueryResultCachedGif : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCACHEDGIF_H +#endif //MAXBOT_INLINEQUERYRESULTCACHEDGIF_H diff --git a/include/tgbot/types/InlineQueryResultCachedMpeg4Gif.h b/include/maxbot/types/InlineQueryResultCachedMpeg4Gif.h similarity index 83% rename from include/tgbot/types/InlineQueryResultCachedMpeg4Gif.h rename to include/maxbot/types/InlineQueryResultCachedMpeg4Gif.h index 91bc4ae5e..c187e5cfc 100644 --- a/include/tgbot/types/InlineQueryResultCachedMpeg4Gif.h +++ b/include/maxbot/types/InlineQueryResultCachedMpeg4Gif.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INLINEQUERYRESULTCACHEDMPEG4GIF_H -#define TGBOT_INLINEQUERYRESULTCACHEDMPEG4GIF_H +#ifndef MAXBOT_INLINEQUERYRESULTCACHEDMPEG4GIF_H +#define MAXBOT_INLINEQUERYRESULTCACHEDMPEG4GIF_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. @@ -61,4 +61,4 @@ class InlineQueryResultCachedMpeg4Gif : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCACHEDMPEG4GIF_H +#endif //MAXBOT_INLINEQUERYRESULTCACHEDMPEG4GIF_H diff --git a/include/tgbot/types/InlineQueryResultCachedPhoto.h b/include/maxbot/types/InlineQueryResultCachedPhoto.h similarity index 84% rename from include/tgbot/types/InlineQueryResultCachedPhoto.h rename to include/maxbot/types/InlineQueryResultCachedPhoto.h index 8ab23e81a..d00b8bb5f 100644 --- a/include/tgbot/types/InlineQueryResultCachedPhoto.h +++ b/include/maxbot/types/InlineQueryResultCachedPhoto.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INLINEQUERYRESULTCACHEDPHOTO_H -#define TGBOT_INLINEQUERYRESULTCACHEDPHOTO_H +#ifndef MAXBOT_INLINEQUERYRESULTCACHEDPHOTO_H +#define MAXBOT_INLINEQUERYRESULTCACHEDPHOTO_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a photo stored on the Telegram servers. @@ -66,4 +66,4 @@ class InlineQueryResultCachedPhoto : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCACHEDPHOTO_H +#endif //MAXBOT_INLINEQUERYRESULTCACHEDPHOTO_H diff --git a/include/tgbot/types/InlineQueryResultCachedSticker.h b/include/maxbot/types/InlineQueryResultCachedSticker.h similarity index 76% rename from include/tgbot/types/InlineQueryResultCachedSticker.h rename to include/maxbot/types/InlineQueryResultCachedSticker.h index d566446ec..8fa8f0af7 100644 --- a/include/tgbot/types/InlineQueryResultCachedSticker.h +++ b/include/maxbot/types/InlineQueryResultCachedSticker.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_INLINEQUERYRESULTCACHEDSTICKER_H -#define TGBOT_INLINEQUERYRESULTCACHEDSTICKER_H +#ifndef MAXBOT_INLINEQUERYRESULTCACHEDSTICKER_H +#define MAXBOT_INLINEQUERYRESULTCACHEDSTICKER_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/InputMessageContent.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a sticker stored on the Telegram servers. @@ -40,4 +40,4 @@ class InlineQueryResultCachedSticker : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCACHEDSTICKER_H +#endif //MAXBOT_INLINEQUERYRESULTCACHEDSTICKER_H diff --git a/include/tgbot/types/InlineQueryResultCachedVideo.h b/include/maxbot/types/InlineQueryResultCachedVideo.h similarity index 84% rename from include/tgbot/types/InlineQueryResultCachedVideo.h rename to include/maxbot/types/InlineQueryResultCachedVideo.h index b82cf345a..cbed4b9b5 100644 --- a/include/tgbot/types/InlineQueryResultCachedVideo.h +++ b/include/maxbot/types/InlineQueryResultCachedVideo.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INLINEQUERYRESULTCACHEDVIDEO_H -#define TGBOT_INLINEQUERYRESULTCACHEDVIDEO_H +#ifndef MAXBOT_INLINEQUERYRESULTCACHEDVIDEO_H +#define MAXBOT_INLINEQUERYRESULTCACHEDVIDEO_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a video file stored on the Telegram servers. @@ -66,4 +66,4 @@ class InlineQueryResultCachedVideo : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCACHEDVIDEO_H +#endif //MAXBOT_INLINEQUERYRESULTCACHEDVIDEO_H diff --git a/include/tgbot/types/InlineQueryResultCachedVoice.h b/include/maxbot/types/InlineQueryResultCachedVoice.h similarity index 83% rename from include/tgbot/types/InlineQueryResultCachedVoice.h rename to include/maxbot/types/InlineQueryResultCachedVoice.h index 1a14df344..5e5051cd3 100644 --- a/include/tgbot/types/InlineQueryResultCachedVoice.h +++ b/include/maxbot/types/InlineQueryResultCachedVoice.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INLINEQUERYRESULTCACHEDVOICE_H -#define TGBOT_INLINEQUERYRESULTCACHEDVOICE_H +#ifndef MAXBOT_INLINEQUERYRESULTCACHEDVOICE_H +#define MAXBOT_INLINEQUERYRESULTCACHEDVOICE_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a voice message stored on the Telegram servers. @@ -64,4 +64,4 @@ class InlineQueryResultCachedVoice : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCACHEDVOICE_H +#endif //MAXBOT_INLINEQUERYRESULTCACHEDVOICE_H diff --git a/include/tgbot/types/InlineQueryResultContact.h b/include/maxbot/types/InlineQueryResultContact.h similarity index 85% rename from include/tgbot/types/InlineQueryResultContact.h rename to include/maxbot/types/InlineQueryResultContact.h index 1773adecf..2bf781a1d 100644 --- a/include/tgbot/types/InlineQueryResultContact.h +++ b/include/maxbot/types/InlineQueryResultContact.h @@ -1,14 +1,14 @@ -#ifndef TGBOT_INLINEQUERYRESULTCONTACT_H -#define TGBOT_INLINEQUERYRESULTCONTACT_H +#ifndef MAXBOT_INLINEQUERYRESULTCONTACT_H +#define MAXBOT_INLINEQUERYRESULTCONTACT_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a contact with a phone number. @@ -71,4 +71,4 @@ class InlineQueryResultContact : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTCONTACT_H +#endif //MAXBOT_INLINEQUERYRESULTCONTACT_H diff --git a/include/tgbot/types/InlineQueryResultDocument.h b/include/maxbot/types/InlineQueryResultDocument.h similarity index 88% rename from include/tgbot/types/InlineQueryResultDocument.h rename to include/maxbot/types/InlineQueryResultDocument.h index 32f27c4f6..000e55128 100644 --- a/include/tgbot/types/InlineQueryResultDocument.h +++ b/include/maxbot/types/InlineQueryResultDocument.h @@ -1,16 +1,16 @@ -#ifndef TGBOT_INLINEQUERYRESULTDOCUMENT_H -#define TGBOT_INLINEQUERYRESULTDOCUMENT_H +#ifndef MAXBOT_INLINEQUERYRESULTDOCUMENT_H +#define MAXBOT_INLINEQUERYRESULTDOCUMENT_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a file. @@ -91,4 +91,4 @@ class InlineQueryResultDocument : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTDOCUMENT_H +#endif //MAXBOT_INLINEQUERYRESULTDOCUMENT_H diff --git a/include/tgbot/types/InlineQueryResultGame.h b/include/maxbot/types/InlineQueryResultGame.h similarity index 69% rename from include/tgbot/types/InlineQueryResultGame.h rename to include/maxbot/types/InlineQueryResultGame.h index 0a56c2204..c0c040f66 100644 --- a/include/tgbot/types/InlineQueryResultGame.h +++ b/include/maxbot/types/InlineQueryResultGame.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INLINEQUERYRESULTGAME_H -#define TGBOT_INLINEQUERYRESULTGAME_H +#ifndef MAXBOT_INLINEQUERYRESULTGAME_H +#define MAXBOT_INLINEQUERYRESULTGAME_H -#include "tgbot/types/InlineQueryResult.h" +#include "maxbot/types/InlineQueryResult.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a Game. @@ -31,4 +31,4 @@ class InlineQueryResultGame : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTGAME_H +#endif //MAXBOT_INLINEQUERYRESULTGAME_H diff --git a/include/tgbot/types/InlineQueryResultGif.h b/include/maxbot/types/InlineQueryResultGif.h similarity index 88% rename from include/tgbot/types/InlineQueryResultGif.h rename to include/maxbot/types/InlineQueryResultGif.h index a5115c97d..6409e52ef 100644 --- a/include/tgbot/types/InlineQueryResultGif.h +++ b/include/maxbot/types/InlineQueryResultGif.h @@ -1,16 +1,16 @@ -#ifndef TGBOT_INLINEQUERYRESULTGIF_H -#define TGBOT_INLINEQUERYRESULTGIF_H +#ifndef MAXBOT_INLINEQUERYRESULTGIF_H +#define MAXBOT_INLINEQUERYRESULTGIF_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to an animated GIF file. @@ -89,4 +89,4 @@ class InlineQueryResultGif : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTGIF_H +#endif //MAXBOT_INLINEQUERYRESULTGIF_H diff --git a/include/tgbot/types/InlineQueryResultLocation.h b/include/maxbot/types/InlineQueryResultLocation.h similarity index 89% rename from include/tgbot/types/InlineQueryResultLocation.h rename to include/maxbot/types/InlineQueryResultLocation.h index cf2f1e0ea..2a506b9c0 100644 --- a/include/tgbot/types/InlineQueryResultLocation.h +++ b/include/maxbot/types/InlineQueryResultLocation.h @@ -1,14 +1,14 @@ -#ifndef TGBOT_INLINEQUERYRESULTLOCATION_H -#define TGBOT_INLINEQUERYRESULTLOCATION_H +#ifndef MAXBOT_INLINEQUERYRESULTLOCATION_H +#define MAXBOT_INLINEQUERYRESULTLOCATION_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a location on a map. @@ -90,4 +90,4 @@ class InlineQueryResultLocation : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTLOCATION_H +#endif //MAXBOT_INLINEQUERYRESULTLOCATION_H diff --git a/include/tgbot/types/InlineQueryResultMpeg4Gif.h b/include/maxbot/types/InlineQueryResultMpeg4Gif.h similarity index 88% rename from include/tgbot/types/InlineQueryResultMpeg4Gif.h rename to include/maxbot/types/InlineQueryResultMpeg4Gif.h index cf6aed424..c6bf16f9c 100644 --- a/include/tgbot/types/InlineQueryResultMpeg4Gif.h +++ b/include/maxbot/types/InlineQueryResultMpeg4Gif.h @@ -1,16 +1,16 @@ -#ifndef TGBOT_INLINEQUERYRESULTMPEG4GIF_H -#define TGBOT_INLINEQUERYRESULTMPEG4GIF_H +#ifndef MAXBOT_INLINEQUERYRESULTMPEG4GIF_H +#define MAXBOT_INLINEQUERYRESULTMPEG4GIF_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). @@ -89,4 +89,4 @@ class InlineQueryResultMpeg4Gif : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTMPEG4GIF_H +#endif //MAXBOT_INLINEQUERYRESULTMPEG4GIF_H diff --git a/include/tgbot/types/InlineQueryResultPhoto.h b/include/maxbot/types/InlineQueryResultPhoto.h similarity index 87% rename from include/tgbot/types/InlineQueryResultPhoto.h rename to include/maxbot/types/InlineQueryResultPhoto.h index 45e855e57..aae078818 100644 --- a/include/tgbot/types/InlineQueryResultPhoto.h +++ b/include/maxbot/types/InlineQueryResultPhoto.h @@ -1,16 +1,16 @@ -#ifndef TGBOT_INLINEQUERYRESULTPHOTO_H -#define TGBOT_INLINEQUERYRESULTPHOTO_H +#ifndef MAXBOT_INLINEQUERYRESULTPHOTO_H +#define MAXBOT_INLINEQUERYRESULTPHOTO_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a photo. @@ -84,4 +84,4 @@ class InlineQueryResultPhoto : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTPHOTO_H +#endif //MAXBOT_INLINEQUERYRESULTPHOTO_H diff --git a/include/tgbot/types/InlineQueryResultVenue.h b/include/maxbot/types/InlineQueryResultVenue.h similarity index 89% rename from include/tgbot/types/InlineQueryResultVenue.h rename to include/maxbot/types/InlineQueryResultVenue.h index 8fc4ef856..846e4386c 100644 --- a/include/tgbot/types/InlineQueryResultVenue.h +++ b/include/maxbot/types/InlineQueryResultVenue.h @@ -1,14 +1,14 @@ -#ifndef TGBOT_INLINEQUERYRESULTVENUE_H -#define TGBOT_INLINEQUERYRESULTVENUE_H +#ifndef MAXBOT_INLINEQUERYRESULTVENUE_H +#define MAXBOT_INLINEQUERYRESULTVENUE_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a venue. @@ -95,4 +95,4 @@ class InlineQueryResultVenue : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTVENUE_H +#endif //MAXBOT_INLINEQUERYRESULTVENUE_H diff --git a/include/tgbot/types/InlineQueryResultVideo.h b/include/maxbot/types/InlineQueryResultVideo.h similarity index 89% rename from include/tgbot/types/InlineQueryResultVideo.h rename to include/maxbot/types/InlineQueryResultVideo.h index 72350587b..c1453875a 100644 --- a/include/tgbot/types/InlineQueryResultVideo.h +++ b/include/maxbot/types/InlineQueryResultVideo.h @@ -1,16 +1,16 @@ -#ifndef TGBOT_INLINEQUERYRESULTVIDEO_H -#define TGBOT_INLINEQUERYRESULTVIDEO_H +#ifndef MAXBOT_INLINEQUERYRESULTVIDEO_H +#define MAXBOT_INLINEQUERYRESULTVIDEO_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a page containing an embedded video player or a video file. @@ -95,4 +95,4 @@ class InlineQueryResultVideo : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTVIDEO_H +#endif //MAXBOT_INLINEQUERYRESULTVIDEO_H diff --git a/include/tgbot/types/InlineQueryResultVoice.h b/include/maxbot/types/InlineQueryResultVoice.h similarity index 85% rename from include/tgbot/types/InlineQueryResultVoice.h rename to include/maxbot/types/InlineQueryResultVoice.h index e64b7fbef..a45931867 100644 --- a/include/tgbot/types/InlineQueryResultVoice.h +++ b/include/maxbot/types/InlineQueryResultVoice.h @@ -1,16 +1,16 @@ -#ifndef TGBOT_INLINEQUERYRESULTVOICE_H -#define TGBOT_INLINEQUERYRESULTVOICE_H +#ifndef MAXBOT_INLINEQUERYRESULTVOICE_H +#define MAXBOT_INLINEQUERYRESULTVOICE_H -#include "tgbot/types/InlineQueryResult.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InlineQueryResult.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/InputMessageContent.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a link to a voice recording in an .OGG container encoded with OPUS. @@ -70,4 +70,4 @@ class InlineQueryResultVoice : public InlineQueryResult { }; } -#endif //TGBOT_INLINEQUERYRESULTVOICE_H +#endif //MAXBOT_INLINEQUERYRESULTVOICE_H diff --git a/include/tgbot/types/InlineQueryResultsButton.h b/include/maxbot/types/InlineQueryResultsButton.h similarity index 90% rename from include/tgbot/types/InlineQueryResultsButton.h rename to include/maxbot/types/InlineQueryResultsButton.h index 3b5f4e0c6..a708bf13e 100644 --- a/include/tgbot/types/InlineQueryResultsButton.h +++ b/include/maxbot/types/InlineQueryResultsButton.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INLINEQUERYRESULTSBUTTON_H -#define TGBOT_INLINEQUERYRESULTSBUTTON_H +#ifndef MAXBOT_INLINEQUERYRESULTSBUTTON_H +#define MAXBOT_INLINEQUERYRESULTSBUTTON_H -#include "tgbot/types/WebAppInfo.h" +#include "maxbot/types/WebAppInfo.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents a button to be shown above inline query results. @@ -43,4 +43,4 @@ class InlineQueryResultsButton { }; } -#endif //TGBOT_INLINEQUERYRESULTSBUTTON_H +#endif //MAXBOT_INLINEQUERYRESULTSBUTTON_H diff --git a/include/tgbot/types/InputContactMessageContent.h b/include/maxbot/types/InputContactMessageContent.h similarity index 80% rename from include/tgbot/types/InputContactMessageContent.h rename to include/maxbot/types/InputContactMessageContent.h index 44e832445..4f56b7bf9 100644 --- a/include/tgbot/types/InputContactMessageContent.h +++ b/include/maxbot/types/InputContactMessageContent.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INPUTCONTACTMESSAGECONTENT_H -#define TGBOT_INPUTCONTACTMESSAGECONTENT_H +#ifndef MAXBOT_INPUTCONTACTMESSAGECONTENT_H +#define MAXBOT_INPUTCONTACTMESSAGECONTENT_H -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InputMessageContent.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the content of a contact message to be sent as the result of an inline query. @@ -45,4 +45,4 @@ class InputContactMessageContent : public InputMessageContent { }; } -#endif //TGBOT_INPUTCONTACTMESSAGECONTENT_H +#endif //MAXBOT_INPUTCONTACTMESSAGECONTENT_H diff --git a/include/tgbot/types/InputFile.h b/include/maxbot/types/InputFile.h similarity index 77% rename from include/tgbot/types/InputFile.h rename to include/maxbot/types/InputFile.h index 0467d87ff..f651885f8 100644 --- a/include/tgbot/types/InputFile.h +++ b/include/maxbot/types/InputFile.h @@ -1,19 +1,19 @@ -#ifndef TGBOT_CPP_INPUTFILE_H -#define TGBOT_CPP_INPUTFILE_H +#ifndef MAXBOT_CPP_INPUTFILE_H +#define MAXBOT_CPP_INPUTFILE_H -#include "tgbot/export.h" +#include "maxbot/export.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object represents the contents of a file to be uploaded. * * @ingroup types */ -class TGBOT_API InputFile { +class MAXBOT_API InputFile { public: typedef std::shared_ptr Ptr; @@ -41,4 +41,4 @@ class TGBOT_API InputFile { } -#endif //TGBOT_CPP_INPUTFILE_H +#endif //MAXBOT_CPP_INPUTFILE_H diff --git a/include/tgbot/types/InputInvoiceMessageContent.h b/include/maxbot/types/InputInvoiceMessageContent.h similarity index 94% rename from include/tgbot/types/InputInvoiceMessageContent.h rename to include/maxbot/types/InputInvoiceMessageContent.h index 36f905610..b7cd4e4f6 100644 --- a/include/tgbot/types/InputInvoiceMessageContent.h +++ b/include/maxbot/types/InputInvoiceMessageContent.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INPUTINVOICEMESSAGECONTENT_H -#define TGBOT_INPUTINVOICEMESSAGECONTENT_H +#ifndef MAXBOT_INPUTINVOICEMESSAGECONTENT_H +#define MAXBOT_INPUTINVOICEMESSAGECONTENT_H -#include "tgbot/types/InputMessageContent.h" -#include "tgbot/types/LabeledPrice.h" +#include "maxbot/types/InputMessageContent.h" +#include "maxbot/types/LabeledPrice.h" #include #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the content of an invoice message to be sent as the result of an inline query. @@ -137,4 +137,4 @@ class InputInvoiceMessageContent : public InputMessageContent { }; } -#endif //TGBOT_INPUTINVOICEMESSAGECONTENT_H +#endif //MAXBOT_INPUTINVOICEMESSAGECONTENT_H diff --git a/include/tgbot/types/InputLocationMessageContent.h b/include/maxbot/types/InputLocationMessageContent.h similarity index 86% rename from include/tgbot/types/InputLocationMessageContent.h rename to include/maxbot/types/InputLocationMessageContent.h index 8b9c22f25..2b677cfa6 100644 --- a/include/tgbot/types/InputLocationMessageContent.h +++ b/include/maxbot/types/InputLocationMessageContent.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_INPUTLOCATIONMESSAGECONTENT_H -#define TGBOT_INPUTLOCATIONMESSAGECONTENT_H +#ifndef MAXBOT_INPUTLOCATIONMESSAGECONTENT_H +#define MAXBOT_INPUTLOCATIONMESSAGECONTENT_H -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InputMessageContent.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the content of a location message to be sent as the result of an inline query. @@ -56,4 +56,4 @@ class InputLocationMessageContent : public InputMessageContent { }; } -#endif //TGBOT_INPUTLOCATIONMESSAGECONTENT_H +#endif //MAXBOT_INPUTLOCATIONMESSAGECONTENT_H diff --git a/include/tgbot/types/InputMedia.h b/include/maxbot/types/InputMedia.h similarity index 90% rename from include/tgbot/types/InputMedia.h rename to include/maxbot/types/InputMedia.h index 9ce50c30f..9c9825e2d 100644 --- a/include/tgbot/types/InputMedia.h +++ b/include/maxbot/types/InputMedia.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_INPUTMEDIA_H -#define TGBOT_INPUTMEDIA_H +#ifndef MAXBOT_INPUTMEDIA_H +#define MAXBOT_INPUTMEDIA_H -#include "tgbot/types/MessageEntity.h" +#include "maxbot/types/MessageEntity.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This abstract class is base of all input media. @@ -56,4 +56,4 @@ class InputMedia { }; } -#endif //TGBOT_INPUTMEDIA_H +#endif //MAXBOT_INPUTMEDIA_H diff --git a/include/tgbot/types/InputMediaAnimation.h b/include/maxbot/types/InputMediaAnimation.h similarity index 89% rename from include/tgbot/types/InputMediaAnimation.h rename to include/maxbot/types/InputMediaAnimation.h index b79f05948..cbf118181 100644 --- a/include/tgbot/types/InputMediaAnimation.h +++ b/include/maxbot/types/InputMediaAnimation.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INPUTMEDIAANIMATION_H -#define TGBOT_INPUTMEDIAANIMATION_H +#ifndef MAXBOT_INPUTMEDIAANIMATION_H +#define MAXBOT_INPUTMEDIAANIMATION_H -#include "tgbot/types/InputMedia.h" +#include "maxbot/types/InputMedia.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. @@ -57,4 +57,4 @@ class InputMediaAnimation : public InputMedia { }; } -#endif //TGBOT_INPUTMEDIAANIMATION_H +#endif //MAXBOT_INPUTMEDIAANIMATION_H diff --git a/include/tgbot/types/InputMediaAudio.h b/include/maxbot/types/InputMediaAudio.h similarity index 88% rename from include/tgbot/types/InputMediaAudio.h rename to include/maxbot/types/InputMediaAudio.h index abfc0232b..992030e85 100644 --- a/include/tgbot/types/InputMediaAudio.h +++ b/include/maxbot/types/InputMediaAudio.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INPUTMEDIAAUDIO_H -#define TGBOT_INPUTMEDIAAUDIO_H +#ifndef MAXBOT_INPUTMEDIAAUDIO_H +#define MAXBOT_INPUTMEDIAAUDIO_H -#include "tgbot/types/InputMedia.h" +#include "maxbot/types/InputMedia.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents an audio file to be treated as music to be sent. @@ -51,4 +51,4 @@ class InputMediaAudio : public InputMedia { }; } -#endif //TGBOT_INPUTMEDIAAUDIO_H +#endif //MAXBOT_INPUTMEDIAAUDIO_H diff --git a/include/tgbot/types/InputMediaDocument.h b/include/maxbot/types/InputMediaDocument.h similarity index 88% rename from include/tgbot/types/InputMediaDocument.h rename to include/maxbot/types/InputMediaDocument.h index 12a02e917..3efb03404 100644 --- a/include/tgbot/types/InputMediaDocument.h +++ b/include/maxbot/types/InputMediaDocument.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INPUTMEDIADOCUMENT_H -#define TGBOT_INPUTMEDIADOCUMENT_H +#ifndef MAXBOT_INPUTMEDIADOCUMENT_H +#define MAXBOT_INPUTMEDIADOCUMENT_H -#include "tgbot/types/InputMedia.h" +#include "maxbot/types/InputMedia.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a general file to be sent. @@ -42,4 +42,4 @@ class InputMediaDocument : public InputMedia { }; } -#endif //TGBOT_INPUTMEDIADOCUMENT_H +#endif //MAXBOT_INPUTMEDIADOCUMENT_H diff --git a/include/tgbot/types/InputMediaPhoto.h b/include/maxbot/types/InputMediaPhoto.h similarity index 73% rename from include/tgbot/types/InputMediaPhoto.h rename to include/maxbot/types/InputMediaPhoto.h index 5897beb81..c56aba56b 100644 --- a/include/tgbot/types/InputMediaPhoto.h +++ b/include/maxbot/types/InputMediaPhoto.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_INPUTMEDIAPHOTO_H -#define TGBOT_INPUTMEDIAPHOTO_H +#ifndef MAXBOT_INPUTMEDIAPHOTO_H +#define MAXBOT_INPUTMEDIAPHOTO_H -#include "tgbot/types/InputMedia.h" +#include "maxbot/types/InputMedia.h" #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a photo to be sent. @@ -29,4 +29,4 @@ class InputMediaPhoto : public InputMedia { }; } -#endif //TGBOT_INPUTMEDIAPHOTO_H +#endif //MAXBOT_INPUTMEDIAPHOTO_H diff --git a/include/tgbot/types/InputMediaVideo.h b/include/maxbot/types/InputMediaVideo.h similarity index 88% rename from include/tgbot/types/InputMediaVideo.h rename to include/maxbot/types/InputMediaVideo.h index 734e7bbde..7c8a1b9b0 100644 --- a/include/tgbot/types/InputMediaVideo.h +++ b/include/maxbot/types/InputMediaVideo.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_INPUTMEDIAVIDEO_H -#define TGBOT_INPUTMEDIAVIDEO_H +#ifndef MAXBOT_INPUTMEDIAVIDEO_H +#define MAXBOT_INPUTMEDIAVIDEO_H -#include "tgbot/types/InputMedia.h" -#include "tgbot/types/InputFile.h" +#include "maxbot/types/InputMedia.h" +#include "maxbot/types/InputFile.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents a video to be sent. @@ -62,4 +62,4 @@ class InputMediaVideo : public InputMedia { }; } -#endif //TGBOT_INPUTMEDIAVIDEO_H +#endif //MAXBOT_INPUTMEDIAVIDEO_H diff --git a/include/tgbot/types/InputMessageContent.h b/include/maxbot/types/InputMessageContent.h similarity index 78% rename from include/tgbot/types/InputMessageContent.h rename to include/maxbot/types/InputMessageContent.h index 01bcf7746..b713d51ee 100644 --- a/include/tgbot/types/InputMessageContent.h +++ b/include/maxbot/types/InputMessageContent.h @@ -1,10 +1,10 @@ -#ifndef TGBOT_INPUTMESSAGECONTENT_H -#define TGBOT_INPUTMESSAGECONTENT_H +#ifndef MAXBOT_INPUTMESSAGECONTENT_H +#define MAXBOT_INPUTMESSAGECONTENT_H #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This abstract class is base of all message contents. @@ -28,4 +28,4 @@ class InputMessageContent { }; } -#endif //TGBOT_INPUTMESSAGECONTENT_H +#endif //MAXBOT_INPUTMESSAGECONTENT_H diff --git a/include/tgbot/types/InputSticker.h b/include/maxbot/types/InputSticker.h similarity index 91% rename from include/tgbot/types/InputSticker.h rename to include/maxbot/types/InputSticker.h index e636ba6ae..f3165936a 100644 --- a/include/tgbot/types/InputSticker.h +++ b/include/maxbot/types/InputSticker.h @@ -1,13 +1,13 @@ -#ifndef TGBOT_INPUTSTICKER_H -#define TGBOT_INPUTSTICKER_H +#ifndef MAXBOT_INPUTSTICKER_H +#define MAXBOT_INPUTSTICKER_H -#include "tgbot/types/MaskPosition.h" +#include "maxbot/types/MaskPosition.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object describes a sticker to be added to a sticker set. @@ -54,4 +54,4 @@ class InputSticker { }; } -#endif //TGBOT_INPUTSTICKER_H +#endif //MAXBOT_INPUTSTICKER_H diff --git a/include/tgbot/types/InputTextMessageContent.h b/include/maxbot/types/InputTextMessageContent.h similarity index 80% rename from include/tgbot/types/InputTextMessageContent.h rename to include/maxbot/types/InputTextMessageContent.h index 12b81fd95..0a07ad4d6 100644 --- a/include/tgbot/types/InputTextMessageContent.h +++ b/include/maxbot/types/InputTextMessageContent.h @@ -1,15 +1,15 @@ -#ifndef TGBOT_INPUTTEXTMESSAGECONTENT_H -#define TGBOT_INPUTTEXTMESSAGECONTENT_H +#ifndef MAXBOT_INPUTTEXTMESSAGECONTENT_H +#define MAXBOT_INPUTTEXTMESSAGECONTENT_H -#include "tgbot/types/InputMessageContent.h" -#include "tgbot/types/MessageEntity.h" -#include "tgbot/types/LinkPreviewOptions.h" +#include "maxbot/types/InputMessageContent.h" +#include "maxbot/types/MessageEntity.h" +#include "maxbot/types/LinkPreviewOptions.h" #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the [content](https://core.telegram.org/bots/api#inputmessagecontent) of a text message to be sent as the result of an inline query. @@ -51,4 +51,4 @@ class InputTextMessageContent : public InputMessageContent { }; } -#endif //TGBOT_INPUTTEXTMESSAGECONTENT_H +#endif //MAXBOT_INPUTTEXTMESSAGECONTENT_H diff --git a/include/tgbot/types/InputVenueMessageContent.h b/include/maxbot/types/InputVenueMessageContent.h similarity index 87% rename from include/tgbot/types/InputVenueMessageContent.h rename to include/maxbot/types/InputVenueMessageContent.h index 41ac5e0ae..9354470dd 100644 --- a/include/tgbot/types/InputVenueMessageContent.h +++ b/include/maxbot/types/InputVenueMessageContent.h @@ -1,12 +1,12 @@ -#ifndef TGBOT_INPUTVENUEMESSAGECONTENT_H -#define TGBOT_INPUTVENUEMESSAGECONTENT_H +#ifndef MAXBOT_INPUTVENUEMESSAGECONTENT_H +#define MAXBOT_INPUTVENUEMESSAGECONTENT_H -#include "tgbot/types/InputMessageContent.h" +#include "maxbot/types/InputMessageContent.h" #include #include -namespace TgBot { +namespace MaxBot { /** * @brief Represents the content of a venue message to be sent as the result of an inline query. @@ -67,4 +67,4 @@ class InputVenueMessageContent : public InputMessageContent { }; } -#endif //TGBOT_INPUTVENUEMESSAGECONTENT_H +#endif //MAXBOT_INPUTVENUEMESSAGECONTENT_H diff --git a/include/tgbot/types/Invoice.h b/include/maxbot/types/Invoice.h similarity index 92% rename from include/tgbot/types/Invoice.h rename to include/maxbot/types/Invoice.h index c399b3344..746fe32a3 100644 --- a/include/tgbot/types/Invoice.h +++ b/include/maxbot/types/Invoice.h @@ -1,11 +1,11 @@ -#ifndef TGBOT_INVOICE_H -#define TGBOT_INVOICE_H +#ifndef MAXBOT_INVOICE_H +#define MAXBOT_INVOICE_H #include #include #include -namespace TgBot { +namespace MaxBot { /** * @brief This object contains basic information about an invoice. @@ -53,4 +53,4 @@ class Invoice { }; } -#endif //TGBOT_INVOICE_H +#endif //MAXBOT_INVOICE_H diff --git a/include/maxbot/types/Keyboard.h b/include/maxbot/types/Keyboard.h new file mode 100644 index 000000000..231219bc4 --- /dev/null +++ b/include/maxbot/types/Keyboard.h @@ -0,0 +1,195 @@ +#pragma once + +#include +#include +#include +#include + +namespace MaxBot { + +/** + * @brief После нажатия на такую кнопку клиент отправляет на сервер полезную нагрузку, которая содержит + */ +class CallbackButton +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Токен кнопки + */ + std::string payload; +}; + +/** + * @brief После нажатия на такую кнопку пользователь переходит по ссылке, которую она содержит + */ +class LinkButton +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief URL для перехода + */ + std::string url; +}; + +/** + * @brief После нажатия на такую кнопку клиент отправляет новое сообщение с вложением текущего контакта пользователя + */ +class RequestContactButton +{ +public: + typedef std::shared_ptr Ptr; +}; + +/** + * @brief После нажатия на такую кнопку клиент отправляет новое сообщение с вложением текущего географического положения пользователя + */ +class RequestGeoLocationButton +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Если *true*, отправляет местоположение без запроса подтверждения пользователя + */ + bool quick = false; +}; + +/** + * @brief Кнопка, которая создает новый чат, как только первый пользователь на нее нажмёт. + * Бот будет добавлен в участники чата как администратор. + * Автор сообщения станет владельцем чата. + */ +class ChatButton +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Название чата, который будет создан + */ + std::string chat_title; + + /** + * @brief Описание чата + */ + std::string chat_description; + + /** + * @brief Стартовая полезная нагрузка будет отправлена боту, как только чат будет создан + */ + std::string start_payload; + + /** + * @brief Уникальный ID кнопки среди всех кнопок чата на клавиатуре. + * Если `uuid` изменён, новый чат будет создан при следующем нажатии. + * Сервер сгенерирует его в момент, когда кнопка будет впервые размещена. + * Используйте его при редактировании сообщения. + */ + std::int64_t uuid; +}; + +/** + * @brief Кнопка для запуска мини-приложения + */ +class OpenAppButton +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Публичное имя (username) бота или ссылка на него, чьё мини-приложение надо запустить + */ + std::string web_app; + + /** + * @brief Идентификатор бота, чьё мини-приложение надо запустить + */ + std::int64_t contact_id; + + /** + * @brief Параметр запуска, который будет передан в [initData](/docs/webapps/bridge#WebAppData) мини-приложения + */ + std::string payload; +}; + +/** + * @brief При нажатии на кнопку с типом `clipboard` текст, указанный в свойстве `payload`, копируется в буфер обмена + */ +class ClipboardButton +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Текст, который будет скопирован + */ + std::string payload; +}; + +/** + * @brief Кнопка для запуска мини-приложения + */ +class MessageButton +{ +public: + typedef std::shared_ptr Ptr; + + /** + * @brief Текст кнопки, который будет отправлен в чат от лица пользователя + */ + // std::string text; +}; + +/** + * @brief Базовый класс для кнопок с дискриминатором + */ +class Button +{ +public: + typedef std::shared_ptr