Closed jotsamikael closed 1 year ago
I am facing the same issue
@jotsamikael This error is handled in the latest version. Could you check updating to the latest version of this module (1.21.0)?
@jotsamikael if the issue is non present in the latest version, could you close this issue? Thanks
Corrected in lastest version
Nice to hear! thank you!
Is there an existing issue for this?
Describe the bug
I can't send or reply to messages My code logic is supposed to reply to a hello message coming from a conversation with a hi The whatsapp version of the message sender is: 2.23.14.79 The whatsapp version of the bot is 2.23.13.76
(node:14324) UnhandledPromiseRejectionWarning: TypeError: data.id.id.substring is not a function at Message._patch (D:\Logos\node_modules\whatsapp-web.js\src\structures\Message.js:92:75)
at new Message (D:\Logos\node_modules\whatsapp-web.js\src\structures\Message.js:18:24)
at Client.sendMessage (D:\Logos\node_modules\whatsapp-web.js\src\Client.js:699:16) at processTicksAndRejections (internal/process/task_queues.js:93:5) (Use
node --trace-warnings ...
to show where the warning was created) (node:14324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:14324) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:14324) UnhandledPromiseRejectionWarning: TypeError: data.id.id.substring is not a functionat Message._patch (D:\Logos\node_modules\whatsapp-web.js\src\structures\Message.js:92:75)
at new Message (D:\Logos\node_modules\whatsapp-web.js\src\structures\Message.js:18:24) at Client.sendMessage (D:\Logos\node_modules\whatsapp-web.js\src\Client.js:699:16) at processTicksAndRejections (internal/process/task_queues.js:93:5) (node:14324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)Expected behavior
Message sender receives a "Hi" response
Steps to Reproduce the Bug or Issue
add this logic let replyToHello = function () { client.on('message', async (message) => { const userPrompt = message.body let number = message.from; switch (userPrompt) { case 'Hello': console.log("switch works") message.reply('hi'); message.reply("A. Translate from ENGLISH -> FRENCH \n B. Translate from FRENCH -> ENGLISH \n C. ENGLISH word definition \n D. Hand written notes");
Relevant Code
No response
Browser Type
Chromium
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
os: windows 10 phone os: android whatsapp-web.js version: 1.18.2 Node.js Version: 14.15
Additional context
No response