mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-16 10:06:00 +00:00
rfc: bot messages and buttons, core: command markdown, supported commands in profile preferences, chat sessions preference, peer type field in profile to identify bots (#5360)
* rfc: bot messages and buttons * update * update bot rfc * core: add bot commands to chat preferences and peer type to profile * update postgresql schema * update query plans * chat sessions preference * markdown for bot commands * schema * core: file preference, options to create bot from CLI * core: different command type * ios: commands menu * update types * update ios * improve command markdown * core, ios: update types * android, desktop: clickable commands in messages in chats with bots * android, desktop: commands menu * command menu button, bot icon * ios: connect flow for bots * android, desktop: connect flow for bots * icon * CLI commands to view and set commands, remove "hidden" property of command, bot api docs * corrections * fix inheriting profile preferences to business groups * note on business address * ios: export localizations * fix test * commands to set file preference on user/contact, tidy up layout and display of command and attachment buttons
This commit is contained in:
@@ -114,10 +114,10 @@ chatCommandsDocsData =
|
||||
("APIMembersRole", [], "Set members role. Requires Admin role.", ["CRMembersRoleUser"], [], Just UNBackground, "/_member role #" <> Param "groupId" <> " " <> Join ',' "groupMemberIds" <> " " <> Param "memberRole"),
|
||||
("APIBlockMembersForAll", [], "Block members. Requires Moderator role.", ["CRMembersBlockedForAllUser"], [], Just UNBackground, "/_block #" <> Param "groupId" <> " " <> Join ',' "groupMemberIds" <> OnOffParam "blocked" "blocked" Nothing),
|
||||
("APIRemoveMembers", [], "Remove members. Requires Admin role.", ["CRUserDeletedMembers", "CRChatCmdError"], ["CEGroupMemberNotFound"], Just UNBackground, "/_remove #" <> Param "groupId" <> " " <> Join ',' "groupMemberIds" <> OnOffParam "messages" "withMessages" (Just False)),
|
||||
("APILeaveGroup", [], "Leave group.", ["CRLeftMemberUser"], [], Just UNBackground, "/_leave #" <> Param "groupId")
|
||||
-- ("APIListMembers", [], "Get group members.", ["CRGroupMembers"], [], Nothing, ""),
|
||||
-- ("APINewGroup", [], "Create group.", ["CRGroupCreated"], [], Nothing, ""),
|
||||
-- ("APIUpdateGroupProfile", [], "Update group profile.", ["CRGroupUpdated"], [], Just UNBackground, [])
|
||||
("APILeaveGroup", [], "Leave group.", ["CRLeftMemberUser"], [], Just UNBackground, "/_leave #" <> Param "groupId"),
|
||||
("APIListMembers", [], "Get group members.", ["CRGroupMembers"], [], Nothing, "/_members #" <> Param "groupId"),
|
||||
("APINewGroup", [], "Create group.", ["CRGroupCreated"], [], Nothing, "/_group " <> Param "userId" <> OnOffParam "incognito" "incognito" (Just False) <> " " <> Json "groupProfile"),
|
||||
("APIUpdateGroupProfile", [], "Update group profile.", ["CRGroupUpdated"], [], Just UNBackground, "/_group_profile #" <> Param "groupId" <> " " <> Json "groupProfile")
|
||||
]
|
||||
),
|
||||
( "Group link commands",
|
||||
@@ -138,7 +138,7 @@ chatCommandsDocsData =
|
||||
]
|
||||
),
|
||||
( "Chat commands",
|
||||
"Commands to list and delete coversations.",
|
||||
"Commands to list and delete conversations.",
|
||||
[ ("APIListContacts", [], "Get contacts.", ["CRContactsList"], [], Nothing, "/_contacts " <> Param "userId"),
|
||||
("APIListGroups", [], "Get groups.", ["CRGroupsList"], [], Nothing, "/_groups " <> Param "userId" <> Optional "" (" @" <> Param "$0") "contactId_" <> Optional "" (" " <> Param "$0") "search"),
|
||||
("APIDeleteChat", [], "Delete chat.", ["CRContactDeleted", "CRContactConnectionDeleted", "CRGroupDeletedUser"], [], Just UNBackground, "/_delete " <> Param "chatRef" <> " " <> Param "chatDeleteMode")
|
||||
@@ -174,7 +174,8 @@ chatCommandsDocsData =
|
||||
("ListUsers", [], "Get all user profiles", ["CRUsersList"], [], Nothing, "/users"),
|
||||
("APISetActiveUser", [], "Set active user profile", ["CRActiveUser"], ["CEChatNotStarted"], Nothing, "/_user " <> Param "userId" <> Optional "" (" " <> Json "$0") "viewPwd"),
|
||||
("APIDeleteUser", [], "Delete user profile.", ["CRCmdOk"], [], Just UNBackground, "/_delete user " <> Param "userId" <> OnOffParam "del_smp" "delSMPQueues" Nothing <> Optional "" (" " <> Json "$0") "viewPwd"),
|
||||
("APIUpdateProfile", [], "Update user profile.", ["CRUserProfileUpdated"], [], Just UNBackground, "/_profile " <> Param "userId" <> " " <> Json "profile")
|
||||
("APIUpdateProfile", [], "Update user profile.", ["CRUserProfileUpdated"], [], Just UNBackground, "/_profile " <> Param "userId" <> " " <> Json "profile"),
|
||||
("APISetContactPrefs", [], "Configure chat preference overrides for the contact.", ["CRContactPrefsUpdated"], [], Just UNBackground, "/_set prefs @" <> Param "contactId" <> " " <> Json "preferences")
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -251,6 +252,7 @@ cliCommands =
|
||||
"SendMessageQuote",
|
||||
"SetActiveUser",
|
||||
"SetAddressSettings",
|
||||
"SetBotCommands",
|
||||
"SetChatTTL",
|
||||
"SetContactFeature",
|
||||
"SetContactTimedMessages",
|
||||
@@ -359,9 +361,7 @@ undocumentedCommands =
|
||||
"APIGroupMemberQueueInfo",
|
||||
"APIHideUser",
|
||||
"APIImportArchive",
|
||||
"APIListMembers",
|
||||
"APIMuteUser",
|
||||
"APINewGroup",
|
||||
"APIPlanForwardChatItems",
|
||||
"APIPrepareContact",
|
||||
"APIPrepareGroup",
|
||||
@@ -384,7 +384,6 @@ undocumentedCommands =
|
||||
"APISetConnectionAlias",
|
||||
"APISetConnectionIncognito",
|
||||
"APISetContactAlias",
|
||||
"APISetContactPrefs",
|
||||
"APISetEncryptLocalFiles",
|
||||
"APISetGroupAlias",
|
||||
"APISetMemberSettings",
|
||||
@@ -408,7 +407,6 @@ undocumentedCommands =
|
||||
"APIUnhideUser",
|
||||
"APIUnmuteUser",
|
||||
"APIUpdateChatTag",
|
||||
"APIUpdateGroupProfile",
|
||||
"APIUploadStandaloneFile",
|
||||
"APIUserRead",
|
||||
"APIValidateServers",
|
||||
|
||||
@@ -57,12 +57,16 @@ chatResponsesDocsData =
|
||||
("CRContactAlreadyExists", ""),
|
||||
("CRContactConnectionDeleted", "Connection deleted"),
|
||||
("CRContactDeleted", ""),
|
||||
("CRContactPrefsUpdated", "Contact preferences updated"),
|
||||
("CRContactRequestRejected", ""),
|
||||
("CRContactsList", "Contacts"),
|
||||
("CRGroupDeletedUser", "User deleted group"),
|
||||
("CRGroupLink", ""),
|
||||
("CRGroupLinkCreated", ""),
|
||||
("CRGroupLinkDeleted", ""),
|
||||
("CRGroupCreated", ""),
|
||||
("CRGroupMembers", ""),
|
||||
("CRGroupUpdated", ""),
|
||||
("CRGroupsList", "Groups"),
|
||||
("CRInvitation", "One-time invitation"),
|
||||
("CRLeftMemberUser", "User left group"),
|
||||
@@ -92,13 +96,9 @@ chatResponsesDocsData =
|
||||
-- ("CRChatItems", "The most recent messages"),
|
||||
-- ("CRConnectionAliasUpdated", ""),
|
||||
-- ("CRContactAliasUpdated", ""),
|
||||
-- ("CRContactPrefsUpdated", "Contact preferences updated"),
|
||||
-- ("CRContactRatchetSyncStarted", "Contact encryption synchronization started"),
|
||||
-- ("CRGroupAliasUpdated", ""),
|
||||
-- ("CRGroupCreated", ""),
|
||||
-- ("CRGroupMemberRatchetSyncStarted", "Member encryption synchronization started"),
|
||||
-- ("CRGroupMembers", ""),
|
||||
-- ("CRGroupUpdated", ""),
|
||||
-- ("CRItemsReadForChat", "Messages marked as read"),
|
||||
-- ("CRReactionMembers", "Members who set reaction on the message"),
|
||||
]
|
||||
@@ -138,7 +138,6 @@ undocumentedResponses =
|
||||
"CRContactAliasUpdated",
|
||||
"CRContactCode",
|
||||
"CRContactInfo",
|
||||
"CRContactPrefsUpdated",
|
||||
"CRContactRatchetSyncStarted",
|
||||
"CRContactSwitchAborted",
|
||||
"CRContactSwitchStarted",
|
||||
@@ -151,17 +150,14 @@ undocumentedResponses =
|
||||
"CRForwardPlan",
|
||||
"CRGroupAliasUpdated",
|
||||
"CRGroupChatItemsDeleted",
|
||||
"CRGroupCreated",
|
||||
"CRGroupDescription",
|
||||
"CRGroupInfo",
|
||||
"CRGroupMemberCode",
|
||||
"CRGroupMemberInfo",
|
||||
"CRGroupMemberRatchetSyncStarted",
|
||||
"CRGroupMembers",
|
||||
"CRGroupMemberSwitchAborted",
|
||||
"CRGroupMemberSwitchStarted",
|
||||
"CRGroupProfile",
|
||||
"CRGroupUpdated",
|
||||
"CRGroupUserChanged",
|
||||
"CRItemsReadForChat",
|
||||
"CRJoinedGroupMember",
|
||||
|
||||
@@ -207,11 +207,13 @@ chatTypesDocsData =
|
||||
(sti @BrokerErrorType, STUnion, "", [], "", ""),
|
||||
(sti @BusinessChatInfo, STRecord, "", [], "", ""),
|
||||
(sti @BusinessChatType, STEnum, "BC", [], "", ""),
|
||||
(sti @ChatBotCommand, STUnion, "CBC", [], "", ""),
|
||||
(sti @ChatDeleteMode, STUnion, "CDM", [], Param "type" <> Choice "self" [("messages", "")] (OnOffParam "notify" "notify" (Just True)), ""),
|
||||
(sti @ChatError, STUnion, "Chat", ["ChatErrorDatabase", "ChatErrorRemoteHost", "ChatErrorRemoteCtrl"], "", ""),
|
||||
(sti @ChatErrorType, STUnion, "CE", ["CEContactNotFound", "CEServerProtocol", "CECallState", "CEInvalidChatMessage"], "", ""),
|
||||
(sti @ChatFeature, STEnum, "CF", [], "", ""),
|
||||
(sti @ChatItemDeletion, STRecord, "", [], "", "Message deletion result."),
|
||||
(sti @ChatPeerType, STEnum, "CPT", [], "", ""),
|
||||
(sti @ChatRef, STRecord, "", [], Param "chatType" <> Param "chatId" <> Optional "" (Param "$0") "chatScope", "Used in API commands. Chat scope can only be passed with groups."),
|
||||
(sti @ChatSettings, STRecord, "", [], "", ""),
|
||||
(sti @ChatStats, STRecord, "", [], "", ""),
|
||||
@@ -259,6 +261,7 @@ chatTypesDocsData =
|
||||
(sti @FormattedText, STRecord, "", [], "", ""),
|
||||
(sti @FullGroupPreferences, STRecord, "", [], "", ""),
|
||||
(sti @FullPreferences, STRecord, "", [], "", ""),
|
||||
(sti @Group, STRecord, "", [], "", ""),
|
||||
(sti @GroupChatScope, STUnion1, "GCS", [], "(_support" <> Optional "" (":" <> Param "$0") "groupMemberId_" <> ")", ""),
|
||||
(sti @GroupChatScopeInfo, STUnion1, "GCSI", [], "", ""),
|
||||
(sti @GroupFeature, STEnum, "GF", [], "", ""),
|
||||
@@ -356,7 +359,6 @@ chatTypesDocsData =
|
||||
-- (sti @ChatName, STRecord, "", [], "", ""),
|
||||
-- (sti @ChatPagination, STRecord, "CP", [], "", ""),
|
||||
-- (sti @ConnectionStats, STRecord, "", [], "", ""),
|
||||
-- (sti @Group, STRecord, "", [], "", ""),
|
||||
-- (sti @GroupSndStatus, STUnion, "GSS", [], "", ""),
|
||||
-- (sti @MemberDeliveryStatus, STRecord, "", [], "", ""),
|
||||
-- (sti @MemberReaction, STRecord, "", [], "", ""),
|
||||
@@ -392,11 +394,13 @@ deriving instance Generic BlockingReason
|
||||
deriving instance Generic BrokerErrorType
|
||||
deriving instance Generic BusinessChatInfo
|
||||
deriving instance Generic BusinessChatType
|
||||
deriving instance Generic ChatBotCommand
|
||||
deriving instance Generic ChatDeleteMode
|
||||
deriving instance Generic ChatError
|
||||
deriving instance Generic ChatErrorType
|
||||
deriving instance Generic ChatFeature
|
||||
deriving instance Generic ChatItemDeletion
|
||||
deriving instance Generic ChatPeerType
|
||||
deriving instance Generic ChatRef
|
||||
deriving instance Generic ChatSettings
|
||||
deriving instance Generic ChatStats
|
||||
@@ -444,6 +448,7 @@ deriving instance Generic Format
|
||||
deriving instance Generic FormattedText
|
||||
deriving instance Generic FullGroupPreferences
|
||||
deriving instance Generic FullPreferences
|
||||
deriving instance Generic Group
|
||||
deriving instance Generic GroupChatScope
|
||||
deriving instance Generic GroupChatScopeInfo
|
||||
deriving instance Generic GroupFeature
|
||||
|
||||
@@ -142,11 +142,8 @@ toTypeInfo tr =
|
||||
args = typeRepArgs tr
|
||||
name = tyConName tc
|
||||
in case name of
|
||||
"List" -> case args of
|
||||
[elemTr]
|
||||
| elemTr == typeRep (Proxy @Char) -> TIType (ST TString [])
|
||||
| otherwise -> TIArray {elemType = toTypeInfo elemTr, nonEmpty = False}
|
||||
_ -> TIType (simpleType tr)
|
||||
"List" -> listType args
|
||||
"ListDef" -> listType args
|
||||
"NonEmpty" -> case args of
|
||||
[elemTr] -> TIArray {elemType = toTypeInfo elemTr, nonEmpty = True}
|
||||
_ -> TIType (simpleType tr)
|
||||
@@ -158,6 +155,11 @@ toTypeInfo tr =
|
||||
_ -> TIType (simpleType tr)
|
||||
_ -> TIType (simpleType tr)
|
||||
where
|
||||
listType = \case
|
||||
[elemTr]
|
||||
| elemTr == typeRep (Proxy @Char) -> TIType (ST TString [])
|
||||
| otherwise -> TIArray {elemType = toTypeInfo elemTr, nonEmpty = False}
|
||||
_ -> TIType (simpleType tr)
|
||||
simpleType tr' = primitiveToLower $ case tyConName (typeRepTyCon tr') of
|
||||
"AgentUserId" -> ST TInt64 []
|
||||
"Integer" -> ST TInt64 []
|
||||
@@ -208,8 +210,10 @@ toTypeInfo tr =
|
||||
]
|
||||
simplePrefTypes =
|
||||
[ "CallsPreference",
|
||||
"FilesPreference",
|
||||
"FullDeletePreference",
|
||||
"ReactionsPreference",
|
||||
"SessionsPreference",
|
||||
"VoicePreference"
|
||||
]
|
||||
groupPrefTypes =
|
||||
@@ -222,5 +226,6 @@ toTypeInfo tr =
|
||||
[ "DirectMessagesGroupPreference",
|
||||
"VoiceGroupPreference",
|
||||
"FilesGroupPreference",
|
||||
"SessionsGroupPreference",
|
||||
"SimplexLinksGroupPreference"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user