diff --git a/data/core.telegram.org/api/bots/commands.html b/data/core.telegram.org/api/bots/commands.html new file mode 100644 index 0000000000..4a2dc42d6c --- /dev/null +++ b/data/core.telegram.org/api/bots/commands.html @@ -0,0 +1,140 @@ + + +
+ +Bots offer a set of commands that can be used by users in private, or in a chat.
+For a simplified description using the HTTP bot API, see here ».
+botCommand#c27ac8c7 command:string description:string = BotCommand;
+
+botInfo#1b74b335 user_id:long description:string commands:Vector<BotCommand> = BotInfo;
+
+channelFull#e9b27a17 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string = ChatFull;
+userFull#d697ff05 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string = UserFull;
+
+user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
+The botInfo constructors contained in the userFull, chatFull, channelFull contain a list of commands, and for groups, the ID and a description of each bot.
+In graphical clients, when users begin a message with a /
, a list of commands supported by all bots present in the current chat should be shown; the same should be done for one-to-one chats with the bot itself.
If the command list of a bot changes, the bot_info_version
contained in the user constructor received in updates will change; this indicates that the client should refetch full bot information using users.getFullUser.
botCommand#c27ac8c7 command:string description:string = BotCommand;
+
+---functions---
+
+bots.setBotCommands#517165a scope:BotCommandScope lang_code:string commands:Vector<BotCommand> = Bool;
+The command list can be changed by the owner of the bot through @botfather, but bots can also change their own command list by invoking bots.setBotCommands.
We welcome all developers to use our API and source code to create Telegram-like messaging applications on our platform free of charge.
+++In order to ensure consistency and security across the Telegram ecosystem, +all third-party client apps must comply with the API Terms of Service.
+
In order to obtain an API id and develop your own application using the Telegram API you need to do the following:
+We will be sending important developer notifications to the phone number that you use in this process, so please use an up-to-date number connected to your active Telegram account.
+Before using the MTProto Telegram API, please note that all API client libraries are strictly monitored to prevent abuse.
+If you use the Telegram API for flooding, spamming, faking subscriber and view counters of channels, you will be banned forever.
+Due to excessive abuse of the Telegram API, all accounts that sign up or log in using unofficial Telegram API clients are automatically put under observation to avoid violations of the Terms of Service.
+If you didn't violate the Terms of Service but your account does get banned after using the API, write to recover@telegram.org explaining what you intend to do with the API, asking to unban your account.
+Please note that emails are checked by a human, so automatically generated emails will be detected and banned.
Everyone is welcome to use our open source code. We have included a sample API id with the code. This API id is limited on the server side and is not suitable for apps released to end-users — using it for anything but testing purposes will result in the API_ID_PUBLISHED_FLOOD error for your users. It is necessary that you obtain your own API id before you publish your app.
++Please remember to publish your code as well in order to comply with the GNU GPL licences.
+
We welcome all developers to use our API and source code to create Telegram-like messaging applications on our platform free of charge. In order to ensure consistency and security across the Telegram ecosystem, all third-party client apps must comply with the following Terms of Service.
+1.1. Telegram is a privacy-oriented platform. All client apps must, therefore, guard their users' privacy with utmost care and comply with our Security Guidelines.
1.2. Developers are welcome to add new features or improve and extend existing Telegram features provided that these modifications do not violate these Terms of Service.
1.3. As a client developer, you must make sure that all the basic features of the main Telegram apps function correctly and in an expected way both in your app and when users of your app communicate with other Telegram users. It is forbidden to force users of other Telegram clients to download your app in order to view certain messages and content sent using your app.
1.4. It is forbidden to interfere with the basic functionality of Telegram. This includes but is not limited to: making actions on behalf of the user without the user's knowledge and consent, preventing self-destructing content from disappearing, preventing last seen and online statuses from being displayed correctly, tampering with the 'read' statuses of messages (e.g. implementing a 'ghost mode'), preventing typing statuses from being sent/displayed, etc.
2.1. You must obtain your own api_id for your application.
2.2. We offer our API free of charge, but your users must be aware of the fact that your app uses the Telegram API and is part of the Telegram ecosystem. This fact must be featured prominently in the app's description in the app stores and in the in-app intro if your app has it.
2.3. To avoid confusion, the title of your app must not include the word “Telegram”. An exception can be made if the word “Telegram” is preceded with the word “Unofficial” in the title.
2.4. You must not use the official Telegram logo for your app. Both the Telegram brand and its logo are registered trademarks protected by law in almost every country.
3.1. Developers are allowed to monetize their coding efforts through advertising or other legitimate means.
3.2. If you decide to monetize your app, you must clearly mention all the methods of monetization that are used in your app in all its app store descriptions.
3.3. If your app allows accessing content from Telegram channels, you must include support for official sponsored messages in Telegram channels and may not interefere with this functionality.
4.1. If your app violates these terms, we will notify the Telegram account responsible for the app about the breach of terms.
4.2. If you do not update the app to fix the highlighted issues within 10 days, we will have to discontinue your access to Telegram API and contact the app stores about the removal of your apps that are using the Telegram API in violation of these terms.
We reserve the right to expand these terms and guidelines as the need arises. We will inform client developers of such changes via an in-app notification to their accounts connected to the app in question.
++ ++
Channel/supergroup info
+channel#8261ac61 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
+Name | +Type | +Description | +
---|---|---|
flags | +# | +Flags, see TL conditional fields | +
creator | +flags.0?true | +Whether the current user is the creator of this channel | +
left | +flags.2?true | +Whether the current user has left this channel | +
broadcast | +flags.5?true | +Is this a channel? | +
verified | +flags.7?true | +Is this channel verified by telegram? | +
megagroup | +flags.8?true | +Is this a supergroup? | +
restricted | +flags.9?true | +Whether viewing/writing in this channel for a reason (see restriction_reason |
+
signatures | +flags.11?true | +Whether signatures are enabled (channels) | +
min | +flags.12?true | +See min | +
scam | +flags.19?true | +This channel/supergroup is probably a scam | +
has_link | +flags.20?true | +Whether this channel has a private join link | +
has_geo | +flags.21?true | +Whether this chanel has a geoposition | +
slowmode_enabled | +flags.22?true | +Whether slow mode is enabled for groups to prevent flood in chat | +
call_active | +flags.23?true | +Whether a group call or livestream is currently active | +
call_not_empty | +flags.24?true | +Whether there's anyone in the group call or livestream | +
fake | +flags.25?true | +If set, this supergroup/channel was reported by many users as a fake or scam: be careful when interacting with it. | +
gigagroup | +flags.26?true | +Whether this supergroup is a gigagroup | +
id | +long | +ID of the channel | +
access_hash | +flags.13?long | +Access hash | +
title | +string | +Title | +
username | +flags.6?string | +Username | +
photo | +ChatPhoto | +Profile photo | +
date | +int | +Date when the user joined the supergroup/channel, or if the user isn't a member, its creation date | +
restriction_reason | +flags.9?Vector<RestrictionReason> | +Contains the reason why access to this channel must be restricted. | +
admin_rights | +flags.14?ChatAdminRights | +Admin rights of the user in this channel (see rights) | +
banned_rights | +flags.15?ChatBannedRights | +Banned rights of the user in this channel (see rights) | +
default_banned_rights | +flags.18?ChatBannedRights | +Default chat rights (see rights) | +
participants_count | +flags.17?int | +Participant count | +
In some situations user and channel constructors have reduced set of fields present (although id is always there) and min flag set.
+How to handle channels, supergroups, groups, and what's the difference between them.
+How to handle admin permissions, granular bans and global permissions in channels, groups and supergroups.
The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no repeated update received after 6 seconds, it should be considered that the user stopped doing whatever he's been doing.
+updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update;
+Name | +Type | +Description | +
---|---|---|
chat_id | +long | +Group id | +
from_id | +Peer | +Peer that started typing (can be the chat itself, in case of anonymous admins). | +
action | +SendMessageAction | +Type of action Parameter added in Layer 17. |
+
Below you will find information on schema changes. For more details on the use of layers, see Invoking API methods.
Complete phone call E2E encryption key exchange »
+phone.phoneCall#ec82e140 phone_call:PhoneCall users:Vector<User> = phone.PhoneCall;
+---functions---
+phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall;
+Name | +Type | +Description | +
---|---|---|
peer | +InputPhoneCall | +The phone call | +
g_a | +bytes | +Parameter for E2E encryption key exchange » | +
key_fingerprint | +long | +Key fingerprint | +
protocol | +PhoneCallProtocol | +Phone call settings | +
Code | +Type | +Description | +
---|---|---|
400 | +CALL_ALREADY_DECLINED | +The call was already declined. | +
400 | +CALL_PEER_INVALID | +The provided call peer object is invalid. | +
Telegram allows pinning multiple messages on top of a specific chat.
-message#85d6cbe2 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int = Message;
-
-updatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vector<int> pts:int pts_count:int = Update;
-updatePinnedChannelMessages#5bb98608 flags:# pinned:flags.0?true channel_id:long messages:Vector<int> pts:int pts_count:int = Update;
-
----functions---
-
-messages.updatePinnedMessage#d2aaf7ec flags:# silent:flags.0?true unpin:flags.1?true pm_oneside:flags.2?true peer:InputPeer id:int = Updates;
-messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory;
-
-messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
-channels.getMessages#ad8c9a23 channel:InputChannel id:Vector<InputMessage> = messages.Messages;
-The messages.updatePinnedMessage method can be used to pin or unpin a specific message in an arbitrary chat.
-The unpin
flags specifies whether to unpin or pin the message, and pm_oneside
specifies whether the message should only be pinned on the local side of a one-to-one chat.
messages.unpinAllMessages can be used to unpin all messages in a chat.
-When (un)pinning messages, a updatePinnedMessages or updatePinnedChannelMessages update will be emitted, containing IDs of pinned or unpinned messages.
-Pinned messages will also have the will also have the pinned
flag of message set.
userFull#d697ff05 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string = UserFull;
-chatFull#4dbdc099 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string = ChatFull;
-channelFull#e9b27a17 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string = ChatFull;
-
-inputMessagesFilterPinned#1bb00451 = MessagesFilter;
-
----functions---
-
-messages.search#a0fda762 flags:# peer:InputPeer q:string from_id:flags.0?InputPeer top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;
-The pinned_msg_id
of userFull, chatFull, channelFull contains the ID of only the latest pinned message.
-To obtain a full list, use messages.search with inputMessagesFilterPinned filter.
Change privacy settings of current account
+account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;
+---functions---
+account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules;
+Name | +Type | +Description | +
---|---|---|
key | +InputPrivacyKey | +Peers to which the privacy rules apply | +
rules | +Vector<InputPrivacyRule> | +New privacy rules | +
Code | +Type | +Description | +
---|---|---|
400 | +PRIVACY_KEY_INVALID | +The privacy key is invalid. | +
400 | +PRIVACY_TOO_LONG | +Too many privacy rules were specified, the current limit is 1000. | +
400 | +PRIVACY_VALUE_INVALID | +The specified privacy rule combination is invalid. | +