Skip to content

Commit 33e8121

Browse files
committed
Upgrade Telegram Bot API from 6.3 to 9.4 and implement Game, Payments, and Passport APIs
1 parent 27f3ea5 commit 33e8121

21 files changed

Lines changed: 10928 additions & 192 deletions

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
66
SET(EXEC_PREFIX "${PREFIX}/bin")
77
SET(INCLUDEDIR "${PREFIX}/include/${PROJECT_NAME}")
88
SET(LIBDIR "${PREFIX}/lib")
9-
SET(VERSION 6.3.0)
9+
SET(VERSION 9.4.0)
1010

1111
SET(CMAKE_MACOSX_RPATH 1)
1212

1313
SET(SRCS
1414
src/telebot-parser.c
1515
src/telebot-core.c
1616
src/telebot.c
17+
src/telebot-inline.c
18+
src/telebot-forums.c
19+
src/telebot-payments.c
20+
src/telebot-passport.c
21+
src/telebot-games.c
1722
)
1823

1924
ADD_DEFINITIONS("-DDEBUG=0")
@@ -50,5 +55,11 @@ INSTALL(FILES
5055
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-methods.h
5156
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-types.h
5257
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-core.h
58+
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-stickers.h
59+
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-inline.h
60+
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-forums.h
61+
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-payments.h
62+
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-passport.h
63+
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-games.h
5364
DESTINATION include/telebot/)
5465

include/telebot-core.h

Lines changed: 741 additions & 1 deletion
Large diffs are not rendered by default.

