Skip to content

Commit

Permalink
Merge pull request #300 from llnulldisk/master
Browse files Browse the repository at this point in the history
Update to Bot API 7.2
  • Loading branch information
reo7sp authored Jun 10, 2024
2 parents 0910c16 + 283cc4b commit 986a7b5
Show file tree
Hide file tree
Showing 116 changed files with 5,870 additions and 1,482 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ set(SRC_LIST
src/tools/FileTools.cpp
src/tools/StringTools.cpp
src/types/BotCommandScope.cpp
src/types/ChatBoostSource.cpp
src/types/ChatMember.cpp
src/types/InlineQueryResult.cpp
src/types/InputFile.cpp
src/types/InputMedia.cpp
src/types/InputMessageContent.cpp
src/types/MenuButton.cpp
src/types/PassportElementError.cpp)
src/types/MessageOrigin.cpp
src/types/PassportElementError.cpp
src/types/ReactionType.cpp)

# libs
## threads
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Documentation is located [here](http://reo7sp.github.io/tgbot-cpp).

## State

- [x] Telegram Bot API 6.5
- [x] Telegram Bot API 7.2
- [ ] [MaybeInaccessibleMessage](https://core.telegram.org/bots/api#maybeinaccessiblemessage)
- [ ] [Message->pinnedMessage](https://core.telegram.org/bots/api#message)
- [ ] [CallbackQuery->message](https://core.telegram.org/bots/api#callbackquery)
- [ ] [Deep Linking](https://core.telegram.org/bots/features#deep-linking)


## Sample
Expand Down Expand Up @@ -64,7 +68,12 @@ Dependencies:
You can install dependencies on Debian-based distibutives with these commands:

```sh
sudo apt-get install g++ make binutils cmake libboost-system-dev libssl-dev zlib1g-dev libcurl4-openssl-dev
sudo apt install g++ make binutils cmake libboost-system-dev libssl-dev zlib1g-dev libcurl4-openssl-dev
```

Optionally, install the dependencies for testing and documenting
```sh
sudo apt install libboost-test-dev doxygen
```

You can compile and install the library with these commands:
Expand Down Expand Up @@ -99,8 +108,8 @@ Taken from [Vcpkg - Quick Start: Windows](https://github.com/Microsoft/vcpkg/#qu

Prerequisites:
- Windows 7 or newer
- Git
- Visual Studio 2015 Update 3 or greater with the English language pack
- [Git][https://git-scm.com/downloads]
- [Visual Studio][https://visualstudio.microsoft.com] 2015 Update 3 or greater with the English language pack

First, download and bootstrap vcpkg itself; it can be installed anywhere, but generally we recommend using vcpkg as a submodule for CMake projects, and installing it globally for Visual Studio projects. We recommend somewhere like `C:\src\vcpkg` or `C:\dev\vcpkg`, since otherwise you may run into path issues for some port build systems.

Expand Down
815 changes: 533 additions & 282 deletions include/tgbot/Api.h

Large diffs are not rendered by default.

202 changes: 190 additions & 12 deletions include/tgbot/TgTypeParser.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/tgbot/types/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Animation {
/**
* @brief Optional. Animation thumbnail as defined by sender
*/
PhotoSize::Ptr thumb;
PhotoSize::Ptr thumbnail;

/**
* @brief Optional. Original animation filename as defined by sender
Expand Down
2 changes: 1 addition & 1 deletion include/tgbot/types/Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Audio {
/**
* @brief Optional. Thumbnail of the album cover to which the music file belongs
*/
PhotoSize::Ptr thumb;
PhotoSize::Ptr thumbnail;
};
}

Expand Down
34 changes: 34 additions & 0 deletions include/tgbot/types/Birthdate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef TGBOT_BIRTHDATE_H
#define TGBOT_BIRTHDATE_H

#include <cstdint>
#include <memory>

namespace TgBot {

/**
* @ingroup types
*/
class Birthdate {

public:
typedef std::shared_ptr<Birthdate> Ptr;

/**
* @brief Day of the user's birth; 1-31
*/
std::uint8_t day;

/**
* @brief Month of the user's birth; 1-12
*/
std::uint8_t month;

/**
* @brief Optional. Year of the user's birth
*/
std::uint16_t year;
};
}

#endif //TGBOT_BIRTHDATE_H
25 changes: 25 additions & 0 deletions include/tgbot/types/BotDescription.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef TGBOT_BOTDESCRIPTION_H
#define TGBOT_BOTDESCRIPTION_H

#include <memory>
#include <string>

namespace TgBot {

/**
* @brief This object represents the bot's description.
*
* @ingroup types
*/
class BotDescription {
public:
typedef std::shared_ptr<BotDescription> Ptr;

/**
* @brief The bot's description
*/
std::string description;
};
}

#endif //TGBOT_BOTDESCRIPTION_H
25 changes: 25 additions & 0 deletions include/tgbot/types/BotName.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef TGBOT_BOTNAME_H
#define TGBOT_BOTNAME_H

#include <memory>
#include <string>

namespace TgBot {

/**
* @brief This object represents the bot's name.
*
* @ingroup types
*/
class BotName {
public:
typedef std::shared_ptr<BotName> Ptr;

/**
* @brief The bot's name
*/
std::string name;
};
}

#endif //TGBOT_BOTNAME_H
25 changes: 25 additions & 0 deletions include/tgbot/types/BotShortDescription.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef TGBOT_BOTSHORTDESCRIPTION_H
#define TGBOT_BOTSHORTDESCRIPTION_H

#include <memory>
#include <string>

namespace TgBot {

/**
* @brief This object represents the bot's short description.
*
* @ingroup types
*/
class BotShortDescription {
public:
typedef std::shared_ptr<BotShortDescription> Ptr;

/**
* @brief The bot's short description
*/
std::string shortDescription;
};
}

#endif //TGBOT_BOTSHORTDESCRIPTION_H
57 changes: 57 additions & 0 deletions include/tgbot/types/BusinessConnection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#ifndef TGBOT_BUSINESSCONNECTION_H
#define TGBOT_BUSINESSCONNECTION_H

#include "tgbot/types/User.h"

#include <cstdint>
#include <memory>
#include <string>

namespace TgBot {

/**
* @brief Describes the connection of the bot with a business account.
*
* @ingroup types
*/
class BusinessConnection {

public:
typedef std::shared_ptr<BusinessConnection> Ptr;

/**
* @brief Unique identifier of the business connection
*/
std::string id;

/**
* @brief Business account user that created the business connection
*/
User::Ptr user;

/**
* @brief Identifier of a private chat with the user who created the business connection.
*
* This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it.
* But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
*/
std::int64_t userChatId;

/**
* @brief Date the connection was established in Unix time
*/
std::uint32_t date;

/**
* @brief True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
*/
bool canReply;

/**
* @brief True, if the connection is active
*/
bool isEnabled;
};
}

#endif //TGBOT_BUSINESSCONNECTION_H
36 changes: 36 additions & 0 deletions include/tgbot/types/BusinessIntro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef TGBOT_BUSINESSINTRO_H
#define TGBOT_BUSINESSINTRO_H

#include "tgbot/types/Sticker.h"

#include <memory>
#include <string>

namespace TgBot {

/**
* @ingroup types
*/
class BusinessIntro {

public:
typedef std::shared_ptr<BusinessIntro> Ptr;

/**
* @brief Optional. Title text of the business intro
*/
std::string title;

/**
* @brief Optional. Message text of the business intro
*/
std::string message;

/**
* @brief Optional. Sticker of the business intro
*/
Sticker::Ptr sticker;
};
}

#endif //TGBOT_BUSINESSINTRO_H
31 changes: 31 additions & 0 deletions include/tgbot/types/BusinessLocation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifndef TGBOT_BUSINESSLOCATION_H
#define TGBOT_BUSINESSLOCATION_H

#include "tgbot/types/Location.h"

#include <memory>
#include <string>

namespace TgBot {

/**
* @ingroup types
*/
class BusinessLocation {

public:
typedef std::shared_ptr<BusinessLocation> Ptr;

/**
* @brief Address of the business
*/
std::string address;

/**
* @brief Optional. Location of the business
*/
Location::Ptr location;
};
}

#endif //TGBOT_BUSINESSLOCATION_H
42 changes: 42 additions & 0 deletions include/tgbot/types/BusinessMessagesDeleted.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef TGBOT_BUSINESSMESSAGESDELETED_H
#define TGBOT_BUSINESSMESSAGESDELETED_H

#include "tgbot/types/Chat.h"

#include <cstdint>
#include <memory>
#include <string>
#include <vector>

namespace TgBot {

/**
* @brief This object is received when messages are deleted from a connected business account.
*
* @ingroup types
*/
class BusinessMessagesDeleted {

public:
typedef std::shared_ptr<BusinessMessagesDeleted> Ptr;

/**
* @brief Unique identifier of the business connection
*/
std::string businessConnectionId;

/**
* @brief Information about a chat in the business account.
*
* The bot may not have access to the chat or the corresponding user.
*/
Chat::Ptr chat;

/**
* @brief A JSON-serialized list of identifiers of deleted messages in the chat of the business account
*/
std::vector<std::int32_t> messageIds;
};
}

#endif //TGBOT_BUSINESSMESSAGESDELETED_H
32 changes: 32 additions & 0 deletions include/tgbot/types/BusinessOpeningHours.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef TGBOT_BUSINESSOPENINGHOURS_H
#define TGBOT_BUSINESSOPENINGHOURS_H

#include "tgbot/types/BusinessOpeningHoursInterval.h"

#include <memory>
#include <string>
#include <vector>

namespace TgBot {

/**
* @ingroup types
*/
class BusinessOpeningHours {

public:
typedef std::shared_ptr<BusinessOpeningHours> Ptr;

/**
* @brief Unique name of the time zone for which the opening hours are defined
*/
std::string timeZoneName;

/**
* @brief List of time intervals describing business opening hours
*/
std::vector<BusinessOpeningHoursInterval::Ptr> openingHours;
};
}

#endif //TGBOT_BUSINESSOPENINGHOURS_H
Loading

0 comments on commit 986a7b5

Please sign in to comment.