diff --git a/include/telebot-core.h b/include/telebot-core.h index 98cdc01..16add73 100644 --- a/include/telebot-core.h +++ b/include/telebot-core.h @@ -165,7 +165,7 @@ telebot_error_e telebot_core_get_me(telebot_core_handler_t *core_h); * error value. Response is placed in core_h->resp_data. It MUST be freed. */ telebot_error_e telebot_core_send_message(telebot_core_handler_t *core_h, - int chat_id, char *text, char *parse_mode, bool disable_web_page_preview, + long long int chat_id, char *text, char *parse_mode, bool disable_web_page_preview, bool disable_notification, int reply_to_message_id, const char *reply_markup); /** @@ -183,7 +183,7 @@ telebot_error_e telebot_core_send_message(telebot_core_handler_t *core_h, * message. It MUST be freed. */ telebot_error_e telebot_core_forward_message(telebot_core_handler_t *core_h, - int chat_id, int from_chat_id, bool disable_notification, int message_id); + long long int chat_id, long long int from_chat_id, bool disable_notification, int message_id); /** * @brief This functionis used to send photos. @@ -204,7 +204,7 @@ telebot_error_e telebot_core_forward_message(telebot_core_handler_t *core_h, * error value. Response is placed in core_h->resp_data that contains the sent * message. It MUST be freed after use. */ -telebot_error_e telebot_core_send_photo(telebot_core_handler_t *core_h, int chat_id, +telebot_error_e telebot_core_send_photo(telebot_core_handler_t *core_h, long long int chat_id, char *photo, bool is_file, char *caption, bool disable_notification, int reply_to_message_id, char *reply_markup); /** @@ -234,7 +234,7 @@ telebot_error_e telebot_core_send_photo(telebot_core_handler_t *core_h, int chat * error value. Response is placed in core_h->resp_data that contains the sent * message. It MUST be freed after use. */ -telebot_error_e telebot_core_send_audio(telebot_core_handler_t *core_h, int chat_id, +telebot_error_e telebot_core_send_audio(telebot_core_handler_t *core_h, long long int chat_id, char *audio, bool is_file, int duration, char *performer, char *title, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -256,7 +256,7 @@ telebot_error_e telebot_core_send_audio(telebot_core_handler_t *core_h, int chat * message. It MUST be freed after use. */ telebot_error_e telebot_core_send_document(telebot_core_handler_t *core_h, - int chat_id, char *document, bool is_file, bool disable_notification, + long long int chat_id, char *document, bool is_file, bool disable_notification, int reply_to_message_id, char *reply_markup); /** @@ -280,7 +280,7 @@ telebot_error_e telebot_core_send_document(telebot_core_handler_t *core_h, * message. It MUST be freed after use. */ telebot_error_e telebot_core_send_video(telebot_core_handler_t *core_h, - int chat_id, char *video, bool is_file, int duration, char *caption, + long long int chat_id, char *video, bool is_file, int duration, char *caption, bool disable_notification, int reply_to_message_id, char *reply_markup); /** @@ -306,7 +306,7 @@ telebot_error_e telebot_core_send_video(telebot_core_handler_t *core_h, * message. It MUST be freed after use. */ telebot_error_e telebot_core_send_voice(telebot_core_handler_t *core_h, - int chat_id, char *voice, bool is_file, int duration, + long long int chat_id, char *voice, bool is_file, int duration, bool disable_notification, int reply_to_message_id, char *reply_markup); /** @@ -330,7 +330,7 @@ telebot_error_e telebot_core_send_voice(telebot_core_handler_t *core_h, * message. It MUST be freed after use. */ telebot_error_e telebot_core_send_video_note(telebot_core_handler_t *core_h, - int chat_id, char *video_note, bool is_file, int duration, int length, + long long int chat_id, char *video_note, bool is_file, int duration, int length, bool disable_notification, int reply_to_message_id, char *reply_markup); /** @@ -350,7 +350,7 @@ telebot_error_e telebot_core_send_video_note(telebot_core_handler_t *core_h, * message. It MUST be freed after use. */ telebot_error_e telebot_core_send_location(telebot_core_handler_t *core_h, - int chat_id, float latitude, float longitude, bool disable_notification, + long long int chat_id, float latitude, float longitude, bool disable_notification, int reply_to_message_id, char *reply_markup); /** @@ -375,7 +375,7 @@ telebot_error_e telebot_core_send_location(telebot_core_handler_t *core_h, * message. It MUST be freed after use. */ telebot_error_e telebot_core_edit_message_live_location(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, float latitude, + long long int chat_id, int message_id, char *inline_message_id, float latitude, float longitude, bool disable_notification, char *reply_markup); /** @@ -394,7 +394,7 @@ telebot_error_e telebot_core_edit_message_live_location(telebot_core_handler_t * * message. It MUST be freed after use. */ telebot_error_e telebot_core_stop_message_live_location(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, char *reply_markup); + long long int chat_id, int message_id, char *inline_message_id, char *reply_markup); /** * @brief This function is used to send information about a venue. @@ -417,7 +417,7 @@ telebot_error_e telebot_core_stop_message_live_location(telebot_core_handler_t * * message. It MUST be freed after use. */ telebot_error_e telebot_core_send_venue(telebot_core_handler_t *core_h, - int chat_id, float latitude, float longitude, char *title, char *address, + long long int chat_id, float latitude, float longitude, char *title, char *address, char *foursquare_id, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -440,7 +440,7 @@ telebot_error_e telebot_core_send_venue(telebot_core_handler_t *core_h, * message. It MUST be freed after use. */ telebot_error_e telebot_core_send_contact(telebot_core_handler_t *core_h, - int chat_id, char *phone_number, char *first_name, char *last_name, + long long int chat_id, char *phone_number, char *first_name, char *last_name, bool disable_notification, int reply_to_message_id, char *reply_markup); /** @@ -466,7 +466,7 @@ telebot_error_e telebot_core_send_contact(telebot_core_handler_t *core_h, * message. It MUST be freed after use. */ telebot_error_e telebot_core_send_chat_action(telebot_core_handler_t *core_h, - int chat_id, char *action); + long long int chat_id, char *action); /** * @brief This function is used to get user profile pictures object @@ -526,7 +526,7 @@ telebot_error_e telebot_core_download_file(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_kick_chat_member(telebot_core_handler_t *core_h, - int chat_id, int user_id, long until_date); + long long int chat_id, int user_id, long until_date); /** * @brief This function is used to unban a previously kicked user in @@ -542,7 +542,7 @@ telebot_error_e telebot_core_kick_chat_member(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_unban_chat_member(telebot_core_handler_t *core_h, - int chat_id, int user_id); + long long int chat_id, int user_id); /** * @brief This function is used to restrict a user in a supergroup. The bot @@ -567,7 +567,7 @@ telebot_error_e telebot_core_unban_chat_member(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_restrict_chat_member(telebot_core_handler_t *core_h, - int chat_id, int user_id, long until_date, bool can_send_messages, + long long int chat_id, int user_id, long until_date, bool can_send_messages, bool can_send_media_messages, bool can_send_other_messages, bool can_add_web_page_previews); @@ -603,7 +603,7 @@ telebot_error_e telebot_core_restrict_chat_member(telebot_core_handler_t *core_h * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_promote_chat_member(telebot_core_handler_t *core_h, - int chat_id, int user_id, bool can_post_messages, bool can_edit_messages, + long long int chat_id, int user_id, bool can_post_messages, bool can_edit_messages, bool can_delete_messages, bool can_invite_users, bool can_restrict_members, bool can_pin_messages, bool can_promote_members); @@ -619,7 +619,7 @@ telebot_error_e telebot_core_promote_chat_member(telebot_core_handler_t *core_h, * invite link. It MUST be freed after use. */ telebot_error_e telebot_core_export_chat_invite_link(telebot_core_handler_t *core_h, - int chat_id); + long long int chat_id); /** * @brief This function is used to set a new profile photo for the chat. Photos @@ -634,7 +634,7 @@ telebot_error_e telebot_core_export_chat_invite_link(telebot_core_handler_t *cor * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_set_chat_photo(telebot_core_handler_t *core_h, - int chat_id, char *photo); + long long int chat_id, char *photo); /** * @brief This function is used to delete a chat photo. Photos can't be changed @@ -648,7 +648,7 @@ telebot_error_e telebot_core_set_chat_photo(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_delete_chat_photo(telebot_core_handler_t *core_h, - int chat_id, char *photo); + long long int chat_id, char *photo); /** * @brief This function is used to change the title of a chat. Titles can't be @@ -663,7 +663,7 @@ telebot_error_e telebot_core_delete_chat_photo(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_set_chat_title(telebot_core_handler_t *core_h, - int chat_id, char *title); + long long int chat_id, char *title); /** * @brief This function is used to change the description of a supergroup or @@ -678,7 +678,7 @@ telebot_error_e telebot_core_set_chat_title(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_set_chat_description(telebot_core_handler_t *core_h, - int chat_id, char *description); + long long int chat_id, char *description); /** * @brief This function is used to pin a message in a supergroup or a channel. @@ -697,7 +697,7 @@ telebot_error_e telebot_core_set_chat_description(telebot_core_handler_t *core_h * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_pin_chat_message(telebot_core_handler_t *core_h, - int chat_id, int message_id, bool disable_notification); + long long int chat_id, int message_id, bool disable_notification); /** * @brief This function is used to unpin a message in a supergroup or a channel. @@ -712,7 +712,7 @@ telebot_error_e telebot_core_pin_chat_message(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_unpin_chat_message(telebot_core_handler_t *core_h, - int chat_id); + long long int chat_id); /** * @brief This function is used to leave a group, supergroup or channel. @@ -724,7 +724,7 @@ telebot_error_e telebot_core_unpin_chat_message(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_leave_chat(telebot_core_handler_t *core_h, - int chat_id); + long long int chat_id); /** * @brief This function is used to to get up to date information about the @@ -738,7 +738,7 @@ telebot_error_e telebot_core_leave_chat(telebot_core_handler_t *core_h, * information. It MUST be freed after use. */ telebot_error_e telebot_core_get_chat(telebot_core_handler_t *core_h, - int chat_id); + long long int chat_id); /** * @brief This function is used to get a list of administrators in a chat. @@ -753,7 +753,7 @@ telebot_error_e telebot_core_get_chat(telebot_core_handler_t *core_h, * chat members. It MUST be freed after use. */ telebot_error_e telebot_core_get_chat_admins(telebot_core_handler_t *core_h, - int chat_id); + long long int chat_id); /** * @brief This function is used to get the number of members in a chat. @@ -765,7 +765,7 @@ telebot_error_e telebot_core_get_chat_admins(telebot_core_handler_t *core_h, * of chat members. It MUST be freed after use. */ telebot_error_e telebot_core_get_chat_members_count(telebot_core_handler_t *core_h, - int chat_id); + long long int chat_id); /** * @brief This function is used to get information about a member of a chat. @@ -777,7 +777,7 @@ telebot_error_e telebot_core_get_chat_members_count(telebot_core_handler_t *core * member. It MUST be freed after use. */ telebot_error_e telebot_core_get_chat_member(telebot_core_handler_t *core_h, - int chat_id); + long long int chat_id); /** * @brief This function is used to set a new group sticker set for a supergroup. @@ -794,7 +794,7 @@ telebot_error_e telebot_core_get_chat_member(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_set_chat_sticker_set(telebot_core_handler_t *core_h, - int chat_id, char *sticker_set_name); + long long int chat_id, char *sticker_set_name); /** * @brief This function is used to delete a group sticker set from a supergroup. @@ -809,7 +809,7 @@ telebot_error_e telebot_core_set_chat_sticker_set(telebot_core_handler_t *core_h * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_delete_chat_sticker_set(telebot_core_handler_t *core_h, - int chat_id); + long long int chat_id); /** * @brief Send answers to callback queries sent from inline keyboards. @@ -856,7 +856,7 @@ telebot_error_e telebot_core_answer_callback_query(telebot_core_handler_t *core_ * message, if the message is edited, otherwise "true". It MUST be freed after use. */ telebot_error_e telebot_core_edit_message_text(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, char *text, + long long int chat_id, int message_id, char *inline_message_id, char *text, char *parse_mode, bool disable_web_page_preview, char *reply_markup); /** @@ -876,7 +876,7 @@ telebot_error_e telebot_core_edit_message_text(telebot_core_handler_t *core_h, * message, if the message is edited, otherwise "true". It MUST be freed after use. */ telebot_error_e telebot_core_edit_message_caption(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, char *caption, + long long int chat_id, int message_id, char *inline_message_id, char *caption, char *reply_markup); /** @@ -896,7 +896,7 @@ telebot_error_e telebot_core_edit_message_caption(telebot_core_handler_t *core_h */ telebot_error_e telebot_core_edit_message_reply_markup(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, char *reply_markup); + long long int chat_id, int message_id, char *inline_message_id, char *reply_markup); /** * @brief This function is used to delete a message, including service messages, @@ -916,7 +916,7 @@ telebot_error_e telebot_core_edit_message_reply_markup(telebot_core_handler_t *c * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_delete_message(telebot_core_handler_t *core_h, - int chat_id, int message_id); + long long int chat_id, int message_id); /** * @brief This function is used to to send .webp stickers. @@ -937,7 +937,7 @@ telebot_error_e telebot_core_delete_message(telebot_core_handler_t *core_h, * successfull. It MUST be freed after use. */ telebot_error_e telebot_core_send_sticker(telebot_core_handler_t *core_h, - int chat_id, char *sticker, bool is_file, bool disable_notification, + long long int chat_id, char *sticker, bool is_file, bool disable_notification, int reply_to_message_id, char *reply_markup); /** diff --git a/include/telebot-methods.h b/include/telebot-methods.h index 09e52df..4dbad1c 100644 --- a/include/telebot-methods.h +++ b/include/telebot-methods.h @@ -188,7 +188,7 @@ telebot_error_e telebot_free_me(telebot_user_t *me); * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_message(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_message(telebot_handler_t handle, long long int chat_id, char *text, char *parse_mode, bool disable_web_page_preview, bool disable_notification, int reply_to_message_id, const char *reply_markup); @@ -206,15 +206,15 @@ telebot_error_e telebot_send_message(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_forward_message(telebot_handler_t handle, int chat_id, - int from_chat_id, bool disable_notification, int message_id); +telebot_error_e telebot_forward_message(telebot_handler_t handle, long long int chat_id, + long long int from_chat_id, bool disable_notification, int message_id); /** * @brief This functionis used to send photos. * * @param[in] handle The telebot handler created with #telebot_create(). * @param[in] chat_id Unique identifier for the target chat or username of the - * target channel (in the format \@channelusername).int chat_id + * target channel (in the format \@channelusername).long long int chat_id * @param[in] photo Photo to send. It is either file_id to resend a photo * that is already on the Telegram servers, or a path to photo file. * @param[in] is_file False if photo is file_id, true, if photo is a file path. @@ -228,7 +228,7 @@ telebot_error_e telebot_forward_message(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_photo(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_photo(telebot_handler_t handle, long long int chat_id, char *photo, bool is_file, char *caption, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -260,7 +260,7 @@ telebot_error_e telebot_send_photo(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_audio(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_audio(telebot_handler_t handle, long long int chat_id, char *audio, bool is_file, int duration, char *performer, char *title, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -283,7 +283,7 @@ telebot_error_e telebot_send_audio(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_document(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_document(telebot_handler_t handle, long long int chat_id, char *document, bool is_file, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -310,7 +310,7 @@ telebot_error_e telebot_send_document(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_video(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_video(telebot_handler_t handle, long long int chat_id, char *video, bool is_file, int duration, int width, int height, char *caption, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -339,7 +339,7 @@ telebot_error_e telebot_send_video(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_voice(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_voice(telebot_handler_t handle, long long int chat_id, char *voice, bool is_file, char *caption, int duration, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -363,7 +363,7 @@ telebot_error_e telebot_send_voice(telebot_handler_t handle, int chat_id, * keyboard, instructions to hide keyboard or to force a reply from the user. * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative error value. */ -telebot_error_e telebot_send_video_note(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_video_note(telebot_handler_t handle, long long int chat_id, char *video_note, bool is_file, int duration, int length, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -384,7 +384,7 @@ telebot_error_e telebot_send_video_note(telebot_handler_t handle, int chat_id, * error value. */ /* TODO - * telebot_error_e telebot_send_media_group(telebot_handler_t handle, int chat_id, + * telebot_error_e telebot_send_media_group(telebot_handler_t handle, long long int chat_id, * telebot_input_media_t media[], bool is_file, bool disable_notification, * int reply_to_message_id); */ @@ -406,7 +406,7 @@ telebot_error_e telebot_send_video_note(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_location(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_location(telebot_handler_t handle, long long int chat_id, float latitude, float longitude, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -433,7 +433,7 @@ telebot_error_e telebot_send_location(telebot_handler_t handle, int chat_id, * error value. */ telebot_error_e telebot_edit_message_live_location(telebot_handler_t handle, - int chat_id, int message_id, char *inline_message_id, float latitude, + long long int chat_id, int message_id, char *inline_message_id, float latitude, float longitude, bool disable_notification, char *reply_markup); /** @@ -452,7 +452,7 @@ telebot_error_e telebot_edit_message_live_location(telebot_handler_t handle, * error value. */ telebot_error_e telebot_stop_message_live_location(telebot_handler_t handle, - int chat_id, int message_id, char *inline_message_id, char *reply_markup); + long long int chat_id, int message_id, char *inline_message_id, char *reply_markup); /** * @brief This function is used to send information about a venue. @@ -475,7 +475,7 @@ telebot_error_e telebot_stop_message_live_location(telebot_handler_t handle, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_venue(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_venue(telebot_handler_t handle, long long int chat_id, float latitude, float longitude, char *title, char *foursquare_id, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -498,7 +498,7 @@ telebot_error_e telebot_send_venue(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_contact(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_contact(telebot_handler_t handle, long long int chat_id, char *phone_number, char *first_name, char *last_name, bool disable_notification, int reply_to_message_id, char *reply_markup); @@ -525,7 +525,7 @@ telebot_error_e telebot_send_contact(telebot_handler_t handle, int chat_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_chat_action(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_chat_action(telebot_handler_t handle, long long int chat_id, char *action); /** @@ -573,7 +573,7 @@ telebot_error_e telebot_download_file(telebot_handler_t handle, char *file_id, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_delete_message(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_delete_message(telebot_handler_t handle, long long int chat_id, int message_id); /** @@ -616,7 +616,7 @@ telebot_error_e telebot_answer_callback_query(telebot_handler_t handle, * @return on Success, TELEBOT_ERROR_NONE is returned, otherwise a negative * error value. */ -telebot_error_e telebot_send_sticker(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_sticker(telebot_handler_t handle, long long int chat_id, char *sticker, bool is_file, bool disable_notification, int reply_to_message_id, char *reply_markup); diff --git a/include/telebot-types.h b/include/telebot-types.h index dfa4c0f..ef36bce 100644 --- a/include/telebot-types.h +++ b/include/telebot-types.h @@ -81,7 +81,7 @@ typedef struct telebot_user { */ typedef struct telebot_chat { /** Unique identifier for this chat, it may be greater than 32 bits. */ - long long id; + long long int id; /** Type of chat, can be either "private", or "group", "supergroup", or "channel". */ char *type; @@ -269,13 +269,13 @@ typedef struct telebot_message { * Optional. The group has been migrated to a supergroup with the specified * identifier, not exceeding 1e13 by absolute value */ - int migrate_to_chat_id; + long long int migrate_to_chat_id; /** * Optional. The supergroup has been migrated from a group with the * specified identifier, not exceeding 1e13 by absolute value */ - int migrate_from_chat_id; + long long int migrate_from_chat_id; /** * Optional. Specified message was pinned. Note that the Message object in diff --git a/src/telebot-core.c b/src/telebot-core.c index 1d04b29..ab71de7 100644 --- a/src/telebot-core.c +++ b/src/telebot-core.c @@ -249,7 +249,7 @@ telebot_error_e telebot_core_get_me(telebot_core_handler_t *core_h) } telebot_error_e telebot_core_send_message(telebot_core_handler_t *core_h, - int chat_id, char *text, char *parse_mode, bool disable_web_page_preview, + long long int chat_id, char *text, char *parse_mode, bool disable_web_page_preview, bool disable_notification, int reply_to_message_id, const char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (text == NULL)) { @@ -261,7 +261,7 @@ telebot_error_e telebot_core_send_message(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "text", @@ -290,15 +290,15 @@ telebot_error_e telebot_core_send_message(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_forward_message(telebot_core_handler_t *core_h, - int chat_id, int from_chat_id, bool disable_notification, int message_id) + long long int chat_id, long long int from_chat_id, bool disable_notification, int message_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler or token is NULL."); return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) || (from_chat_id <= 0) || (message_id <= 0)) { - ERR("Valid chat_id, from_chat_id and message_id is required."); + if (message_id <= 0) { + ERR("Valid message_id is required."); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -306,7 +306,7 @@ telebot_error_e telebot_core_forward_message(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); curl_formadd (&post, &last, CURLFORM_COPYNAME, "from_chat_id", @@ -324,7 +324,7 @@ telebot_error_e telebot_core_forward_message(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_photo(telebot_core_handler_t *core_h, - int chat_id, char *photo, bool is_file, char *caption, + long long int chat_id, char *photo, bool is_file, char *caption, bool disable_notification, int reply_to_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (photo == NULL)) { @@ -332,16 +332,11 @@ telebot_error_e telebot_core_send_photo(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); if (is_file) @@ -371,7 +366,7 @@ telebot_error_e telebot_core_send_photo(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_audio(telebot_core_handler_t *core_h, - int chat_id, char *audio, bool is_file, int duration, char *performer, + long long int chat_id, char *audio, bool is_file, int duration, char *performer, char *title, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -380,16 +375,11 @@ telebot_error_e telebot_core_send_audio(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); if (is_file) @@ -428,7 +418,7 @@ telebot_error_e telebot_core_send_audio(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_document(telebot_core_handler_t *core_h, - int chat_id, char *document, bool is_file, bool disable_notification, + long long int chat_id, char *document, bool is_file, bool disable_notification, int reply_to_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (document == NULL)) { @@ -436,16 +426,11 @@ telebot_error_e telebot_core_send_document(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); if (is_file) @@ -472,7 +457,7 @@ telebot_error_e telebot_core_send_document(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_video(telebot_core_handler_t *core_h, - int chat_id, char *video, bool is_file, int duration, char *caption, + long long int chat_id, char *video, bool is_file, int duration, char *caption, bool disable_notification, int reply_to_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (video == NULL)) { @@ -480,16 +465,11 @@ telebot_error_e telebot_core_send_video(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); if (is_file) @@ -525,7 +505,7 @@ telebot_error_e telebot_core_send_video(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_voice(telebot_core_handler_t *core_h, - int chat_id, char *voice, bool is_file, int duration, + long long int chat_id, char *voice, bool is_file, int duration, bool disable_notification, int reply_to_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (voice == NULL)) { @@ -533,16 +513,11 @@ telebot_error_e telebot_core_send_voice(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); if (is_file) @@ -575,7 +550,7 @@ telebot_error_e telebot_core_send_voice(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_video_note(telebot_core_handler_t *core_h, - int chat_id, char *video_note, bool is_file, int duration, int length, + long long int chat_id, char *video_note, bool is_file, int duration, int length, bool disable_notification, int reply_to_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (video_note == NULL)) { @@ -583,16 +558,11 @@ telebot_error_e telebot_core_send_video_note(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); if (is_file) @@ -632,7 +602,7 @@ telebot_error_e telebot_core_send_video_note(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_location(telebot_core_handler_t *core_h, - int chat_id, float latitude, float longitude, bool disable_notification, + long long int chat_id, float latitude, float longitude, bool disable_notification, int reply_to_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL)) { @@ -640,16 +610,11 @@ telebot_error_e telebot_core_send_location(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); char latitude_str[32]; @@ -678,7 +643,7 @@ telebot_error_e telebot_core_send_location(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_edit_message_live_location(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, float latitude, + long long int chat_id, int message_id, char *inline_message_id, float latitude, float longitude, bool disable_notification, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL)) { @@ -686,7 +651,7 @@ telebot_error_e telebot_core_edit_message_live_location(telebot_core_handler_t * return TELEBOT_ERROR_INVALID_PARAMETER; } - if (((chat_id <= 0) || (message_id <=0)) && (inline_message_id == NULL)) { + if (((chat_id == 0) || (message_id <= 0)) && (inline_message_id == NULL)) { ERR("Either valid chat_id & message_id or inline_message_id required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -694,9 +659,9 @@ telebot_error_e telebot_core_edit_message_live_location(telebot_core_handler_t * struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; - if (chat_id > 0) { + if (chat_id != 0) { char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); } @@ -729,14 +694,14 @@ telebot_error_e telebot_core_edit_message_live_location(telebot_core_handler_t * } telebot_error_e telebot_core_stop_message_live_location(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, char *reply_markup) + long long int chat_id, int message_id, char *inline_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (((chat_id <= 0) || (message_id <=0)) && (inline_message_id == NULL)) { + if (((chat_id == 0) || (message_id <= 0)) && (inline_message_id == NULL)) { ERR("Either valid chat_id & message_id or inline_message_id required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -744,9 +709,9 @@ telebot_error_e telebot_core_stop_message_live_location(telebot_core_handler_t * struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; - if (chat_id > 0) { + if (chat_id != 0) { char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); } @@ -768,7 +733,7 @@ telebot_error_e telebot_core_stop_message_live_location(telebot_core_handler_t * } telebot_error_e telebot_core_send_venue(telebot_core_handler_t *core_h, - int chat_id,float latitude, float longitude, char *title, char *address, + long long int chat_id,float latitude, float longitude, char *title, char *address, char *foursquare_id, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -778,16 +743,11 @@ telebot_error_e telebot_core_send_venue(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); char latitude_str[32]; @@ -823,7 +783,7 @@ telebot_error_e telebot_core_send_venue(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_contact(telebot_core_handler_t *core_h, - int chat_id, char *phone_number, char *first_name, char *last_name, + long long int chat_id, char *phone_number, char *first_name, char *last_name, bool disable_notification, int reply_to_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (phone_number == NULL) @@ -832,16 +792,11 @@ telebot_error_e telebot_core_send_contact(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "phone_number", @@ -869,23 +824,18 @@ telebot_error_e telebot_core_send_contact(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_chat_action(telebot_core_handler_t *core_h, - int chat_id, char *action) + long long int chat_id, char *action) { if ((core_h == NULL) || (core_h->token == NULL) || (action == NULL)) { ERR("Handler, token or action is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "action", @@ -1000,15 +950,15 @@ telebot_error_e telebot_core_download_file(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_kick_chat_member(telebot_core_handler_t *core_h, - int chat_id, int user_id, long until_date) + long long int chat_id, int user_id, long until_date) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) && (user_id <= 0)) { - ERR("Valid chat_id and user_id is required"); + if (user_id <= 0) { + ERR("Valid user_id is required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1016,7 +966,7 @@ telebot_error_e telebot_core_kick_chat_member(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); char user_id_str[16]; @@ -1033,15 +983,15 @@ telebot_error_e telebot_core_kick_chat_member(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_unban_chat_member(telebot_core_handler_t *core_h, - int chat_id, int user_id) + long long int chat_id, int user_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) && (user_id <= 0)) { - ERR("Valid chat_id and user_id is required"); + if (user_id <= 0) { + ERR("Valid user_id is required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1049,7 +999,7 @@ telebot_error_e telebot_core_unban_chat_member(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); char user_id_str[16]; @@ -1062,7 +1012,7 @@ telebot_error_e telebot_core_unban_chat_member(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_restrict_chat_member(telebot_core_handler_t *core_h, - int chat_id, int user_id, long until_date, bool can_send_messages, + long long int chat_id, int user_id, long until_date, bool can_send_messages, bool can_send_media_messages, bool can_send_other_messages, bool can_add_web_page_previews) { @@ -1071,8 +1021,8 @@ telebot_error_e telebot_core_restrict_chat_member(telebot_core_handler_t *core_h return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) && (user_id <= 0)) { - ERR("Valid chat_id and user_id is required"); + if (user_id <= 0) { + ERR("Valid user_id is required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1080,7 +1030,7 @@ telebot_error_e telebot_core_restrict_chat_member(telebot_core_handler_t *core_h struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); char user_id_str[16]; @@ -1109,7 +1059,7 @@ telebot_error_e telebot_core_restrict_chat_member(telebot_core_handler_t *core_h } telebot_error_e telebot_core_promote_chat_member(telebot_core_handler_t *core_h, - int chat_id, int user_id, bool can_post_messages, bool can_edit_messages, + long long int chat_id, int user_id, bool can_post_messages, bool can_edit_messages, bool can_delete_messages, bool can_invite_users, bool can_restrict_members, bool can_pin_messages, bool can_promote_members) { @@ -1118,8 +1068,8 @@ telebot_error_e telebot_core_promote_chat_member(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) && (user_id <= 0)) { - ERR("Valid chat_id and user_id is required"); + if (user_id <= 0) { + ERR("Valid user_id is required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1127,7 +1077,7 @@ telebot_error_e telebot_core_promote_chat_member(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); char user_id_str[16]; @@ -1161,23 +1111,18 @@ telebot_error_e telebot_core_promote_chat_member(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_export_chat_invite_link(telebot_core_handler_t *core_h, - int chat_id) + long long int chat_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); return telebot_core_curl_perform(core_h, @@ -1185,15 +1130,15 @@ telebot_error_e telebot_core_export_chat_invite_link(telebot_core_handler_t *cor } telebot_error_e telebot_core_set_chat_photo(telebot_core_handler_t *core_h, - int chat_id, char *photo) + long long int chat_id, char *photo) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) || (photo == NULL)) { - ERR("Valid chat_id and photo is required"); + if (photo == NULL) { + ERR("Valid photo is required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1201,7 +1146,7 @@ telebot_error_e telebot_core_set_chat_photo(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "photo", @@ -1212,23 +1157,18 @@ telebot_error_e telebot_core_set_chat_photo(telebot_core_handler_t *core_h, telebot_error_e telebot_core_delete_chat_photo(telebot_core_handler_t *core_h, - int chat_id, char *photo) + long long int chat_id, char *photo) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); return telebot_core_curl_perform(core_h, @@ -1237,15 +1177,15 @@ telebot_error_e telebot_core_delete_chat_photo(telebot_core_handler_t *core_h, telebot_error_e telebot_core_set_chat_title(telebot_core_handler_t *core_h, - int chat_id, char *title) + long long int chat_id, char *title) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) || (title == NULL) || (strlen(title) > 255)) { - ERR("Valid chat_id and title is required"); + if ((title == NULL) || (strlen(title) > 255)) { + ERR("Valid title is required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1253,7 +1193,7 @@ telebot_error_e telebot_core_set_chat_title(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "title", @@ -1264,23 +1204,18 @@ telebot_error_e telebot_core_set_chat_title(telebot_core_handler_t *core_h, telebot_error_e telebot_core_set_chat_description(telebot_core_handler_t *core_h, - int chat_id, char *description) + long long int chat_id, char *description) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); if (description) @@ -1291,15 +1226,15 @@ telebot_error_e telebot_core_set_chat_description(telebot_core_handler_t *core_h } telebot_error_e telebot_core_pin_chat_message(telebot_core_handler_t *core_h, - int chat_id, int message_id, bool disable_notification) + long long int chat_id, int message_id, bool disable_notification) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) || (message_id <=0)) { - ERR("Valid chat_id and message_id is required"); + if (message_id <=0) { + ERR("Valid message_id is required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1307,7 +1242,7 @@ telebot_error_e telebot_core_pin_chat_message(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); char message_id_str[16]; @@ -1323,23 +1258,18 @@ telebot_error_e telebot_core_pin_chat_message(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_unpin_chat_message(telebot_core_handler_t *core_h, - int chat_id) + long long int chat_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); @@ -1349,23 +1279,18 @@ telebot_error_e telebot_core_unpin_chat_message(telebot_core_handler_t *core_h, telebot_error_e telebot_core_leave_chat(telebot_core_handler_t *core_h, - int chat_id) + long long int chat_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); @@ -1374,23 +1299,18 @@ telebot_error_e telebot_core_leave_chat(telebot_core_handler_t *core_h, telebot_error_e telebot_core_get_chat(telebot_core_handler_t *core_h, - int chat_id) + long long int chat_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); @@ -1398,23 +1318,18 @@ telebot_error_e telebot_core_get_chat(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_get_chat_admins(telebot_core_handler_t *core_h, - int chat_id) + long long int chat_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); @@ -1422,23 +1337,18 @@ telebot_error_e telebot_core_get_chat_admins(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_get_chat_members_count(telebot_core_handler_t *core_h, - int chat_id) + long long int chat_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); @@ -1447,23 +1357,18 @@ telebot_error_e telebot_core_get_chat_members_count(telebot_core_handler_t *core } telebot_error_e telebot_core_get_chat_member(telebot_core_handler_t *core_h, - int chat_id) + long long int chat_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); @@ -1472,15 +1377,15 @@ telebot_error_e telebot_core_get_chat_member(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_set_chat_sticker_set(telebot_core_handler_t *core_h, - int chat_id, char *sticker_set_name) + long long int chat_id, char *sticker_set_name) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) || (sticker_set_name == NULL)) { - ERR("Valid chat_id and sticker_set_name is required"); + if (sticker_set_name == NULL) { + ERR("Valid sticker_set_name is required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1488,7 +1393,7 @@ telebot_error_e telebot_core_set_chat_sticker_set(telebot_core_handler_t *core_h struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "sticker_set_name", @@ -1499,23 +1404,18 @@ telebot_error_e telebot_core_set_chat_sticker_set(telebot_core_handler_t *core_h } telebot_error_e telebot_core_delete_chat_sticker_set(telebot_core_handler_t *core_h, - int chat_id) + long long int chat_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler, or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required"); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); @@ -1559,7 +1459,7 @@ telebot_error_e telebot_core_answer_callback_query(telebot_core_handler_t * core } telebot_error_e telebot_core_edit_message_text(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, char *text, + long long int chat_id, int message_id, char *inline_message_id, char *text, char *parse_mode, bool disable_web_page_preview, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (text == NULL)) { @@ -1567,7 +1467,7 @@ telebot_error_e telebot_core_edit_message_text(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (((chat_id <= 0) || (message_id <=0)) && (inline_message_id == NULL)) { + if (((chat_id == 0) || (message_id <=0)) && (inline_message_id == NULL)) { ERR("Either valid chat_id & message_id or inline_message_id required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1575,9 +1475,9 @@ telebot_error_e telebot_core_edit_message_text(telebot_core_handler_t *core_h, struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; - if (chat_id > 0) { + if (chat_id != 0) { char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); } @@ -1607,7 +1507,7 @@ telebot_error_e telebot_core_edit_message_text(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_edit_message_caption(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, char *caption, + long long int chat_id, int message_id, char *inline_message_id, char *caption, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL)) { @@ -1615,7 +1515,7 @@ telebot_error_e telebot_core_edit_message_caption(telebot_core_handler_t *core_h return TELEBOT_ERROR_INVALID_PARAMETER; } - if (((chat_id <= 0) || (message_id <=0)) && (inline_message_id == NULL)) { + if (((chat_id == 0) || (message_id <=0)) && (inline_message_id == NULL)) { ERR("Either valid chat_id & message_id or inline_message_id required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1623,9 +1523,9 @@ telebot_error_e telebot_core_edit_message_caption(telebot_core_handler_t *core_h struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; - if (chat_id > 0) { + if (chat_id != 0) { char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); } @@ -1651,14 +1551,14 @@ telebot_error_e telebot_core_edit_message_caption(telebot_core_handler_t *core_h telebot_error_e telebot_core_edit_message_reply_markup(telebot_core_handler_t *core_h, - int chat_id, int message_id, char *inline_message_id, char *reply_markup) + long long int chat_id, int message_id, char *inline_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if (((chat_id <= 0) || (message_id <=0)) && (inline_message_id == NULL)) { + if (((chat_id == 0) || (message_id <=0)) && (inline_message_id == NULL)) { ERR("Either valid chat_id & message_id or inline_message_id required"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1666,9 +1566,9 @@ telebot_error_e telebot_core_edit_message_reply_markup(telebot_core_handler_t *c struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; - if (chat_id > 0) { + if (chat_id != 0) { char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); } @@ -1690,15 +1590,15 @@ telebot_error_e telebot_core_edit_message_reply_markup(telebot_core_handler_t *c } telebot_error_e telebot_core_delete_message(telebot_core_handler_t *core_h, - int chat_id, int message_id) + long long int chat_id, int message_id) { if ((core_h == NULL) || (core_h->token == NULL)) { ERR("Handler or token is NULL"); return TELEBOT_ERROR_INVALID_PARAMETER; } - if ((chat_id <= 0) || (message_id) <= 0) { - ERR("chat_id or message_id is invalid"); + if ((message_id) <= 0) { + ERR("message_id is invalid"); return TELEBOT_ERROR_INVALID_PARAMETER; } @@ -1706,7 +1606,7 @@ telebot_error_e telebot_core_delete_message(telebot_core_handler_t *core_h, struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); char message_id_str[16]; snprintf(message_id_str, sizeof(message_id_str), "%d", message_id); @@ -1719,7 +1619,7 @@ telebot_error_e telebot_core_delete_message(telebot_core_handler_t *core_h, } telebot_error_e telebot_core_send_sticker(telebot_core_handler_t *core_h, - int chat_id, char *sticker, bool is_file, bool disable_notification, + long long int chat_id, char *sticker, bool is_file, bool disable_notification, int reply_to_message_id, char *reply_markup) { if ((core_h == NULL) || (core_h->token == NULL) || (sticker == NULL)) { @@ -1727,16 +1627,11 @@ telebot_error_e telebot_core_send_sticker(telebot_core_handler_t *core_h, return TELEBOT_ERROR_INVALID_PARAMETER; } - if (chat_id <= 0) { - ERR("Valid chat_id is required."); - return TELEBOT_ERROR_INVALID_PARAMETER; - } - struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; char chat_id_str[16]; - snprintf(chat_id_str, sizeof(chat_id_str), "%d", chat_id); + snprintf(chat_id_str, sizeof(chat_id_str), "%lld", chat_id); curl_formadd(&post, &last, CURLFORM_COPYNAME, "chat_id", CURLFORM_COPYCONTENTS, chat_id_str, CURLFORM_END); if (is_file) diff --git a/src/telebot-parser.c b/src/telebot-parser.c index 27e79b4..1b06df1 100644 --- a/src/telebot-parser.c +++ b/src/telebot-parser.c @@ -240,7 +240,7 @@ telebot_error_e telebot_parser_get_chat(struct json_object *obj, int ret; struct json_object *id; if (json_object_object_get_ex(obj, "id", &id)) { - chat->id = json_object_get_int(id); + chat->id = json_object_get_int64(id); } else { ERR("Object is not chat type, id not found"); @@ -591,12 +591,12 @@ telebot_error_e telebot_parser_get_message(struct json_object *obj, struct json_object *mtci; if (json_object_object_get_ex(obj, "migrate_to_chat_id", &mtci)) { - msg->migrate_to_chat_id = json_object_get_int(mtci); + msg->migrate_to_chat_id = json_object_get_int64(mtci); } struct json_object *mftci; if (json_object_object_get_ex(obj, "migrate_from_chat_id", &mftci)) { - msg->migrate_from_chat_id = json_object_get_int(mftci); + msg->migrate_from_chat_id = json_object_get_int64(mftci); } struct json_object *pinned_message; diff --git a/src/telebot.c b/src/telebot.c index 8e199c6..beb9db6 100644 --- a/src/telebot.c +++ b/src/telebot.c @@ -406,7 +406,7 @@ telebot_error_e telebot_free_webhook_info(telebot_webhook_info_t *info) return TELEBOT_ERROR_NONE; } -telebot_error_e telebot_send_message(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_message(telebot_handler_t handle, long long int chat_id, char *text, char *parse_mode, bool disable_web_page_preview, bool disable_notification, int reply_to_message_id, const char *reply_markup) @@ -415,7 +415,7 @@ telebot_error_e telebot_send_message(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (text == NULL)) + if (text == NULL) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_send_message(_handle->core_h, chat_id, @@ -427,14 +427,14 @@ telebot_error_e telebot_send_message(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_forward_message(telebot_handler_t handle, int chat_id, - int from_chat_id, bool disable_notification, int message_id) +telebot_error_e telebot_forward_message(telebot_handler_t handle, long long int chat_id, + long long int from_chat_id, bool disable_notification, int message_id) { telebot_hdata_t * _handle = (telebot_hdata_t *)handle; if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (message_id <= 0)) + if (message_id <= 0) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_forward_message(_handle->core_h, chat_id, @@ -445,7 +445,7 @@ telebot_error_e telebot_forward_message(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_photo(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_photo(telebot_handler_t handle, long long int chat_id, char *photo, bool is_file, char *caption, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -453,7 +453,7 @@ telebot_error_e telebot_send_photo(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (photo == NULL)) + if (photo == NULL) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_send_photo(_handle->core_h, chat_id, photo, @@ -464,7 +464,7 @@ telebot_error_e telebot_send_photo(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_audio(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_audio(telebot_handler_t handle, long long int chat_id, char *audio, bool is_file, int duration, char *performer, char *title, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -472,7 +472,7 @@ telebot_error_e telebot_send_audio(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (audio == NULL)) + if (audio == NULL) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_send_audio(_handle->core_h, chat_id, audio, @@ -484,7 +484,7 @@ telebot_error_e telebot_send_audio(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_document(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_document(telebot_handler_t handle, long long int chat_id, char *document, bool is_file, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -492,7 +492,7 @@ telebot_error_e telebot_send_document(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (document == NULL)) + if (document == NULL) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_send_document(_handle->core_h, chat_id, @@ -503,7 +503,7 @@ telebot_error_e telebot_send_document(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_video(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_video(telebot_handler_t handle, long long int chat_id, char *video, bool is_file, int duration, int width, int height, char *caption, bool disable_notification, int reply_to_message_id, char *reply_markup) @@ -512,7 +512,7 @@ telebot_error_e telebot_send_video(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (video == NULL)) + if (video == NULL) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_send_video(_handle->core_h, chat_id, video, @@ -524,7 +524,7 @@ telebot_error_e telebot_send_video(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_voice(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_voice(telebot_handler_t handle, long long int chat_id, char *voice, bool is_file, char *caption, int duration, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -532,7 +532,7 @@ telebot_error_e telebot_send_voice(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (voice == NULL)) + if (voice == NULL) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_send_voice(_handle->core_h, chat_id, voice, @@ -543,7 +543,7 @@ telebot_error_e telebot_send_voice(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_video_note(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_video_note(telebot_handler_t handle, long long int chat_id, char *video_note, bool is_file, int duration, int length, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -551,7 +551,7 @@ telebot_error_e telebot_send_video_note(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (video_note == NULL)) + if (video_note == NULL) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_send_video_note(_handle->core_h, chat_id, @@ -563,7 +563,7 @@ telebot_error_e telebot_send_video_note(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_location(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_location(telebot_handler_t handle, long long int chat_id, float latitude, float longitude, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -571,9 +571,6 @@ telebot_error_e telebot_send_location(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if (chat_id <= 0) - return TELEBOT_ERROR_INVALID_PARAMETER; - telebot_error_e ret = telebot_core_send_location(_handle->core_h, chat_id, latitude, longitude, disable_notification, reply_to_message_id, reply_markup); @@ -582,7 +579,7 @@ telebot_error_e telebot_send_location(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_contact(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_contact(telebot_handler_t handle, long long int chat_id, char *phone_number, char *first_name, char *last_name, bool disable_notification, int reply_to_message_id, char *reply_markup) { @@ -590,7 +587,7 @@ telebot_error_e telebot_send_contact(telebot_handler_t handle, int chat_id, if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if ((chat_id <= 0) || (phone_number == NULL) || (first_name == NULL)) + if ((phone_number == NULL) || (first_name == NULL)) return TELEBOT_ERROR_INVALID_PARAMETER; telebot_error_e ret = telebot_core_send_contact(_handle->core_h, chat_id, @@ -602,16 +599,13 @@ telebot_error_e telebot_send_contact(telebot_handler_t handle, int chat_id, return ret; } -telebot_error_e telebot_send_chat_action(telebot_handler_t handle, int chat_id, +telebot_error_e telebot_send_chat_action(telebot_handler_t handle, long long int chat_id, char *action) { telebot_hdata_t * _handle = (telebot_hdata_t *)handle; if (_handle == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; - if (chat_id <= 0) - return TELEBOT_ERROR_INVALID_PARAMETER; - telebot_error_e ret = telebot_core_send_chat_action(_handle->core_h, chat_id, action); @@ -736,7 +730,7 @@ telebot_error_e telebot_download_file(telebot_handler_t handle, char *file_id, } #if 0 -telebot_error_e telebot_delete_message(int chat_id, int message_id) +telebot_error_e telebot_delete_message(long long int chat_id, int message_id) { if (g_handler == NULL) return TELEBOT_ERROR_NOT_SUPPORTED; @@ -750,7 +744,7 @@ telebot_error_e telebot_delete_message(int chat_id, int message_id) return ret; } -telebot_error_e telebot_send_sticker(int chat_id, char *sticker, +telebot_error_e telebot_send_sticker(long long int chat_id, char *sticker, bool is_file, int reply_to_message_id, char *reply_markup) { if (g_handler == NULL)