Telebot  4.7.0
Library for Telegram bot API
Functions
telebot-methods.h File Reference

This file contains methods used to create telegram bot. More...

#include <stdbool.h>

Go to the source code of this file.

Functions

telebot_error_e telebot_create (telebot_handler_t *handle, char *token)
 Initial function to use telebot APIs. More...
 
telebot_error_e telebot_destroy (telebot_handler_t handle)
 Final function to use telebo APIs. More...
 
telebot_error_e telebot_set_proxy (telebot_handler_t handle, char *addr, char *auth)
 Set proxy address to use telebot behind proxy. More...
 
telebot_error_e telebot_get_proxy (telebot_handler_t handle, char **addr)
 Get proxy address currently used. More...
 
telebot_error_e telebot_get_updates (telebot_handler_t handle, int offset, int limit, int timeout, telebot_update_type_e allowed_updates[], int allowed_updates_count, telebot_update_t **updates, int *count)
 This function is used to get latest updates. More...
 
telebot_error_e telebot_put_updates (telebot_update_t *updates, int count)
 This function is used to release memory used for obtained updates. More...
 
telebot_error_e telebot_set_webhook (telebot_handler_t handle, char *url, char *certificate, int max_connections, telebot_update_type_e allowed_updates[], int allowed_updates_count)
 This function is used to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. More...
 
telebot_error_e telebot_delete_webhook (telebot_handler_t handle)
 This function is used to remove webhook integration if you decide to switch back to getUpdates. More...
 
telebot_error_e telebot_get_webhook_info (telebot_handler_t handle, telebot_webhook_info_t *info)
 This function is used to get information about telegram bot itself. More...
 
telebot_error_e telebot_put_webhook_info (telebot_webhook_info_t *info)
 This function is used to release memory used for obtained information about telegram bot itself. More...
 
telebot_error_e telebot_get_me (telebot_handler_t handle, telebot_user_t *me)
 This function is used to get information about telegram bot itself. More...
 
telebot_error_e telebot_put_me (telebot_user_t *me)
 This function is used to release memory used for obtained information about telegram bot itself. More...
 
telebot_error_e telebot_send_message (telebot_handler_t handle, long long int chat_id, const char *text, const char *parse_mode, bool disable_web_page_preview, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send text messages. More...
 
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)
 Forward messages of any kind. More...
 
