pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
14.62k stars 3.48k forks source link

Error when bot need to reply client message,output error is like this #2234

Closed sonofescobar1337 closed 7 months ago

sonofescobar1337 commented 1 year ago

Is there an existing issue for this?

Describe the bug

C:\Users\asus\Music\test-forta\node_modules\whatsapp-web.js\src\structures\Message.js:91 this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web'; ^

TypeError: data.id.id.substring is not a function at Message._patch (C:\Users\asus\Music\test-forta\node_modules\whatsapp-web.js\src\structures\Message.js:91:75) at new Message (C:\Users\asus\Music\test-forta\node_modules\whatsapp-web.js\src\structures\Message.js:18:24) at Client.sendMessage (C:\Users\asus\Music\test-forta\node_modules\whatsapp-web.js\src\Client.js:699:16) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Expected behavior

as a user I expect this bug to be fixed soon

Steps to Reproduce the Bug or Issue

change the string on message.js line 91 to this : this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web';

and i do to change that,but the issues now is like this : the bot cannot reply client message

Relevant Code

'use strict';

const Base = require('./Base'); const MessageMedia = require('./MessageMedia'); const Location = require('./Location'); const Order = require('./Order'); const Payment = require('./Payment'); const { MessageTypes } = require('../util/Constants');

/**