Asked

when building a Telegram Bot, how do you debug it on localhost?


https://twitter.com/shakedko
fuck facebook

Run it only on localhost, kill other instances. Console log stuff.

https://twitter.com/shakedko

Are you using ngrok for webhooks?

fuck facebook

Nope, I'm using polling with Node. github.com/yagop/node-telegra…

https://twitter.com/shakedko

Are you using a service that loops over or just a cronjob/schedule task every X seconds?

fuck facebook

It's a websocket connection to the Telegram server and keeps the process alive, so the bot never quits running.

https://twitter.com/shakedko

Is this something specific to Node? I am using PHP, in this example it just goes recursively with sleep method: github.com/kolar/telegram-pol…

fuck facebook

No idea. Maybe don't use PHP :D

A very important bio.

Create two different bots with Bot Father, the first (A) runs on localhost and the second (B) runs on my server, they scan and handle the same telegram activity. I push a new version of A with the B token on the remote instance when it's necessary.

https://twitter.com/shakedko

(A) runs on localhost
Are you using a webhook or polling?

A very important bio.

polling, i follow the same process with github.com/yagop/node-telegra…