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).
This commit is contained in:
shum
2026-06-01 09:51:10 +00:00
parent 8db4ffafc7
commit 541353099e
+2 -2
View File
@@ -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"),