From 541353099e26b9a1287769bca9e8ebdad6b87f6c Mon Sep 17 00:00:00 2001 From: shum Date: Wed, 6 May 2026 14:07:01 +0000 Subject: [PATCH] bots/docs: filter hidden params before type introspection Hide APICreateMyAddress server_ field so the bot doc generator does not try to introspect SMPServerWithAuth (an unregistered type). --- bots/src/API/Docs/Commands.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bots/src/API/Docs/Commands.hs b/bots/src/API/Docs/Commands.hs index 756cf8c10e..120ee07b1c 100644 --- a/bots/src/API/Docs/Commands.hs +++ b/bots/src/API/Docs/Commands.hs @@ -28,7 +28,7 @@ chatCommandsDocs = map toCategory chatCommandsDocsData CCCategory {categoryName, categoryDescr, commands = map toCmd commandsData} toCmd (consName, hideParams, commandDescr, respNames, errors, network, syntax) = case find ((consName ==) . consName') chatCommandsTypeInfo of Just RecordTypeInfo {fieldInfos} -> - let fields = filter ((`notElem` hideParams) . fieldName') $ map (toAPIField consName) fieldInfos + let fields = map (toAPIField consName) $ filter ((`notElem` hideParams) . fieldName) fieldInfos commandType = ATUnionMember (fstToLower consName) fields findResp name = case find ((name ==) . consName') chatResponsesDocs of Just resp -> resp @@ -77,7 +77,7 @@ chatCommandsDocsData :: [(String, String, [(ConsName, [String], Text, [ConsName] chatCommandsDocsData = [ ( "Address commands", "Bots can use these commands to automatically check and create address when initialized", - [ ("APICreateMyAddress", [], "Create bot address.", ["CRUserContactLinkCreated", "CRChatCmdError"], [], Just UNInteractive, "/_address " <> Param "userId"), + [ ("APICreateMyAddress", ["server_"], "Create bot address.", ["CRUserContactLinkCreated", "CRChatCmdError"], [], Just UNInteractive, "/_address " <> Param "userId"), ("APIDeleteMyAddress", [], "Delete bot address.", ["CRUserContactLinkDeleted", "CRChatCmdError"], [], Just UNBackground, "/_delete_address " <> Param "userId"), ("APIShowMyAddress", [], "Get bot address and settings.", ["CRUserContactLink", "CRChatCmdError"], [], Nothing, "/_show_address " <> Param "userId"), ("APISetProfileAddress", [], "Add address to bot profile.", ["CRUserProfileUpdated", "CRChatCmdError"], [], Just UNInteractive, "/_profile_address " <> Param "userId" <> " " <> OnOff "enable"),