mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 11:54:07 +00:00
core: add custom data commands, fix groups parser (#6691)
* core: add custom data commands, fix groups parser
- Add APISetGroupCustomData and APISetContactCustomData to ChatCommand,
with parsers (/_set custom #, /_set custom @) and processors
following the APISetChatUIThemes pattern
- Fix APIListGroups parser missing space ("/_groups" -> "/_groups ")
to align with auto-generated cmdString
- Add chatCommandsDocsData entries for APISetGroupCustomData,
APISetContactCustomData, and APISetUserAutoAcceptMemberContacts
* core: named fields for codegen, run codegen
- Use named record fields for APISetGroupCustomData,
APISetContactCustomData, APISetUserAutoAcceptMemberContacts
(required for chatCommandsDocsData field resolution)
- Fix OnOff field name to "onOff" (avoids clash with User field)
- Remove APISetUserAutoAcceptMemberContacts from undocumentedCommands
- Regenerate COMMANDS.md and commands.ts
* nodejs: add ChatApi wrappers for custom data and apiGetChat
- apiSetGroupCustomData, apiSetContactCustomData
- apiSetAutoAcceptMemberContacts
- apiGetChat (manual wrapper, APIGetChat undocumented)
This commit is contained in:
@@ -50,6 +50,9 @@ This file is generated automatically.
|
||||
- [APIListContacts](#apilistcontacts)
|
||||
- [APIListGroups](#apilistgroups)
|
||||
- [APIDeleteChat](#apideletechat)
|
||||
- [APISetGroupCustomData](#apisetgroupcustomdata)
|
||||
- [APISetContactCustomData](#apisetcontactcustomdata)
|
||||
- [APISetUserAutoAcceptMemberContacts](#apisetuserautoacceptmembercontacts)
|
||||
|
||||
[User profile commands](#user-profile-commands)
|
||||
- [ShowActiveUser](#showactiveuser)
|
||||
@@ -1526,6 +1529,117 @@ ChatCmdError: Command error (only used in WebSockets API).
|
||||
---
|
||||
|
||||
|
||||
### APISetGroupCustomData
|
||||
|
||||
Set group custom data.
|
||||
|
||||
*Network usage*: no.
|
||||
|
||||
**Parameters**:
|
||||
- groupId: int64
|
||||
- customData: JSONObject?
|
||||
|
||||
**Syntax**:
|
||||
|
||||
```
|
||||
/_set custom #<groupId>[ <json(customData)>]
|
||||
```
|
||||
|
||||
```javascript
|
||||
'/_set custom #' + groupId + (customData ? ' ' + JSON.stringify(customData) : '') // JavaScript
|
||||
```
|
||||
|
||||
```python
|
||||
'/_set custom #' + str(groupId) + ((' ' + json.dumps(customData)) if customData is not None else '') # Python
|
||||
```
|
||||
|
||||
**Responses**:
|
||||
|
||||
CmdOk: Ok.
|
||||
- type: "cmdOk"
|
||||
- user_: [User](./TYPES.md#user)?
|
||||
|
||||
ChatCmdError: Command error (only used in WebSockets API).
|
||||
- type: "chatCmdError"
|
||||
- chatError: [ChatError](./TYPES.md#chaterror)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### APISetContactCustomData
|
||||
|
||||
Set contact custom data.
|
||||
|
||||
*Network usage*: no.
|
||||
|
||||
**Parameters**:
|
||||
- contactId: int64
|
||||
- customData: JSONObject?
|
||||
|
||||
**Syntax**:
|
||||
|
||||
```
|
||||
/_set custom @<contactId>[ <json(customData)>]
|
||||
```
|
||||
|
||||
```javascript
|
||||
'/_set custom @' + contactId + (customData ? ' ' + JSON.stringify(customData) : '') // JavaScript
|
||||
```
|
||||
|
||||
```python
|
||||
'/_set custom @' + str(contactId) + ((' ' + json.dumps(customData)) if customData is not None else '') # Python
|
||||
```
|
||||
|
||||
**Responses**:
|
||||
|
||||
CmdOk: Ok.
|
||||
- type: "cmdOk"
|
||||
- user_: [User](./TYPES.md#user)?
|
||||
|
||||
ChatCmdError: Command error (only used in WebSockets API).
|
||||
- type: "chatCmdError"
|
||||
- chatError: [ChatError](./TYPES.md#chaterror)
|
||||
|
||||
---
|
||||
|
||||
|
||||
### APISetUserAutoAcceptMemberContacts
|
||||
|
||||
Set auto-accept member contacts.
|
||||
|
||||
*Network usage*: no.
|
||||
|
||||
**Parameters**:
|
||||
- userId: int64
|
||||
- onOff: bool
|
||||
|
||||
**Syntax**:
|
||||
|
||||
```
|
||||
/_set accept member contacts <userId> on|off
|
||||
```
|
||||
|
||||
```javascript
|
||||
'/_set accept member contacts ' + userId + ' ' + (onOff ? 'on' : 'off') // JavaScript
|
||||
```
|
||||
|
||||
```python
|
||||
'/_set accept member contacts ' + str(userId) + ' ' + ('on' if onOff else 'off') # Python
|
||||
```
|
||||
|
||||
**Responses**:
|
||||
|
||||
CmdOk: Ok.
|
||||
- type: "cmdOk"
|
||||
- user_: [User](./TYPES.md#user)?
|
||||
|
||||
ChatCmdError: Command error (only used in WebSockets API).
|
||||
- type: "chatCmdError"
|
||||
- chatError: [ChatError](./TYPES.md#chaterror)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## User profile commands
|
||||
|
||||
Most bots don't need to use these commands, as bot profile can be configured manually via CLI or desktop client. These commands can be used by bots that need to manage multiple user profiles (e.g., the profiles of support agents).
|
||||
|
||||
Reference in New Issue
Block a user