include/telebot-forums.h

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
/*
2+
* telebot
3+
*
4+
* Copyright (c) 2015 Elmurod Talipov.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the License);
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef __TELEBOT_FORUMS_H__
20+
#define __TELEBOT_FORUMS_H__
21+
22+
#include <stdbool.h>
23+
#include "telebot-types.h"
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/**
30+
* @file telebot-forums.h
31+
* @ingroup TELEBOT_API
32+
* @brief This file contains forums feature of telegram bot
33+
* @author Elmurod Talipov
34+
* @date 2026-02-27
35+
*/
36+
37+
/**
38+
* @addtogroup TELEBOT_API
39+
* @{
40+
*/
41+
42+
/**
43+
* @brief Use this method to create a topic in a forum supergroup chat.
44+
* @param[in] handle The telebot handler.
45+
* @param[in] chat_id Unique identifier for the target chat.
46+
* @param[in] name Topic name, 1-128 characters.
47+
* @param[in] icon_color Color of the topic icon in RGB format.
48+
* @param[in] icon_custom_emoji_id Unique identifier of the custom emoji used as the topic icon.
49+
* @param[out] topic Pointer to get ForumTopic, MUST be released with #telebot_put_forum_topic.
50+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
51+
* error value.
52+
*/
53+
telebot_error_e telebot_create_forum_topic(telebot_handler_t handle,
54+
long long int chat_id, const char *name, int icon_color, const char *icon_custom_emoji_id,
55+
telebot_forum_topic_t *topic);
56+
57+
/**
58+
* @brief Release forum topic obtained with #telebot_create_forum_topic.
59+
* @param[in] topic Pointer to forum topic to be released.
60+
* @return on Success, #TELEBOT_ERROR_NONE is returned.
61+
*/
62+
telebot_error_e telebot_put_forum_topic(telebot_forum_topic_t *topic);
63+
64+
/**
65+
* @brief Use this method to edit name and icon of a topic in a forum supergroup chat.
66+
* @param[in] handle The telebot handler.
67+
* @param[in] chat_id Unique identifier for the target chat.
68+
* @param[in] message_thread_id Unique identifier for the target message thread of the forum topic.
69+
* @param[in] name New topic name, 0-128 characters.
70+
* @param[in] icon_custom_emoji_id New unique identifier of the custom emoji used as the topic icon.
71+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
72+
* error value.
73+
*/
74+
telebot_error_e telebot_edit_forum_topic(telebot_handler_t handle,
75+
long long int chat_id, int message_thread_id, const char *name, const char *icon_custom_emoji_id);
76+
77+
/**
78+
* @brief Use this method to close an open topic in a forum supergroup chat.
79+
* @param[in] handle The telebot handler.
80+
* @param[in] chat_id Unique identifier for the target chat.
81+
* @param[in] message_thread_id Unique identifier for the target message thread of the forum topic.
82+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
83+
* error value.
84+
*/
85+
telebot_error_e telebot_close_forum_topic(telebot_handler_t handle,
86+
long long int chat_id, int message_thread_id);
87+
88+
/**
89+
* @brief Use this method to reopen a closed topic in a forum supergroup chat.
90+
* @param[in] handle The telebot handler.
91+
* @param[in] chat_id Unique identifier for the target chat.
92+
* @param[in] message_thread_id Unique identifier for the target message thread of the forum topic.
93+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
94+
* error value.
95+
*/
96+
telebot_error_e telebot_reopen_forum_topic(telebot_handler_t handle,
97+
long long int chat_id, int message_thread_id);
98+
99+
/**
100+
* @brief Use this method to delete a forum topic along with all its messages in a forum supergroup chat.
101+
* @param[in] handle The telebot handler.
102+
* @param[in] chat_id Unique identifier for the target chat.
103+
* @param[in] message_thread_id Unique identifier for the target message thread of the forum topic.
104+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
105+
* error value.
106+
*/
107+
telebot_error_e telebot_delete_forum_topic(telebot_handler_t handle,
108+
long long int chat_id, int message_thread_id);
109+
110+
/**
111+
* @brief Use this method to unpin all messages in a forum topic.
112+
* @param[in] handle The telebot handler.
113+
* @param[in] chat_id Unique identifier for the target chat.
114+
* @param[in] message_thread_id Unique identifier for the target message thread of the forum topic.
115+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
116+
* error value.
117+
*/
118+
telebot_error_e telebot_unpin_all_forum_topic_messages(telebot_handler_t handle,
119+
long long int chat_id, int message_thread_id);
120+
121+
/**
122+
* @brief Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.
123+
* @param[in] handle The telebot handler.
124+
* @param[out] stickers Pointer to stickers to be obtained, MUST be released with #telebot_put_stickers.
125+
* @param[out] count Pointer to get the number of stickers.
126+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
127+
* error value.
128+
*/
129+
telebot_error_e telebot_get_forum_topic_icon_stickers(telebot_handler_t handle,
130+
telebot_sticker_t **stickers, int *count);
131+
132+
/**
133+
* @brief Use this method to edit the name of the 'General' topic in a forum supergroup chat.
134+
* @param[in] handle The telebot handler.
135+
* @param[in] chat_id Unique identifier for the target chat.
136+
* @param[in] name New topic name, 1-128 characters.
137+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
138+
* error value.
139+
*/
140+
telebot_error_e telebot_edit_general_forum_topic(telebot_handler_t handle,
141+
long long int chat_id, const char *name);
142+
143+
/**
144+
* @brief Use this method to close an open 'General' topic in a forum supergroup chat.
145+
* @param[in] handle The telebot handler.
146+
* @param[in] chat_id Unique identifier for the target chat.
147+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
148+
* error value.
149+
*/
150+
telebot_error_e telebot_close_general_forum_topic(telebot_handler_t handle,
151+
long long int chat_id);
152+
153+
/**
154+
* @brief Use this method to reopen a closed 'General' topic in a forum supergroup chat.
155+
* @param[in] handle The telebot handler.
156+
* @param[in] chat_id Unique identifier for the target chat.
157+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
158+
* error value.
159+
*/
160+
telebot_error_e telebot_reopen_general_forum_topic(telebot_handler_t handle,
161+
long long int chat_id);
162+
163+
/**
164+
* @brief Use this method to hide the 'General' topic in a forum supergroup chat.
165+
* @param[in] handle The telebot handler.
166+
* @param[in] chat_id Unique identifier for the target chat.
167+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
168+
* error value.
169+
*/
170+
telebot_error_e telebot_hide_general_forum_topic(telebot_handler_t handle,
171+
long long int chat_id);
172+
173+
/**
174+
* @brief Use this method to unhide the 'General' topic in a forum supergroup chat.
175+
* @param[in] handle The telebot handler.
176+
* @param[in] chat_id Unique identifier for the target chat.
177+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
178+
* error value.
179+
*/
180+
telebot_error_e telebot_unhide_general_forum_topic(telebot_handler_t handle,
181+
long long int chat_id);
182+
183+
/**
184+
* @brief Use this method to unpin all messages in a General forum topic.
185+
* @param[in] handle The telebot handler.
186+
* @param[in] chat_id Unique identifier for the target chat.
187+
* @return on Success, #TELEBOT_ERROR_NONE is returned, otherwise a negative
188+
* error value.
189+
*/
190+
telebot_error_e telebot_unpin_all_general_forum_topic_messages(telebot_handler_t handle,
191+
long long int chat_id);
192+
193+
/**
194+
* @} // end of APIs
195+
*/
196+
197+
#ifdef __cplusplus
198+
}
199+
#endif
200+
201+
#endif /* __TELEBOT_FORUMS_H__ */

