tapnisu / forwarding-discord-telegram

Selfbot that forwards your Discord messages to Telegram
https://github.com/tapnisu/forwarding-discord-telegram
MIT License
26 stars 6 forks source link

Connection close after some time #95

Open navtemmt opened 1 year ago

navtemmt commented 1 year ago

here are the error code:

home/tempt/forwarding-discord-telegram/node_modules/node-fetch/lib/index.js:1491

reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
                   ^
FetchError: request to https://api.telegram.org/bot5869279607:[REDACTED]/sendMessage failed, reason: read ECONNRESET
    at ClientRequest.<anonymous> (/home/tempt/forwarding-discord-telegram/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:496:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNRESET',
  code: 'ECONNRESET'
}
tapnisu commented 1 year ago

Hello! Thanks for submitting an issue!

Do you know the approximate time it worked before it crashed?

navtemmt commented 1 year ago

Hello, hard to say because sometimes it last 12 hours + sometimes it crash within an hour, but once it crash first time it will crash again in short interval for several times. I read somewhere this econreset issue is on the telegram api side, and also it looks like it crash more frequently between 6 pm - 12 pm GMT+8 and from 12 am to 10 am it never crash in my recall so I think the connection was abandoned when the api is overloaded.

For now my solution is using nodemon to auto reset once it crash, maybe you can consider adding checker like check if the connection still active before relaying the messages and auto reset the connection if it is inactive

tapnisu commented 1 year ago

Apparently I fixed the problem.

Try running the bot with the latest changes

navtemmt commented 1 year ago

Hello! Thanks for the update ! I migrated the bot to run it on a server instead of my home computer since last week due to insufficient resources on my home pc and the bot works nicely except when my connection to the server is reset -> client_loop: send disconnect: Connection reset. The reset connection happen everyday, I have two server from the same service provider and it happen together so maybe this is server sided issue but I don't know.

And today i try to run it on my home computer vm i got this following error: image

Not able to run on home pc vm at all but on my server it was working

tapnisu commented 1 year ago

Hello again! I made a few changes in config.json in repo. Looks like it broke your one.

Try checking it for errors (or send it here, and I will fix it)

navtemmt commented 1 year ago

Hello, the issue still persist, this time after about 1 hour and 10 minutes it crashed image

navtemmt commented 1 year ago

Second attempt, 20 mins after the re-run last night, just saw it when i check image

tapnisu commented 1 year ago

Just use PM2 or systemd service

tapnisu commented 2 weeks ago

Just use PM2 or systemd service

Docker Compose deployment is also now supported (thanks to #358)