zca-js
  • ✨Bắt đầu
    • Giới thiệu
    • Ví dụ
      • Bot nhại lại người dùng
      • Bot chào mừng thành viên
  • 🔑Đăng Nhập
    • Đăng nhập với Cookie
    • Đăng nhập với QRCode
    • Đăng nhập nhiều tài khoản
    • Sử dụng Proxy
  • 🛠️API
    • acceptFriendRequest
    • addGroupDeputy
    • addReaction
    • addUserToGroup
    • blockUser
    • changeFriendAlias
    • changeGroupAvatar
    • changeGroupName
    • changeGroupOwner
    • createGroup
    • createNote
    • createPoll
    • deleteMessage
    • disperseGroup
    • editNote
    • fetchAccountInfo
    • findUser
    • getAllFriends
    • getAllGroups
    • getContext
    • getCookie
    • getGroupInfo
    • getOwnId
    • getQR
    • getStickers
    • getStickersDetail
    • getUserInfo
    • lockPoll
    • pinConversations
    • removeGroupDeputy
    • removeUserFromGroup
    • sendCard
    • sendFriendRequest
    • sendMessage
    • sendReport
    • sendSticker
    • sendVoice
    • unblockUser
    • undo
  • 📡Listener
    • message
    • reaction
    • undo
    • group_event
Powered by GitBook
On this page
  • api.deleteMessage(message[, onlyMe])
  • Parameters
  • Return
  • Examples
  1. API

deleteMessage

Xóa tin nhắn của bản thân hoặc thành viên nhóm

api.deleteMessage(message[, onlyMe])

Parameters

  • message Message

  • onlyMe boolean?

    • true nếu chỉ xóa phía bản thân, false để xóa cho cả nhóm, mặc định true

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(message, true)
                .then(console.log)
                .catch(console.error);
        }, 5_000);
    }
});
PreviouscreatePollNextdisperseGroup

Last updated 3 months ago

🛠️