Skip to content

Commit 283cc4b

Browse files
committed
Update to Bot API 7.2
1 parent 28de9c6 commit 283cc4b

27 files changed

+1085
-216
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Documentation is located [here](http://reo7sp.github.io/tgbot-cpp).
99

1010
## State
1111

12-
- [x] Telegram Bot API 7.1
12+
- [x] Telegram Bot API 7.2
1313
- [ ] [MaybeInaccessibleMessage](https://core.telegram.org/bots/api#maybeinaccessiblemessage)
1414
- [ ] [Message->pinnedMessage](https://core.telegram.org/bots/api#message)
1515
- [ ] [CallbackQuery->message](https://core.telegram.org/bots/api#callbackquery)

include/tgbot/Api.h

Lines changed: 117 additions & 57 deletions
Large diffs are not rendered by default.

include/tgbot/TgTypeParser.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "tgbot/types/ForumTopicReopened.h"
4444
#include "tgbot/types/GeneralForumTopicHidden.h"
4545
#include "tgbot/types/GeneralForumTopicUnhidden.h"
46+
#include "tgbot/types/SharedUser.h"
4647
#include "tgbot/types/UsersShared.h"
4748
#include "tgbot/types/ChatShared.h"
4849
#include "tgbot/types/WriteAccessAllowed.h"
@@ -83,6 +84,11 @@
8384
#include "tgbot/types/ChatMemberBanned.h"
8485
#include "tgbot/types/ChatJoinRequest.h"
8586
#include "tgbot/types/ChatPermissions.h"
87+
#include "tgbot/types/Birthdate.h"
88+
#include "tgbot/types/BusinessIntro.h"
89+
#include "tgbot/types/BusinessLocation.h"
90+
#include "tgbot/types/BusinessOpeningHoursInterval.h"
91+
#include "tgbot/types/BusinessOpeningHours.h"
8692
#include "tgbot/types/ChatLocation.h"
8793
#include "tgbot/types/ReactionType.h"
8894
#include "tgbot/types/ReactionTypeEmoji.h"
@@ -115,6 +121,8 @@
115121
#include "tgbot/types/ChatBoostUpdated.h"
116122
#include "tgbot/types/ChatBoostRemoved.h"
117123
#include "tgbot/types/UserChatBoosts.h"
124+
#include "tgbot/types/BusinessConnection.h"
125+
#include "tgbot/types/BusinessMessagesDeleted.h"
118126
#include "tgbot/types/ResponseParameters.h"
119127
#include "tgbot/types/InputMedia.h"
120128
#include "tgbot/types/InputMediaPhoto.h"
@@ -327,6 +335,9 @@ class TGBOT_API TgTypeParser {
327335
GeneralForumTopicUnhidden::Ptr parseJsonAndGetGeneralForumTopicUnhidden(const boost::property_tree::ptree& data) const;
328336
std::string parseGeneralForumTopicUnhidden(const GeneralForumTopicUnhidden::Ptr& object) const;
329337

338+
SharedUser::Ptr parseJsonAndGetSharedUser(const boost::property_tree::ptree& data) const;
339+
std::string parseSharedUser(const SharedUser::Ptr& object) const;
340+
330341
UsersShared::Ptr parseJsonAndGetUsersShared(const boost::property_tree::ptree& data) const;
331342
std::string parseUsersShared(const UsersShared::Ptr& object) const;
332343

@@ -447,6 +458,21 @@ class TGBOT_API TgTypeParser {
447458
ChatPermissions::Ptr parseJsonAndGetChatPermissions(const boost::property_tree::ptree& data) const;
448459
std::string parseChatPermissions(const ChatPermissions::Ptr& object) const;
449460

461+
Birthdate::Ptr parseJsonAndGetBirthdate(const boost::property_tree::ptree& data) const;
462+
std::string parseBirthdate(const Birthdate::Ptr& object) const;
463+
464+
BusinessIntro::Ptr parseJsonAndGetBusinessIntro(const boost::property_tree::ptree& data) const;
465+
std::string parseBusinessIntro(const BusinessIntro::Ptr& object) const;
466+
467+
BusinessLocation::Ptr parseJsonAndGetBusinessLocation(const boost::property_tree::ptree& data) const;
468+
std::string parseBusinessLocation(const BusinessLocation::Ptr& object) const;
469+
470+
BusinessOpeningHoursInterval::Ptr parseJsonAndGetBusinessOpeningHoursInterval(const boost::property_tree::ptree& data) const;
471+
std::string parseBusinessOpeningHoursInterval(const BusinessOpeningHoursInterval::Ptr& object) const;
472+
473+
BusinessOpeningHours::Ptr parseJsonAndGetBusinessOpeningHours(const boost::property_tree::ptree& data) const;
474+
std::string parseBusinessOpeningHours(const BusinessOpeningHours::Ptr& object) const;
475+
450476
ChatLocation::Ptr parseJsonAndGetChatLocation(const boost::property_tree::ptree& data) const;
451477
std::string parseChatLocation(const ChatLocation::Ptr& object) const;
452478

@@ -543,6 +569,12 @@ class TGBOT_API TgTypeParser {
543569
UserChatBoosts::Ptr parseJsonAndGetUserChatBoosts(const boost::property_tree::ptree& data) const;
544570
std::string parseUserChatBoosts(const UserChatBoosts::Ptr& object) const;
545571

572+
BusinessConnection::Ptr parseJsonAndGetBusinessConnection(const boost::property_tree::ptree& data) const;
573+
std::string parseBusinessConnection(const BusinessConnection::Ptr& object) const;
574+
575+
BusinessMessagesDeleted::Ptr parseJsonAndGetBusinessMessagesDeleted(const boost::property_tree::ptree& data) const;
576+
std::string parseBusinessMessagesDeleted(const BusinessMessagesDeleted::Ptr& object) const;
577+
546578
ResponseParameters::Ptr parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const;
547579
std::string parseResponseParameters(const ResponseParameters::Ptr& object) const;
548580

include/tgbot/types/Birthdate.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#ifndef TGBOT_BIRTHDATE_H
2+
#define TGBOT_BIRTHDATE_H
3+
4+
#include <cstdint>
5+
#include <memory>
6+
7+
namespace TgBot {
8+
9+
/**
10+
* @ingroup types
11+
*/
12+
class Birthdate {
13+
14+
public:
15+
typedef std::shared_ptr<Birthdate> Ptr;
16+
17+
/**
18+
* @brief Day of the user's birth; 1-31
19+
*/
20+
std::uint8_t day;
21+
22+
/**
23+
* @brief Month of the user's birth; 1-12
24+
*/
25+
std::uint8_t month;
26+
27+
/**
28+
* @brief Optional. Year of the user's birth
29+
*/
30+
std::uint16_t year;
31+
};
32+
}
33+
34+
#endif //TGBOT_BIRTHDATE_H
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#ifndef TGBOT_BUSINESSCONNECTION_H
2+
#define TGBOT_BUSINESSCONNECTION_H
3+
4+
#include "tgbot/types/User.h"
5+
6+
#include <cstdint>
7+
#include <memory>
8+
#include <string>
9+
10+
namespace TgBot {
11+
12+
/**
13+
* @brief Describes the connection of the bot with a business account.
14+
*
15+
* @ingroup types
16+
*/
17+
class BusinessConnection {
18+
19+
public:
20+
typedef std::shared_ptr<BusinessConnection> Ptr;
21+
22+
/**
23+
* @brief Unique identifier of the business connection
24+
*/
25+
std::string id;
26+
27+
/**
28+
* @brief Business account user that created the business connection
29+
*/
30+
User::Ptr user;
31+
32+
/**
33+
* @brief Identifier of a private chat with the user who created the business connection.
34+
*
35+
* This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it.
36+
* But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
37+
*/
38+
std::int64_t userChatId;
39+
40+
/**
41+
* @brief Date the connection was established in Unix time
42+
*/
43+
std::uint32_t date;
44+
45+
/**
46+
* @brief True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
47+
*/
48+
bool canReply;
49+
50+
/**
51+
* @brief True, if the connection is active
52+
*/
53+
bool isEnabled;
54+
};
55+
}
56+
57+
#endif //TGBOT_BUSINESSCONNECTION_H

include/tgbot/types/BusinessIntro.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#ifndef TGBOT_BUSINESSINTRO_H
2+
#define TGBOT_BUSINESSINTRO_H
3+
4+
#include "tgbot/types/Sticker.h"
5+
6+
#include <memory>
7+
#include <string>
8+
9+
namespace TgBot {
10+
11+
/**
12+
* @ingroup types
13+
*/
14+
class BusinessIntro {
15+
16+
public:
17+
typedef std::shared_ptr<BusinessIntro> Ptr;
18+
19+
/**
20+
* @brief Optional. Title text of the business intro
21+
*/
22+
std::string title;
23+
24+
/**
25+
* @brief Optional. Message text of the business intro
26+
*/
27+
std::string message;
28+
29+
/**
30+
* @brief Optional. Sticker of the business intro
31+
*/
32+
Sticker::Ptr sticker;
33+
};
34+
}
35+
36+
#endif //TGBOT_BUSINESSINTRO_H
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#ifndef TGBOT_BUSINESSLOCATION_H
2+
#define TGBOT_BUSINESSLOCATION_H
3+
4+
#include "tgbot/types/Location.h"
5+
6+
#include <memory>
7+
#include <string>
8+
9+
namespace TgBot {
10+
11+
/**
12+
* @ingroup types
13+
*/
14+
class BusinessLocation {
15+
16+
public:
17+
typedef std::shared_ptr<BusinessLocation> Ptr;
18+
19+
/**
20+
* @brief Address of the business
21+
*/
22+
std::string address;
23+
24+
/**
25+
* @brief Optional. Location of the business
26+
*/
27+
Location::Ptr location;
28+
};
29+
}
30+
31+
#endif //TGBOT_BUSINESSLOCATION_H
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#ifndef TGBOT_BUSINESSMESSAGESDELETED_H
2+
#define TGBOT_BUSINESSMESSAGESDELETED_H
3+
4+
#include "tgbot/types/Chat.h"
5+
6+
#include <cstdint>
7+
#include <memory>
8+
#include <string>
9+
#include <vector>
10+
11+
namespace TgBot {
12+
13+
/**
14+
* @brief This object is received when messages are deleted from a connected business account.
15+
*
16+
* @ingroup types
17+
*/
18+
class BusinessMessagesDeleted {
19+
20+
public:
21+
typedef std::shared_ptr<BusinessMessagesDeleted> Ptr;
22+
23+
/**
24+
* @brief Unique identifier of the business connection
25+
*/
26+
std::string businessConnectionId;
27+
28+
/**
29+
* @brief Information about a chat in the business account.
30+
*
31+
* The bot may not have access to the chat or the corresponding user.
32+
*/
33+
Chat::Ptr chat;
34+
35+
/**
36+
* @brief A JSON-serialized list of identifiers of deleted messages in the chat of the business account
37+
*/
38+
std::vector<std::int32_t> messageIds;
39+
};
40+
}
41+
42+
#endif //TGBOT_BUSINESSMESSAGESDELETED_H
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ifndef TGBOT_BUSINESSOPENINGHOURS_H
2+
#define TGBOT_BUSINESSOPENINGHOURS_H
3+
4+
#include "tgbot/types/BusinessOpeningHoursInterval.h"
5+
6+
#include <memory>
7+
#include <string>
8+
#include <vector>
9+
10+
namespace TgBot {
11+
12+
/**
13+
* @ingroup types
14+
*/
15+
class BusinessOpeningHours {
16+
17+
public:
18+
typedef std::shared_ptr<BusinessOpeningHours> Ptr;
19+
20+
/**
21+
* @brief Unique name of the time zone for which the opening hours are defined
22+
*/
23+
std::string timeZoneName;
24+
25+
/**
26+
* @brief List of time intervals describing business opening hours
27+
*/
28+
std::vector<BusinessOpeningHoursInterval::Ptr> openingHours;
29+
};
30+
}
31+
32+
#endif //TGBOT_BUSINESSOPENINGHOURS_H
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef TGBOT_BUSINESSOPENINGHOURSINTERVAL_H
2+
#define TGBOT_BUSINESSOPENINGHOURSINTERVAL_H
3+
4+
#include <cstdint>
5+
#include <memory>
6+
7+
namespace TgBot {
8+
9+
/**
10+
* @ingroup types
11+
*/
12+
class BusinessOpeningHoursInterval {
13+
14+
public:
15+
typedef std::shared_ptr<BusinessOpeningHoursInterval> Ptr;
16+
17+
/**
18+
* @brief The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60
19+
*/
20+
std::int32_t openingMinute;
21+
22+
/**
23+
* @brief The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60
24+
*/
25+
std::int32_t closingMinute;
26+
};
27+
}
28+
29+
#endif //TGBOT_BUSINESSOPENINGHOURSINTERVAL_H

0 commit comments

Comments
 (0)