telebot_error_e telebot_send_photo (telebot_handler_t handle, long long int chat_id, const char *photo, bool is_file, const char *caption, const char *parse_mode, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send photos. More...
 
telebot_error_e telebot_send_audio (telebot_handler_t handle, long long int chat_id, const char *audio, bool is_file, const char *caption, const char *parse_mode, int duration, const char *performer, const char *title, const char *thumb, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send audio files. if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. Bots can currently send audio files of up to 50 MB in size. For backward compatibility, when the fields title and performer are both empty and the mime-type of the file to be sent is not audio/mpeg, the file will be sent as a playable voice message. For this to work, the audio must be in an .ogg file encoded with OPUS. For sending voice messages, use the telegram_send_voice() function instead. More...
 
telebot_error_e telebot_send_document (telebot_handler_t handle, long long int chat_id, const char *document, bool is_file, const char *thumb, const char *caption, const char *parse_mode, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send general files. More...
 
telebot_error_e telebot_send_video (telebot_handler_t handle, long long int chat_id, const char *video, bool is_file, int duration, int width, int height, const char *thumb, const char *caption, const char *parse_mode, bool supports_streaming, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send video files, Telegram clients support mp4 videos (other formats may be sent as Document). More...
 
telebot_error_e telebot_send_animation (telebot_handler_t handle, long long int chat_id, const char *animation, bool is_file, int duration, int width, int height, const char *thumb, const char *caption, const char *parse_mode, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send animation files (GIF or H.264/MPEG-4 AVC without sound). More...
 
telebot_error_e telebot_send_voice (telebot_handler_t handle, long long int chat_id, const char *voice, bool is_file, const char *caption, const char *parse_mode, int duration, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). More...
 
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, const char *thumb, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send video messages. As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. More...
 
telebot_error_e telebot_send_location (telebot_handler_t handle, long long int chat_id, float latitude, float longitude, int live_period, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send point on the map. More...
 
telebot_error_e telebot_edit_message_live_location (telebot_handler_t handle, long long int chat_id, int message_id, const char *inline_message_id, float latitude, float longitude, const char *reply_markup)
 Edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its live_period expires or editing is explicitly disabled by a call to telebot_stop_message_live_location(). More...
 
telebot_error_e telebot_stop_message_live_location (telebot_handler_t handle, long long int chat_id, int message_id, char *inline_message_id, const char *reply_markup)
 Stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires. More...
 
telebot_error_e telebot_send_venue (telebot_handler_t handle, long long int chat_id, float latitude, float longitude, const char *title, const char *address, const char *foursquare_id, const char *foursquare_type, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send information about a venue. More...
 
telebot_error_e telebot_send_contact (telebot_handler_t handle, long long int chat_id, const char *phone_number, const char *first_name, const char *last_name, const char *vcard, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send phone contacts. More...
 
telebot_error_e telebot_send_poll (telebot_handler_t handle, long long int chat_id, const char *question, const char **options, int count_options, bool is_anonymous, const char *type, bool allows_multiple_answers, int correct_option_id, bool is_closed, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send a native poll. More...
 
telebot_error_e telebot_send_dice (telebot_handler_t handle, long long int chat_id, bool disable_notification, int reply_to_message_id, const char *reply_markup)
 Send a dice, which will have a random value from 1 to 6. More...
 
telebot_error_e telebot_send_chat_action (telebot_handler_t handle, long long int chat_id, char *action)
 Tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of "Retrieving image, please wait…", the bot may use telebot_send_chat_action() with action = upload_photo. The user will see a "sending photo" status for the bot. It is only recommended to use when a response from the bot will take a noticeable amount of time to arrive. More...
 
telebot_error_e telebot_get_user_profile_photos (telebot_handler_t handle, int user_id, int offset, int limit, telebot_user_profile_photos_t *photos)
 This function is used to get user profile pictures object. More...
 
telebot_error_e telebot_put_user_profile_photos (telebot_user_profile_photos_t *photos)
 This function is used to free memory allocated for user profile pictures object. More...
 
telebot_error_e telebot_download_file (telebot_handler_t handle, const char *file_id, const char *path)
 This function is used to download file. More...
 
telebot_error_e telebot_kick_chat_member (telebot_handler_t handle, long long int chat_id, int user_id, long until_date)
 Kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. More...
 
telebot_error_e telebot_unban_chat_member (telebot_handler_t handle, long long int chat_id, int user_id)
 Unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. More...
 
telebot_error_e telebot_restrict_chat_member (telebot_handler_t handle, long long int chat_id, int user_id, long until_date, bool can_send_messages, bool can_send_media_messages, bool can_send_polls, bool can_send_other_messages, bool can_add_web_page_previews, bool can_change_info, bool can_invite_users, bool can_pin_messages)
 Restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass true for all boolean parameters to lift restrictions from a user. More...
 
telebot_error_e telebot_promote_chat_member (telebot_handler_t handle, long long int chat_id, int user_id, bool can_change_info, 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)
 Promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. More...
 
telebot_error_e telebot_set_chat_admin_custom_title (telebot_handler_t handle, long long int chat_id, int user_id, const char *custom_title)
 Export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. More...
 
telebot_error_e telebot_set_chat_permissions (telebot_handler_t handle, long long int chat_id, bool can_send_messages, bool can_send_media_messages, bool can_send_polls, bool can_send_other_messages, bool can_add_web_page_previews, bool can_change_info, bool can_invite_users, bool can_pin_messages)
 Set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the 'can_restrict_members' admin rights. More...
 
telebot_error_e telebot_export_chat_invite_link (telebot_handler_t handle, long long int chat_id, char **invite_link)
 Generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. More...
 
telebot_error_e telebot_set_chat_photo (telebot_handler_t handle, long long int chat_id, const char *photo)
 Set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. More...
 
telebot_error_e telebot_delete_chat_photo (telebot_handler_t handle, long long int chat_id)
 Delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. More...
 
telebot_error_e telebot_set_chat_title (telebot_handler_t handle, long long int chat_id, const char *title)
 Change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. More...
 
telebot_error_e telebot_set_chat_description (telebot_handler_t handle, long long int chat_id, const char *description)
 Change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. More...
 
telebot_error_e telebot_pin_chat_message (telebot_handler_t handle, long long int chat_id, int message_id, bool disable_notification)
 Pin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in the supergroup or 'can_edit_messages' admin right in the channel. More...
 
telebot_error_e telebot_unpin_chat_message (telebot_handler_t handle, long long int chat_id)
 Unpin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in the supergroup or 'can_edit_messages' admin right in the channel. More...
 
telebot_error_e telebot_leave_chat (telebot_handler_t handle, long long int chat_id)
 Leave a group, supergroup or channel. More...
 
telebot_error_e telebot_get_chat (telebot_handler_t handle, long long int chat_id, telebot_chat_t *chat)
 Get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc). More...
 
telebot_error_e telebot_put_chat (telebot_chat_t *chat)
 Release chat obtained with telebot_get_chat(). More...
 
telebot_error_e telebot_get_chat_admins (telebot_handler_t handle, long long int chat_id, telebot_chat_member_t **admin, int *count)
 Get a list of administrators in a chat. Response contains an array of objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. More...
 
telebot_error_e telebot_put_chat_admins (telebot_chat_member_t *admins, int count)
 Release chat admins obtained with telebot_get_chat_admins(). More...
 
telebot_error_e telebot_get_chat_members_count (telebot_handler_t handle, long long int chat_id, int *count)
 Get the number of members in a chat. More...
 
telebot_error_e telebot_get_chat_member (telebot_handler_t handle, long long int chat_id, int user_id, telebot_chat_member_t *member)
 Get information about a member of a chat. More...
 
telebot_error_e telebot_put_chat_member (telebot_chat_member_t *member)
 Release chat member otained with telebot_get_chat_member(). More...
 
telebot_error_e telebot_set_chat_sticker_set (telebot_handler_t handle, long long int chat_id, const char *sticker_set_name)
 Set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in telebot_get_chat requests to check if the bot can use it. More...
 
telebot_error_e telebot_delete_chat_sticker_set (telebot_handler_t handle, long long int chat_id)
 Delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in telebot_get_chat requests to check if the bot can use this method. More...
 
telebot_error_e telebot_answer_callback_query (telebot_handler_t handle, const char *callback_query_id, const char *text, bool show_alert, const char *url, int cache_time)
 Send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. More...
 
telebot_error_e telebot_set_my_commands (telebot_handler_t handle, telebot_bot_command_t commands[], int count)
 Change the list of the bot's commands. More...
 
telebot_error_e telebot_get_my_commands (telebot_handler_t handle, telebot_bot_command_t **commands, int *count)
 Get the current list of the bot's commands. More...
 
telebot_error_e telebot_put_my_commands (telebot_bot_command_t *commands, int count)
 Release bot commands obtained with telebot_get_my_commands(). More...
 
telebot_error_e telebot_edit_message_text (telebot_handler_t handle, long long int chat_id, int message_id, const char *inline_message_id, const char *text, const char *parse_mode, bool disable_web_page_preview, const char *reply_markup)
 Edit text and game messages sent by the bot or via the bot (for inline bots). More...
 
telebot_error_e telebot_edit_message_caption (telebot_handler_t handle, long long int chat_id, int message_id, const char *inline_message_id, const char *caption, const char *parse_mode, const char *reply_markup)
 Edit captions of messages sent by the bot or via the bot (for inline bots). More...
 
telebot_error_e telebot_edit_message_reply_markup (telebot_handler_t handle, long long int chat_id, int message_id, const char *inline_message_id, const char *reply_markup)
 Edit only the reply markup of messages sent by the bot or via the bot (for inline bots). More...
 
telebot_error_e telebot_stop_poll (telebot_handler_t handle, long long int chat_id, int message_id, const char *reply_markup)
 Stop a poll which was sent by the bot. More...
 
telebot_error_e telebot_delete_message (telebot_handler_t handle, long long int chat_id, int message_id)
 Delete a message, including service messages, with the following limitations: More...
 

Detailed Description

This file contains methods used to create telegram bot.

Author
Elmurod Talipov
Date
2020-04-19