Skip to content

Commit dd7f5f6

Browse files
authored
Add Send Media Group feature, and bugfixes (#67)
* Update and rename telebot-core.c to telebot_core_restrict_chat_member * Fix "True" -> "true", "False" - "false", "can_invite_users" instead of "can_pin_messages" * Rename telebot_core_restrict_chat_member to telebot_core.c * Fix mistype "chonse_inline_result" -> "chosen_inline_result" * Fix memset(dice, 0, sizeof(telebot_location_t)); -> sizeof(telebot_dice_t) * Fix mimes[index].name = "message_id" instead of "disable_notification" at line 2116 * Fix typo: poll_anser -> poll_answer * Add estgb utility
1 parent 63693b4 commit dd7f5f6

10 files changed

Lines changed: 2006 additions & 17 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ 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 4.7.0)
9+
SET(VERSION 4.7.1)
1010

1111
SET(CMAKE_MACOSX_RPATH 1)
1212

@@ -16,7 +16,7 @@ SET(SRCS
1616
src/telebot.c
1717
)
1818

19-
ADD_DEFINITIONS("-DDEBUG=1")
19+
ADD_DEFINITIONS("-DDEBUG=0")
2020
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
2121
SET(DEPENDENTS "libcurl json-c")
2222
INCLUDE(FindPkgConfig)
@@ -25,7 +25,7 @@ pkg_check_modules(PKGS REQUIRED ${DEPENDENTS})
2525
FOREACH(flag ${PKGS_CFLAGS})
2626
SET(EXTRA_LIB_CFLAGS "${EXTRA_LIB_CFLAGS} ${flag}")
2727
ENDFOREACH(flag)
28-
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_LIB_CFLAGS} -Werror -Wall -Wno-unused-function" )
28+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_LIB_CFLAGS} -Werror -Wall -Wno-unused-function -O2" )
2929

3030
# libtelebot
3131
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})

include/telebot-core.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,27 @@ telebot_error_e telebot_core_send_video_note(telebot_core_handler_t *core_h,
440440
const char *thumb, bool disable_notification, int reply_to_message_id,
441441
const char *reply_markup, telebot_core_response_t *response);
442442

443+
/**
444+
* @brief Send a group of photos as an album.
445+
*
446+
* @param[in] core_h The telebot core handler created with #telebot_core_create().
447+
* @param[in] chat_id Unique identifier for the target chat or username of the target channel.
448+
* @param[in] media_paths Array of file paths to photos to send.
449+
* @param[in] count Number of photos in the array (2–10).
450+
* @param[in] disable_notification Sends the message silently. Users will receive a notification with no sound.
451+
* @param[in] reply_to_message_id If the message is a reply, ID of the original message.
452+
* @param[out] response Response data that contains the sent messages on success. It MUST be freed with #telebot_core_put_response().
453+
* @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative error value.
454+
*/
455+
telebot_error_e telebot_core_send_media_group(
456+
telebot_core_handler_t *core_h,
457+
long long int chat_id,
458+
char *media_paths[],
459+
int count,
460+
bool disable_notification,
461+
int reply_to_message_id,
462+
telebot_core_response_t *response);
463+
443464
/**
444465
* @brief Send point on the map.
445466
* @param[in] core_h The telebot core handler created with #telebot_core_create().

include/telebot-methods.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,25 @@ telebot_error_e telebot_send_video_note(telebot_handler_t handle, long long int
446446
char *video_note, bool is_file, int duration, int length, const char *thumb,
447447
bool disable_notification, int reply_to_message_id, const char *reply_markup);
448448

449+
/**
450+
* @brief Send a group of photos as an album.
451+
*
452+
* @param[in] handle The telebot handler created with #telebot_create().
453+
* @param[in] chat_id Unique identifier for the target chat or username of the target channel.
454+
* @param[in] media_paths Array of file paths to photos to send.
455+
* @param[in] count Number of photos in the array (2–10).
456+
* @param[in] disable_notification Sends the message silently.
457+
* @param[in] reply_to_message_id If the message is a reply, ID of the original message.
458+
* @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative error value.
459+
*/
460+
telebot_error_e telebot_send_media_group(
461+
telebot_handler_t handle,
462+
long long int chat_id,
463+
char *media_paths[],
464+
int count,
465+
bool disable_notification,
466+
int reply_to_message_id);
467+
449468
/**
450469
* @brief Send point on the map.
451470
* @param[in] handle The telebot handler created with #telebot_create().

include/telebot-types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ typedef struct telebot_update {
12421242
* A user changed their answer in a non-anonymous poll. Bots receive
12431243
* new votes only in polls that were sent by the bot itself.
12441244
*/
1245-
telebot_poll_answer_t poll_anser;
1245+
telebot_poll_answer_t poll_answer;
12461246
};
12471247
} telebot_update_t;
12481248

0 commit comments

Comments
 (0)