include/telebot-games.h

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* telebot
3+
*
4+
* Copyright (c) 2015 Elmurod Talipov.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the License);
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef __TELEBOT_GAMES_H__
20+
#define __TELEBOT_GAMES_H__
21+
22+
#include <stdbool.h>
23+
#include "telebot-types.h"
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/**
30+
* @file telebot-games.h
31+
* @ingroup TELEBOT_API
32+
* @brief This file contains games feature of telegram bot
33+
* @author Elmurod Talipov
34+
* @date 2026-02-27
35+
*/
36+
37+
/**
38+
* @addtogroup TELEBOT_API
39+
* @{
40+
*/
41+
42+
/**
43+
* @brief Use this method to send a game.
44+
*/
45+
telebot_error_e telebot_send_game(telebot_handler_t handle,
46+
long long int chat_id, int message_thread_id, const char *game_short_name,
47+
bool disable_notification, bool protect_content, const char *reply_parameters,
48+
const char *reply_markup, telebot_message_t *message);
49+
50+
/**
51+
* @brief Use this method to set the score of the specified user in a game.
52+
*/
53+
telebot_error_e telebot_set_game_score(telebot_handler_t handle,
54+
long long int user_id, int score, bool force, bool disable_edit_message,
55+
long long int chat_id, int message_id, const char *inline_message_id,
56+
telebot_message_t *message);
57+
58+
/**
59+
* @brief Use this method to get data for high score tables.
60+
*/
61+
telebot_error_e telebot_get_game_high_scores(telebot_handler_t handle,
62+
long long int user_id, long long int chat_id, int message_id, const char *inline_message_id,
63+
telebot_game_high_score_t **high_scores, int *count);
64+
65+
/**
66+
* @brief Release game high scores obtained with #telebot_get_game_high_scores.
67+
*/
68+
telebot_error_e telebot_put_game_high_scores(telebot_game_high_score_t *high_scores, int count);
69+
70+
/**
71+
* @} // end of APIs
72+
*/
73+
74+
#ifdef __cplusplus
75+
}
76+
#endif
77+
78+
#endif /* __TELEBOT_GAMES_H__ */

include/telebot-inline.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* telebot
3+
*
4+
* Copyright (c) 2015 Elmurod Talipov.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the License);
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef __TELEBOT_INLINE_H__
20+
#define __TELEBOT_INLINE_H__
21+
22+
#include <stdbool.h>
23+
#include "telebot-types.h"
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/**
30+
* @file telebot-inline.h
31+
* @ingroup TELEBOT_API
32+
* @brief This file contains inline mode feature of telegram bot
33+
* @author Elmurod Talipov
34+
* @date 2026-02-27
35+
*/
36+
37+
/**
38+
* @addtogroup TELEBOT_API
39+
* @{
40+
*/
41+
42+
/**
43+
* @brief Use this method to send answers to an inline query.
44+
*/
45+
telebot_error_e telebot_answer_inline_query(telebot_handler_t handle,
46+
const char *inline_query_id, const char *results, int cache_time,
47+
bool is_personal, const char *next_offset, const char *button);
48+
49+
/**
50+
* @brief Use this method to save a prepared inline message.
51+
*/
52+
telebot_error_e telebot_save_prepared_inline_message(telebot_handler_t handle,
53+
long long int user_id, const char *result, bool allow_user_chats,
54+
bool allow_bot_chats, bool allow_group_chats, bool allow_channel_chats,
55+
telebot_prepared_inline_message_t *prepared_message);
56+
57+
/**
58+
* @brief Release prepared inline message.
59+
*/
60+
telebot_error_e telebot_put_prepared_inline_message(telebot_prepared_inline_message_t *prepared_message);
61+
62+
/**
63+
* @brief Use this method to send answers to an inline query to a user from a Web App.
64+
*/
65+
telebot_error_e telebot_answer_web_app_query(telebot_handler_t handle,
66+
const char *web_app_query_id, const char *result, char **inline_message_id);
67+
68+
/**
69+
* @} // end of APIs
70+
*/
71+
72+
#ifdef __cplusplus
73+
}
74+
#endif
75+
76+
#endif /* __TELEBOT_INLINE_H__ */

0 commit comments

Comments
 (0)