diff --git a/package.json b/package.json index d03a8a2..a84e9a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adiwajshing/baileys", - "version": "3.4.0", + "version": "3.4.1", "description": "WhatsApp Web API", "homepage": "https://github.com/adiwajshing/Baileys", "main": "lib/index.js", diff --git a/src/WAConnection/0.Base.ts b/src/WAConnection/0.Base.ts index e0aa4ed..8348cb4 100644 --- a/src/WAConnection/0.Base.ts +++ b/src/WAConnection/0.Base.ts @@ -195,7 +195,7 @@ export class WAConnection extends EventEmitter { /** Generic function for action, set queries */ async setQuery (nodes: WANode[], binaryTags: WATag = [WAMetric.group, WAFlag.ignore], tag?: string) { const json = ['action', {epoch: this.msgCount.toString(), type: 'set'}, nodes] - const result = await this.query({ json, binaryTags, tag, expect200: true }) as Promise<{status: number}> + const result = await this.query({ json, binaryTags, tag, expect200: true, requiresPhoneConnection: true }) as Promise<{status: number}> return result } /** diff --git a/src/WAConnection/5.User.ts b/src/WAConnection/5.User.ts index f69d18a..3248ac6 100644 --- a/src/WAConnection/5.User.ts +++ b/src/WAConnection/5.User.ts @@ -83,13 +83,13 @@ export class WAConnection extends Base { /** Get your contacts */ async getContacts() { const json = ['query', { epoch: this.msgCount.toString(), type: 'contacts' }, null] - const response = await this.query({ json, binaryTags: [6, WAFlag.ignore], expect200: true }) // this has to be an encrypted query + const response = await this.query({ json, binaryTags: [WAMetric.queryContact, WAFlag.ignore], expect200: true, requiresPhoneConnection: true }) // this has to be an encrypted query return response } /** Get the stories of your contacts */ async getStories() { const json = ['query', { epoch: this.msgCount.toString(), type: 'status' }, null] - const response = await this.query({json, binaryTags: [30, WAFlag.ignore], expect200: true }) as WANode + const response = await this.query({json, binaryTags: [WAMetric.queryStatus, WAFlag.ignore], expect200: true, requiresPhoneConnection: true }) as WANode if (Array.isArray(response[2])) { return response[2].map (row => ( { @@ -107,7 +107,13 @@ export class WAConnection extends Base { return this.query({ json, binaryTags: [5, WAFlag.ignore], expect200: true }) // this has to be an encrypted query } /** Query broadcast list info */ - async getBroadcastListInfo(jid: string) { return this.query({json: ['query', 'contact', jid], expect200: true }) as Promise } + async getBroadcastListInfo(jid: string) { + return this.query({ + json: ['query', 'contact', jid], + expect200: true, + requiresPhoneConnection: true + }) as Promise + } /** * Load chats in a paginated manner + gets the profile picture * @param before chats before the given cursor diff --git a/src/WAConnection/7.MessagesExtra.ts b/src/WAConnection/7.MessagesExtra.ts index 2939260..01825c4 100644 --- a/src/WAConnection/7.MessagesExtra.ts +++ b/src/WAConnection/7.MessagesExtra.ts @@ -19,7 +19,12 @@ export class WAConnection extends Base { @Mutex ((jid, messageID) => jid+messageID) async messageInfo (jid: string, messageID: string) { const query = ['query', {type: 'message_info', index: messageID, jid: jid, epoch: this.msgCount.toString()}, null] - const [,,response] = await this.query ({json: query, binaryTags: [WAMetric.queryRead, WAFlag.ignore], expect200: true}) + const [,,response] = await this.query ({ + json: query, + binaryTags: [WAMetric.queryRead, WAFlag.ignore], + expect200: true, + requiresPhoneConnection: true + }) const info: MessageInfo = {reads: [], deliveries: []} if (response) { @@ -87,7 +92,7 @@ export class WAConnection extends Base { }, null, ] - const response = await this.query({json, binaryTags: [WAMetric.queryMessages, WAFlag.ignore], expect200: false}) + const response = await this.query({json, binaryTags: [WAMetric.queryMessages, WAFlag.ignore], expect200: false, requiresPhoneConnection: true}) return (response[2] as WANode[])?.map(item => item[2] as WAMessage) || [] } /**