Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error while starting the bot #15

Closed
rsoorajs opened this issue Sep 3, 2021 · 8 comments
Closed

Getting error while starting the bot #15

rsoorajs opened this issue Sep 3, 2021 · 8 comments

Comments

@rsoorajs
Copy link

rsoorajs commented Sep 3, 2021

I scanned qr code and deployed in docker.But getting the below error while starting the bot


See https://github.com/yagop/node-telegram-bot-api/issues/319. at node:internal/modules/cjs/loader:1101:14
undefined:1
undefined
^

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at loadSettings (file:///src/utils.js:11:27)
    at file:///src/index.js:12:18
    at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
    at async Loader.import (node:internal/modules/esm/loader:178:24)
    at async Object.loadESM (node:internal/process/esm_loader:68:5)
    at async handleMainPromise (node:internal/modules/run_main:63:12)
@rsoorajs
Copy link
Author

rsoorajs commented Sep 3, 2021

@UKnowWhoIm
Copy link
Owner

at JSON.parse (<anonymous>)
at loadSettings (file:///src/utils.js:11:27)

The error indicates that the PIPES environment variable is an invalid JSON string. It should be of the format

"PIPES": {
        "Whatsapp Chat":  "telegram channel id"
    }

SyntaxError: Unexpected token u in JSON at position 0

Specifically there is a "u" at the first position of this string

Verify that your PIPES variable is a proper JSON string

@rsoorajs
Copy link
Author

rsoorajs commented Sep 3, 2021

> whatsapp-telegram-bridge@0.2.0 deploy
> node server.js

Fri, 03 Sep 2021 18:46:50 GMT node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. at node:internal/modules/cjs/loader:1101:14
undefined:1
undefined
^

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at loadSettings (file:///src/utils.js:11:27)
    at file:///src/index.js:12:18
    at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
    at async Loader.import (node:internal/modules/esm/loader:178:24)
    at async Object.loadESM (node:internal/process/esm_loader:68:5)
    at async handleMainPromise (node:internal/modules/run_main:63:12)

@rsoorajs
Copy link
Author

rsoorajs commented Sep 3, 2021

my example conf, can you please check if that correct ?

{
    "TOKEN": "BOT_TOKEN",
    "PIPES": {
        "Tg File Recieve":  "-597651420"
    }
}

@UKnowWhoIm
Copy link
Owner

UKnowWhoIm commented Sep 3, 2021

First of all the token is sensitive, don't post it publicly. I've removed it.

Are you using settings.json or environment variables. It seems to me you're using settings.json file

If you're using settings.json, it's not being detected, that's why the program tries to read variables from the environment. Your file's name has to be settings.json and it has to be included in your docker image for this to work.

The JSON looks good to me, verify that you're naming your conf file settings.json, its in the same directory as index.js, and it's included in the docker image.

@rsoorajs rsoorajs closed this as completed Sep 4, 2021
@rsoorajs rsoorajs reopened this Sep 4, 2021
@rsoorajs
Copy link
Author

rsoorajs commented Sep 4, 2021

First of all the token is sensitive, don't post it publicly. I've removed it.

Are you using settings.json or environment variables. It seems to me you're using settings.json file

If you're using settings.json, it's not being detected, that's why the program tries to read variables from the environment. Your file's name has to be settings.json and it has to be included in your docker image for this to work.

The JSON looks good to me, verify that you're naming your conf file settings.json, its in the same directory as index.js, and it's included in the docker image.

As per my tests,Im concluding these about whatsapp beta-multi device feature

  1. Qr code token never stores,2 or 3 qr codes appearing on npm start.After scanning second or 3rd qr code phone is successfully get connecting.

  2. Session didnt storing.So when we ran using docker it asks again qr codes to scan,same like in the first step

  3. When we did everything we will get connetion succed message in the telegram channel

  4. All messages sending from Whatsapp are recieving in to telegram. But not recieving any single message or media from telegram to Whatsapp.

These are the issue which i can identify.Please fix it

@rsoorajs
Copy link
Author

rsoorajs commented Sep 4, 2021

I already mentioned this issue on venom

orkestral/venom#1116

@UKnowWhoIm
Copy link
Owner

UKnowWhoIm commented Sep 4, 2021

Qr code token never stores,2 or 3 qr codes appearing on npm start.After scanning second or 3rd qr code phone is successfully get connecting.

I think that's a whatsapp multi device beta issue, as I tested this now and it's working on the stable version.

Session didn't storing.So when we ran using docker it asks again qr codes to scan,same like in the first step

Is a file session data.json being created inside tokens folder. It stores your session info. If it's being created and still you're being asked to login, again it's a whatsapp muti device beta issue.

All messages sending from Whatsapp are recieving in to telegram. But not recieving any single message or media from telegram to Whatsapp.

This is not implemented, as the account used for whatsapp can be banned, which is problematic because I can't even test without risk getting banned.

When this was created, it was to aid the switch to telegram from whatsapp, this was never meant to be a long term solution.

I have an extra sim, When I get time I'll work on the telegram to whatsapp side too.

Regarding the multi device beta issue, as soon as I get access to that feature I will work on the fixes.

@rsoorajs rsoorajs closed this as completed Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants