Conversation Draft
Save Draft
- Save a draft message to the specified conversation.
- Saving a draft updates the
sentTime
of the conversation, which will move it to the top of the list.
Method
saveDraftMessage(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
draft: string,
callback: IRCIMIWSaveDraftMessageCallback
): Promise<number>;
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type |
targetId | string | Conversation ID |
channelId | string | Channel ID, only supported for ultra groups. For other conversation types, pass null. |
draft | string | The text content of the draft. |
callback | IRCIMIWSaveDraftMessageCallback | Callback for the interface invocation result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates success. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. Refer to the error codes for detailed errors. |
Code Example
const callback = {
onDraftMessageSaved: (code: number) => {
//...
},
};
let code = await engine.saveDraftMessage(type, targetId, channelId, draft, callback);
Get Draft
Retrieve the draft content.
Method
getDraftMessage(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWGetDraftMessageCallback
): Promise<number>;
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type |
targetId | string | Conversation ID |
channelId | string | Channel ID, only supported for ultra groups. For other conversation types, pass null. |
callback | IRCIMIWGetDraftMessageCallback | Callback for the interface invocation result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates success. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. Refer to the error codes for detailed errors. |
Code Example
const callback = {
onSuccess: (t: string) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getDraftMessage(type, targetId, channelId, callback);
Delete Draft
Clear the draft information for a specific conversation.
Method
clearDraftMessage(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWClearDraftMessageCallback
): Promise<number>;
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type |
targetId | string | Conversation ID |
channelId | string | Channel ID, only supported for ultra groups. For other conversation types, pass null. |
callback | IRCIMIWClearDraftMessageCallback | Callback for the interface invocation result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates success. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. Refer to the error codes for detailed errors. |
Code Example
clearDraftMessage(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWClearDraftMessageCallback
): Promise<number>;