mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: update proto
The new proto extract has a bunch of breaking changes, so if you were using the raw proto in your code somewhere -- then you may have to update your code to make it work with the new proto !BREAKING_CHANGE
This commit is contained in:
@@ -147,7 +147,7 @@ export const makeGroupsSocket = (config: SocketConfig) => {
|
||||
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
|
||||
* @param inviteMessage the message to accept
|
||||
*/
|
||||
groupAcceptInviteV4: async(key: string | WAMessageKey, inviteMessage: proto.IGroupInviteMessage) => {
|
||||
groupAcceptInviteV4: async(key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => {
|
||||
key = typeof key === 'string' ? { remoteJid: key } : key
|
||||
const results = await groupQuery(inviteMessage.groupJid!, 'set', [{
|
||||
tag: 'accept',
|
||||
@@ -163,7 +163,7 @@ export const makeGroupsSocket = (config: SocketConfig) => {
|
||||
// update the invite message to be expired
|
||||
if(key.id) {
|
||||
// create new invite message that is expired
|
||||
inviteMessage = proto.GroupInviteMessage.fromObject(inviteMessage)
|
||||
inviteMessage = proto.Message.GroupInviteMessage.fromObject(inviteMessage)
|
||||
inviteMessage.inviteExpiration = 0
|
||||
inviteMessage.inviteCode = ''
|
||||
ev.emit('messages.update', [
|
||||
|
||||
@@ -193,7 +193,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
case 'not_ephemeral':
|
||||
result.message = {
|
||||
protocolMessage: {
|
||||
type: proto.ProtocolMessage.ProtocolMessageType.EPHEMERAL_SETTING,
|
||||
type: proto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING,
|
||||
ephemeralExpiration: +(child.attrs.expiration || 0)
|
||||
}
|
||||
}
|
||||
@@ -340,13 +340,13 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
(
|
||||
// basically, we only want to know when a message from us has been delivered to/read by the other person
|
||||
// or another device of ours has read some messages
|
||||
status > proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK ||
|
||||
status > proto.WebMessageInfo.Status.DELIVERY_ACK ||
|
||||
!isNodeFromMe
|
||||
)
|
||||
) {
|
||||
if(isJidGroup(remoteJid)) {
|
||||
if(attrs.participant) {
|
||||
const updateKey: keyof MessageUserReceipt = status === proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK ? 'receiptTimestamp' : 'readTimestamp'
|
||||
const updateKey: keyof MessageUserReceipt = status === proto.WebMessageInfo.Status.DELIVERY_ACK ? 'receiptTimestamp' : 'readTimestamp'
|
||||
ev.emit(
|
||||
'message-receipt.update',
|
||||
ids.map(id => ({
|
||||
@@ -428,7 +428,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
async() => {
|
||||
await decryptionTask
|
||||
// message failed to decrypt
|
||||
if(msg.messageStubType === proto.WebMessageInfo.WebMessageInfoStubType.CIPHERTEXT) {
|
||||
if(msg.messageStubType === proto.WebMessageInfo.StubType.CIPHERTEXT) {
|
||||
logger.error(
|
||||
{ key: msg.key, params: msg.messageStubParameters },
|
||||
'failure in decrypting message'
|
||||
|
||||
@@ -550,8 +550,8 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
} else {
|
||||
try {
|
||||
const media = decryptMediaRetryData(result.media!, mediaKey, result.key.id!)
|
||||
if(media.result !== proto.MediaRetryNotification.MediaRetryNotificationResultType.SUCCESS) {
|
||||
const resultStr = proto.MediaRetryNotification.MediaRetryNotificationResultType[media.result]
|
||||
if(media.result !== proto.MediaRetryNotification.ResultType.SUCCESS) {
|
||||
const resultStr = proto.MediaRetryNotification.ResultType[media.result]
|
||||
throw new Boom(
|
||||
`Media re-upload failed by device (${resultStr})`,
|
||||
{ data: media, statusCode: getStatusCodeForMediaRetry(media.result) || 404 }
|
||||
|
||||
Reference in New Issue
Block a user