deleteMessage
Xóa tin nhắn của bản thân hoặc thành viên nhóm
api.deleteMessage(options, threadId[, type])
Parameters
options
DeleteMessageOptions
threadId
string
type
ThreadType?
DeleteMessageOptions
cliMsgId
string
msgId
string
uidFrom
string
onlyMe
boolean?
mặc định
true
, chỉ xóa ở phía bản thân
Return
Promise<DeleteMessageResponse>
Examples
Xóa tin nhắn bản thân sau 5s
// xóa tin nhắn của bản thân sau 5s nếu nội dung là "test"
api.listener.on("message", (message) => {
const { content } = message.data;
const isTextMessage = typeof content == "string";
const shouldDelete = isTextMessage && content == "test";
if (message.isSelf && shouldDelete) {
setTimeout(() => {
api.deleteMessage(
{
cliMsgId: message.data.cliMsgId,
msgId: message.data.msgId,
uidFrom: message.data.uidFrom,
onlyMe: true
},
message.threadId,
message.type
)
.then(console.log)
.catch(console.error);
}, 5_000);
}
});
Last updated