Skip to content

Instantly share code, notes, and snippets.

@AH-dark
Created May 14, 2023 05:05
Show Gist options
  • Select an option

  • Save AH-dark/bbf77fd3fe14c994d55304b1cf91fb55 to your computer and use it in GitHub Desktop.

Select an option

Save AH-dark/bbf77fd3fe14c994d55304b1cf91fb55 to your computer and use it in GitHub Desktop.
Protobuf for telegram bot api
syntax = "proto3";
package telebot;
option go_package = "telebot";
message user {
sint64 id = 1;
optional bool is_bot = 2;
optional bool is_premium = 3;
optional string first_name = 4;
optional string last_name = 5;
optional string username = 6;
optional string language_code = 7;
optional bool can_join_groups = 8;
optional bool can_read_all_group_messages = 9;
optional bool supports_inline_queries = 10;
}
message location {
float longitude = 1;
float latitude = 2;
optional float horizontal_accuracy = 3;
optional sint32 live_period = 4;
optional sint32 heading = 5;
optional sint32 proximity_alert_radius = 6;
}
message mask_position {
string point = 1;
float x_shift = 2;
float y_shift = 3;
float scale = 4;
}
message photo_size {
string file_id = 1;
string file_unique_id = 2;
sint32 width = 3;
sint32 height = 4;
optional int32 file_size = 5;
}
message file {
string file_id = 1;
string file_unique_id = 2;
optional sint32 file_size = 3;
optional string file_path = 4;
}
message animation {
string file_id = 1;
string file_unique_id = 2;
sint32 width = 3;
sint32 height = 4;
sint32 duration = 5;
optional photo_size thumb = 6;
optional string file_name = 7;
optional string mime_type = 8;
optional sint32 file_size = 9;
}
message audio {
string file_id = 1;
string file_unique_id = 2;
sint32 duration = 3;
optional string performer = 4;
optional string title = 5;
optional string file_name = 6;
optional string mime_type = 7;
optional sint32 file_size = 8;
optional photo_size thumb = 9;
}
message document {
string file_id = 1;
string file_unique_id = 2;
optional photo_size thumb = 3;
optional string file_name = 4;
optional string mime_type = 5;
optional sint32 file_size = 6;
}
message sticker {
string file_id = 1;
string file_unique_id = 2;
sint32 width = 3;
sint32 height = 4;
optional bool is_animated = 5;
optional bool is_video = 6;
optional photo_size thumb = 7;
optional string emoji = 8;
optional string set_name = 9;
optional file premium_animation = 10;
optional mask_position mask_position = 11;
optional string custom_emoji_id = 12;
optional sint32 file_size = 13;
}
message voice {
string file_id = 1;
string file_unique_id = 2;
sint32 duration = 3;
optional string mime_type = 4;
optional sint32 file_size = 5;
}
message video {
string file_id = 1;
string file_unique_id = 2;
sint32 width = 3;
sint32 height = 4;
sint32 duration = 5;
optional photo_size thumb = 6;
optional string file_name = 7;
optional string mime_type = 8;
optional sint32 file_size = 9;
}
message video_note {
string file_id = 1;
string file_unique_id = 2;
sint32 length = 3;
sint32 duration = 4;
optional photo_size thumb = 5;
optional sint32 file_size = 6;
}
message voice_chat_scheduled {
sint32 start_date = 1;
}
message voice_chat_started {
}
message voice_chat_ended {
sint32 duration = 1;
}
message voice_chat_participants_invited {
repeated user users = 1;
}
message message_entity {
string type = 1;
sint32 offset = 2;
sint32 length = 3;
optional string url = 4;
optional user user = 5;
optional string language = 6;
}
message contact {
string phone_number = 1;
optional string first_name = 2;
optional string last_name = 3;
optional sint64 user_id = 4;
optional string vcard = 5;
}
message dice {
string emoji = 1;
sint32 value = 2;
}
message game {
string title = 1;
string description = 2;
repeated photo_size photo = 3;
optional string text = 4;
repeated message_entity text_entities = 5;
optional animation animation = 6;
}
message poll_option {
string text = 1;
sint32 voter_count = 2;
}
message poll {
string id = 1;
string question = 2;
repeated poll_option options = 3;
sint32 total_voter_count = 4;
bool is_closed = 5;
bool is_anonymous = 6;
string type = 7;
bool allows_multiple_answers = 8;
optional sint32 correct_option_id = 9;
optional string explanation = 10;
repeated message_entity explanation_entities = 11;
optional sint32 open_period = 12;
optional sint32 close_date = 13;
}
message poll_answer {
string poll_id = 1;
user user = 2;
repeated sint32 option_ids = 3;
}
message venue {
location location = 1;
string title = 2;
string address = 3;
optional string foursquare_id = 4;
optional string foursquare_type = 5;
optional string google_place_id = 6;
optional string google_place_type = 7;
}
message passport_file {
string file_id = 1;
string file_unique_id = 2;
sint32 file_size = 3;
sint32 file_date = 4;
}
message encrypted_passport_element {
string type = 1;
optional string data = 2;
optional string phone_number = 3;
optional string email = 4;
repeated passport_file files = 5;
passport_file front_side = 6;
passport_file reverse_side = 7;
passport_file selfie = 8;
}
message encrypted_credentials {
string data = 1;
string hash = 2;
string secret = 3;
}
message passport_data {
repeated encrypted_passport_element data = 1;
encrypted_credentials credentials = 2;
}
message proximity_alert_triggered {
user traveler = 1;
user watcher = 2;
sint32 distance = 3;
}
message web_app_data {
string data = 1;
string button_text = 2;
}
message message_auto_delete_timer_changed {
sint64 message_auto_delete_time = 1;
}
message invoice {
string title = 1;
string description = 2;
string start_parameter = 3;
string currency = 4;
sint64 total_amount = 5;
}
message shipping_address {
string country_code = 1;
string state = 2;
string city = 3;
string street_line1 = 4;
string street_line2 = 5;
string post_code = 6;
}
message order_info {
optional string name = 1;
optional string phone_number = 2;
optional string email = 3;
optional shipping_address shipping_address = 4;
}
message successful_payment {
string currency = 1;
sint64 total_amount = 2;
string invoice_payload = 3;
optional string shipping_option_id = 4;
order_info order_info = 5;
string telegram_payment_charge_id = 6;
string provider_payment_charge_id = 7;
}
message message {
sint64 message_id = 1;
optional user from = 2;
optional chat sender_chat = 3;
optional sint64 date = 4;
optional chat chat = 5;
optional user forward_from = 6;
optional chat forward_from_chat = 7;
optional sint64 forward_from_message_id = 8;
optional string forward_signature = 9;
optional string forward_sender_name = 10;
optional sint64 forward_date = 11;
optional bool is_automatic_forward = 12;
optional message reply_to_message = 13;
optional user via_bot = 14;
optional sint64 edit_date = 15;
optional bool has_protected_content = 16;
optional string media_group_id = 17;
optional string author_signature = 18;
optional string text = 19;
repeated message_entity entities = 20;
optional animation animation = 21;
optional animation premium_animation = 22;
optional audio audio = 23;
optional document document = 24;
repeated photo_size photo = 25;
optional sticker sticker = 26;
optional video video = 27;
optional video_note video_note = 28;
optional voice voice = 29;
optional string caption = 30;
repeated message_entity caption_entities = 31;
optional contact contact = 32;
optional dice dice = 33;
optional game game = 34;
optional poll poll = 35;
optional venue venue = 36;
optional location location = 37;
repeated user new_chat_members = 38;
optional user left_chat_member = 39;
optional string new_chat_title = 40;
repeated photo_size new_chat_photo = 41;
optional bool delete_chat_photo = 42;
optional bool group_chat_created = 43;
optional bool supergroup_chat_created = 44;
optional bool channel_chat_created = 45;
optional message_auto_delete_timer_changed message_auto_delete_timer_changed = 46;
optional sint32 migrate_to_chat_id = 47;
optional sint32 migrate_from_chat_id = 48;
optional message pinned_message = 49;
optional invoice invoice = 50;
optional successful_payment successful_payment = 51;
optional string connected_website = 52;
optional passport_data passport_data = 53;
optional proximity_alert_triggered proximity_alert_triggered = 54;
optional voice_chat_scheduled voice_chat_scheduled = 55;
optional voice_chat_started voice_chat_started = 56;
optional voice_chat_ended voice_chat_ended = 57;
optional voice_chat_participants_invited voice_chat_participants_invited = 58;
optional web_app_data web_app_data = 59;
// optional inline_keyboard_markup reply_markup = 60;
}
message chat_photo {
string small_file_id = 1;
string small_file_unique_id = 2;
string big_file_id = 3;
string big_file_unique_id = 4;
}
message chat_permissions {
optional bool can_send_messages = 1;
optional bool can_send_media_messages = 2;
optional bool can_send_polls = 3;
optional bool can_send_other_messages = 4;
optional bool can_add_web_page_previews = 5;
optional bool can_change_info = 6;
optional bool can_invite_users = 7;
optional bool can_pin_messages = 8;
}
message chat_location {
string location = 1;
string address = 2;
}
message chat {
sint64 id = 1;
string type = 2;
optional string title = 3;
optional string username = 4;
optional string first_name = 5;
optional string last_name = 6;
optional chat_photo photo = 7;
optional string bio = 8;
optional bool has_private_forwards = 9;
optional string description = 10;
optional string invite_link = 11;
optional message pinned_message = 12;
optional chat_permissions permissions = 13;
optional sint32 slow_mode_delay = 14;
optional sint32 message_auto_delete_time = 15;
optional bool has_protected_content = 16;
optional string sticker_set_name = 17;
optional bool can_set_sticker_set = 18;
optional sint64 linked_chat_id = 19;
optional chat_location location = 20;
}
message inline_query {
string id = 1;
user from = 2;
string query = 3;
string offset = 4;
optional string chat_type = 5;
optional location location = 6;
}
message chosen_inline_result {
string result_id = 1;
user from = 2;
optional location location = 3;
optional string inline_message_id = 4;
string query = 5;
}
message callback_query {
string id = 1;
user from = 2;
optional message message = 3;
optional string inline_message_id = 4;
string chat_instance = 5;
optional string data = 6;
optional string game_short_name = 7;
}
message shipping_query {
string id = 1;
user from = 2;
string invoice_payload = 3;
shipping_address shipping_address = 4;
}
message pre_checkout_query {
string id = 1;
user from = 2;
string currency = 3;
sint64 total_amount = 4;
string invoice_payload = 5;
optional string shipping_option_id = 6;
optional order_info order_info = 7;
}
message chat_member {
user user = 1;
string status = 2; // "creator", "administrator", "member", "restricted", "left" or "kicked"
optional string custom_title = 3;
optional bool is_anonymous = 4;
optional sint32 until_date = 5;
optional bool can_be_edited = 6;
optional bool can_manage_chat = 7;
optional bool can_post_messages = 8;
optional bool can_edit_messages = 9;
optional bool can_delete_messages = 10;
optional bool can_manage_voice_chats = 11;
optional bool can_restrict_members = 12;
optional bool can_promote_members = 13;
optional bool can_change_info = 14;
optional bool can_invite_users = 15;
optional bool can_pin_messages = 16;
optional bool is_member = 17;
optional bool can_send_messages = 18;
optional bool can_send_media_messages = 19;
optional bool can_send_polls = 20;
optional bool can_send_other_messages = 21;
optional bool can_add_web_page_previews = 22;
}
message chat_invite_link {
string invite_link = 1;
user creator = 2;
optional bool creates_join_request = 3;
bool is_primary = 4;
bool is_revoked = 5;
optional string name = 6;
optional sint64 expire_date = 7;
optional sint32 member_limit = 8;
optional sint32 pending_join_request_count = 9;
}
message chat_member_updated {
chat chat = 1;
user from = 2;
sint64 date = 3;
chat_member old_chat_member = 4;
chat_member new_chat_member = 5;
chat_invite_link invite_link = 6;
}
message chat_join_request {
chat chat = 1;
user from = 2;
sint64 date = 3;
optional string bio = 4;
optional chat_invite_link invite_link = 5;
}
message update {
sint64 update_id = 1;
optional message message = 2;
optional message edited_message = 3;
optional message channel_post = 4;
optional message edited_channel_post = 5;
optional inline_query inline_query = 6;
optional chosen_inline_result chosen_inline_result = 7;
optional callback_query callback_query = 8;
optional shipping_query shipping_query = 9;
optional pre_checkout_query pre_checkout_query = 10;
optional poll poll = 11;
optional poll_answer poll_answer = 12;
optional chat_member_updated my_chat_member = 13;
optional chat_member_updated chat_member = 14;
optional chat_join_request chat_join_request = 15;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment