askrella / whatsapp-chatgpt

ChatGPT + DALL-E + WhatsApp = AI Assistant :rocket: :robot:
3.49k stars 842 forks source link

Error: TypeError: data.id.id.substring is not a function #236

Closed maidmus closed 1 year ago

maidmus commented 1 year ago

Hallo,

this was working fine for monts, but now im getting this error. Im using the newest version on Node.js v18.16.0

gpt

Mr-Nobody1 commented 1 year ago

update the "whatsapp-web.js": "^1.20.0"

maidmus commented 1 year ago

Worked. Thx

rikuddo91 commented 1 year ago

I replaced the files from the whatapp-web git repo, it doesn't crash the console now, and I do get the answer, but it doesn't post the answer in whatsapp. How can I resolve that problem?

Nevermind, I cloned the repo again and after 'npm install' .. I ran 'npm update whatsapp-web.js' and it updated that module.

Now it's working fine.

e-pano commented 1 year ago

I am getting the same error. where can I find the current version of the "whatsapp-web.js" file.

e-pano commented 1 year ago

Worked. Thx

Can you explain in a little more detail how you updated and how you fixed it?

(update the "whatsapp-web.js": "^1.20.0") ?

Mr-Nobody1 commented 1 year ago

go to Package.json and update the version of whatsapp-web.js

e-pano commented 1 year ago

go to Package.json and update the version of whatsapp-web.js

    "whatsapp-web.js": "^1.20.0",

Mr-Nobody1, thanks.

Another question..

HUGGINGFACE_API_TOKEN= What does this api key other than openai do and where is it gotten from?

helviodarochalima commented 1 year ago

I corrected the Message.ts file in the execution context in Node (npm run start) and it is working correctly. when I run it in docker it is giving the error, even changing the whatsapp version to ^12.0.0 ... I understand that it needs to be changed the Message.ts file in the Docker execution context .. how to do it?

thank you in advance

Helvio

Mr-Nobody1 commented 1 year ago

go to Package.json and update the version of whatsapp-web.js

  "whatsapp-web.js": "^1.20.0",

Mr-Nobody1, thanks.

Another question..

HUGGINGFACE_API_TOKEN= What does this api key other than openai do and where is it gotten from?

I think this belongs to some models other than chatgpt like vicuna, wizardLM etc

helviodarochalima commented 1 year ago

Even after altering the package.json and updating whatsapp-web.js, I'm still receiving the error

r de todos os envolvidos. | OpenAI request took 96378ms) whatsapp_bot | /app/node_modules/whatsapp-web.js/src/structures/Message.js:91 whatsapp_bot | this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web'; whatsapp_bot | ^ whatsapp_bot | whatsapp_bot | TypeError: data.id.id.substring is not a function whatsapp_bot | at Message._patch (/app/node_modules/whatsapp-web.js/src/structures/Message.js:91:75) whatsapp_bot | at new Message (/app/node_modules/whatsapp-web.js/src/structures/Message.js:18:24) whatsapp_bot | at Client.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:699:16) whatsapp_bot | at processTicksAndRejections (node:internal/process/task_queues:95:5) whatsapp_bot | whatsapp_bot | Node.js v20.2.0 whatsapp_bot exited with code 1

e-pano commented 1 year ago

update the "whatsapp-web.js": "^1.20.0"

Hello Mr-Nobody1,

Another issue occurred. Can you help me?

https://github.com/askrella/whatsapp-chatgpt/issues/247

navopw commented 1 year ago

I fixed lots of issues. It currently works on my side.

I will close this PR for now. If you still have issues, please open another PR.

Thanks!