docs: add bot library APIs (#7334)

This commit is contained in:
Evgeny
2026-08-02 14:12:57 +01:00
committed by GitHub
parent cbae9c5e87
commit 31faceef73
11 changed files with 226 additions and 10 deletions
@@ -149,6 +149,31 @@ def APIChatItemReaction_cmd_string(self: APIChatItemReaction) -> str:
APIChatItemReaction_Response = CR.ChatItemReaction | CR.ChatCmdError
# Share user address card
# Network usage: no.
class APIShareMyAddress(TypedDict):
toSendRef: "T.ChatRef"
def APIShareMyAddress_cmd_string(self: APIShareMyAddress) -> str:
return '/_share address' + T.ChatRef_cmd_string(self['toSendRef'])
APIShareMyAddress_Response = CR.ChatMsgContent
# Share channel address
# Network usage: no.
class APIShareChatMsgContent(TypedDict):
shareChatRef: "T.ChatRef"
toSendRef: "T.ChatRef"
def APIShareChatMsgContent_cmd_string(self: APIShareChatMsgContent) -> str:
return '/_share chat content ' + T.ChatRef_cmd_string(self['shareChatRef']) + ' ' + T.ChatRef_cmd_string(self['toSendRef'])
APIShareChatMsgContent_Response = CR.ChatMsgContent
# File commands
# Commands to receive and to cancel files. Files are sent as part of the message, there are no separate commands to send files.
@@ -368,6 +393,18 @@ def APIUpdateGroupProfile_cmd_string(self: APIUpdateGroupProfile) -> str:
APIUpdateGroupProfile_Response = CR.GroupUpdated | CR.ChatCmdError
# Verify group domain
# Network usage: interactive.
class APIVerifyGroupDomain(TypedDict):
groupId: int # int64
def APIVerifyGroupDomain_cmd_string(self: APIVerifyGroupDomain) -> str:
return '/_verify domain #' + str(self['groupId'])
APIVerifyGroupDomain_Response = CR.GroupDomainVerified
# Group link commands
# These commands can be used by bots that manage multiple public groups
@@ -36,6 +36,11 @@ class ChatItemsDeleted(TypedDict):
byUser: bool
timed: bool
class ChatMsgContent(TypedDict):
type: Literal["chatMsgContent"]
user: "T.User"
msgContent: "T.MsgContent"
class ChatRunning(TypedDict):
type: Literal["chatRunning"]
@@ -174,6 +179,12 @@ class GroupsList(TypedDict):
user: "T.User"
groups: list["T.GroupInfo"]
class GroupDomainVerified(TypedDict):
type: Literal["groupDomainVerified"]
user: "T.User"
groupInfo: "T.GroupInfo"
verificationFailure: NotRequired[str]
class Invitation(TypedDict):
type: Literal["invitation"]
user: "T.User"
@@ -319,6 +330,7 @@ ChatResponse = (
| ChatItemReaction
| ChatItemUpdated
| ChatItemsDeleted
| ChatMsgContent
| ChatRunning
| ChatStarted
| ChatStopped
@@ -345,6 +357,7 @@ ChatResponse = (
| GroupMembers
| GroupUpdated
| GroupsList
| GroupDomainVerified
| Invitation
| LeftMemberUser
| MemberAccepted
@@ -371,4 +384,4 @@ ChatResponse = (
| ApiChats
)
ChatResponse_Tag = Literal["acceptingContactRequest", "activeUser", "chatItemNotChanged", "chatItemReaction", "chatItemUpdated", "chatItemsDeleted", "chatRunning", "chatStarted", "chatStopped", "cmdOk", "chatCmdError", "connectionPlan", "contactAlreadyExists", "contactConnectionDeleted", "contactDeleted", "contactPrefsUpdated", "contactRequestRejected", "contactsList", "groupDeletedUser", "groupLink", "groupLinkCreated", "groupLinkDeleted", "groupCreated", "publicGroupCreated", "publicGroupCreationFailed", "groupRelays", "groupRelaysAdded", "groupRelaysAddFailed", "relayGroupAllowed", "groupMembers", "groupUpdated", "groupsList", "invitation", "leftMemberUser", "memberAccepted", "membersBlockedForAllUser", "membersRoleUser", "newChatItems", "rcvFileAccepted", "rcvFileAcceptedSndCancelled", "rcvFileCancelled", "sentConfirmation", "sentGroupInvitation", "sentInvitation", "serviceReplyAccepted", "sndFileCancelled", "userAcceptedGroupSent", "userContactLink", "userContactLinkCreated", "userContactLinkDeleted", "userContactLinkUpdated", "userDeletedMembers", "userProfileUpdated", "userProfileNoChange", "usersList", "apiChats"]
ChatResponse_Tag = Literal["acceptingContactRequest", "activeUser", "chatItemNotChanged", "chatItemReaction", "chatItemUpdated", "chatItemsDeleted", "chatMsgContent", "chatRunning", "chatStarted", "chatStopped", "cmdOk", "chatCmdError", "connectionPlan", "contactAlreadyExists", "contactConnectionDeleted", "contactDeleted", "contactPrefsUpdated", "contactRequestRejected", "contactsList", "groupDeletedUser", "groupLink", "groupLinkCreated", "groupLinkDeleted", "groupCreated", "publicGroupCreated", "publicGroupCreationFailed", "groupRelays", "groupRelaysAdded", "groupRelaysAddFailed", "relayGroupAllowed", "groupMembers", "groupUpdated", "groupsList", "groupDomainVerified", "invitation", "leftMemberUser", "memberAccepted", "membersBlockedForAllUser", "membersRoleUser", "newChatItems", "rcvFileAccepted", "rcvFileAcceptedSndCancelled", "rcvFileCancelled", "sentConfirmation", "sentGroupInvitation", "sentInvitation", "serviceReplyAccepted", "sndFileCancelled", "userAcceptedGroupSent", "userContactLink", "userContactLinkCreated", "userContactLinkDeleted", "userContactLinkUpdated", "userDeletedMembers", "userProfileUpdated", "userProfileNoChange", "usersList", "apiChats"]
@@ -1175,7 +1175,7 @@ ChatListQuery = ChatListQuery_filters | ChatListQuery_search
ChatListQuery_Tag = Literal["filters", "search"]
ChatPeerType = Literal["human", "bot"]
ChatPeerType = Literal["human", "bot", "business"]
# Used in API commands. Chat scope can only be passed with groups.