mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
search fix for non-ASCII characters
This commit is contained in:
@@ -115,7 +115,11 @@ WAConnectionTest('Misc', (conn) => {
|
||||
it('should return search results', async () => {
|
||||
const jids = [null, testJid]
|
||||
for (let i in jids) {
|
||||
const response = await conn.searchMessages('Hello', jids[i], 25, 1)
|
||||
let response = await conn.searchMessages('Hello', jids[i], 25, 1)
|
||||
assert.ok (response.messages)
|
||||
assert.ok (response.messages.length >= 0)
|
||||
|
||||
response = await conn.searchMessages('剛剛試咗😋一個字', jids[i], 25, 1)
|
||||
assert.ok (response.messages)
|
||||
assert.ok (response.messages.length >= 0)
|
||||
}
|
||||
|
||||
@@ -247,14 +247,15 @@ export class WAConnection extends Base {
|
||||
{
|
||||
epoch: this.msgCount.toString(),
|
||||
type: 'search',
|
||||
search: txt,
|
||||
search: Buffer.from(txt, 'utf-8'),
|
||||
count: count.toString(),
|
||||
page: page.toString(),
|
||||
jid: inJid
|
||||
},
|
||||
null,
|
||||
]
|
||||
const response: WANode = await this.query({json, binaryTags: [WAMetric.group, WAFlag.ignore], expect200: true}) // encrypt and send off
|
||||
|
||||
const response: WANode = await this.query({json, binaryTags: [24, WAFlag.ignore], expect200: true}) // encrypt and send off
|
||||
const messages = response[2] ? response[2].map (row => row[2]) : []
|
||||
return { last: response[1]['last'] === 'true', messages: messages as WAMessage[] }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user