mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Completely remove message-status-update & user-status-update
This commit is contained in:
@@ -625,11 +625,6 @@ export class WAConnection extends Base {
|
||||
on (event: 'chats-update', listener: (chats: WAChatUpdate[]) => void): this
|
||||
/** when a chat is updated (new message, updated message, read message, deleted, pinned, presence updated etc) */
|
||||
on (event: 'chat-update', listener: (chat: WAChatUpdate) => void): this
|
||||
/**
|
||||
* when a message's status is updated (deleted, delivered, read, sent etc.)
|
||||
* @deprecated will not be called anymore. Use `chat-update`
|
||||
* */
|
||||
on (event: 'message-status-update', listener: (message: WAMessageStatusUpdate) => void): this
|
||||
/** when participants are added to a group */
|
||||
on (event: 'group-participants-update', listener: (update: {jid: string, participants: string[], actor?: string, action: WAParticipantAction}) => void): this
|
||||
/** when the group is updated */
|
||||
|
||||
@@ -78,9 +78,6 @@ export class WAConnection extends Base {
|
||||
]
|
||||
)
|
||||
this.emit ('contact-update', { jid: this.user.jid, status })
|
||||
|
||||
// emit deprecated
|
||||
this.emit ('user-status-update', { jid: this.user.jid, status })
|
||||
return response
|
||||
}
|
||||
async updateProfileName (name: string) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
WATextMessage,
|
||||
WAMessageContent, WAMetric, WAFlag, WAMessage, BaileysError, WA_MESSAGE_STATUS_TYPE, WAMessageProto, MediaConnInfo, MessageTypeProto, URL_REGEX, WAUrlInfo, WA_DEFAULT_EPHEMERAL
|
||||
} from './Constants'
|
||||
import { generateMessageID, sha256, hmacSign, aesEncrypWithIV, randomBytes, generateThumbnail, getMediaKeys, decodeMediaMessageBuffer, extensionForMediaMessage, whatsappID, unixTimestampSeconds, getAudioDuration } from './Utils'
|
||||
import { generateMessageID, sha256, hmacSign, aesEncrypWithIV, randomBytes, generateThumbnail, getMediaKeys, decodeMediaMessageBuffer, extensionForMediaMessage, whatsappID, unixTimestampSeconds, getAudioDuration, newMessagesDB } from './Utils'
|
||||
import { Mutex } from './Mutex'
|
||||
|
||||
export class WAConnection extends Base {
|
||||
@@ -288,9 +288,13 @@ export class WAConnection extends Base {
|
||||
if (waitForAck) {
|
||||
await promise
|
||||
} else {
|
||||
const emitUpdate = (status: WA_MESSAGE_STATUS_TYPE) => {
|
||||
message.status = status
|
||||
this.emit('chat-update', { jid: message.key.remoteJid, messages: newMessagesDB([ message ]) })
|
||||
}
|
||||
promise
|
||||
.then(() => this.emit('message-status-update', { ids: [ mID ], to: message.key.remoteJid, type: WA_MESSAGE_STATUS_TYPE.SERVER_ACK }))
|
||||
.catch(() => this.emit('message-status-update', { ids: [ mID ], to: message.key.remoteJid, type: WA_MESSAGE_STATUS_TYPE.ERROR }))
|
||||
.then(() => emitUpdate(WA_MESSAGE_STATUS_TYPE.SERVER_ACK))
|
||||
.catch(() => emitUpdate(WA_MESSAGE_STATUS_TYPE.ERROR))
|
||||
}
|
||||
await this.chatAddMessageAppropriate (message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user