node-telegram-bot-api icon indicating copy to clipboard operation
node-telegram-bot-api copied to clipboard

polling error when running a demo code

Open ritsuyan opened this issue 7 years ago • 14 comments

I just simply run a demo code on a US VPS.

const bot = new TelegramBot(token, {polling: true});

bot.on('message', function(msg) {
	if (msg.new_chat_members != undefined) {
		bot.sendMessage(msg.chat.id, msg.new_chat_member.username + " Bienvenido");
	}
});

when I send the message to bot it consoles log polling error not give a reason .

ritsuyan avatar May 28 '18 17:05 ritsuyan

First try with only a console.log.

const bot = new TelegramBot(token, {polling: true});

bot.on('message', function(msg) {
	console.log(msg);
});

If it works try to check syntax.

sidelux avatar May 30 '18 08:05 sidelux

I'm trying to set up a simple bot for an Instagram engagement group on telegram that moniters comments and engagement is there anyone here that can help me with this even installing one that is already made I've tried to /config a bot and it doesn't send me the list of commands my telegram is Amber Leitl my insta is @amberleitl I would much appreciate some help

amberleitl avatar Jun 05 '18 02:06 amberleitl

Try to add this on 1st line: process.env["NTBA_FIX_319"] = 1;

serembon avatar Jun 05 '18 13:06 serembon

So when I add the bot to the group I make it an admin and then type that into the chat?

On Tue, Jun 5, 2018, 9:43 AM Maxim [email protected] wrote:

Try to add this on 1st line: process.env["NTBA_FIX_319"] = 1;

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yagop/node-telegram-bot-api/issues/594#issuecomment-394713806, or mute the thread https://github.com/notifications/unsubscribe-auth/AmFPboQHf2DFwYl1hwHgBEvbS7arCbyIks5t5osFgaJpZM4UQbr7 .

amberleitl avatar Jun 05 '18 15:06 amberleitl

There is also that function:

bot.on('new_chat_members', (msg) => {
  console.log("My msg object",msg)
  bot.sendMessage(msg.chat.id, "hi" )

})

aorfevre avatar Jun 06 '18 15:06 aorfevre

I'm so confused because I don't know code you are on telegram right? If I add you to my group can you install group Butler beta into my group?

On Wed, Jun 6, 2018, 11:22 AM Alex [email protected] wrote:

There is also that function:

bot.on('new_chat_members', (msg) => { console.log("My msg object",msg) bot.sendMessage(msg.chat.id, "hi" )

})

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yagop/node-telegram-bot-api/issues/594#issuecomment-395108611, or mute the thread https://github.com/notifications/unsubscribe-auth/AmFPbqsMxxVeBBTkm7qCsrcEMLsgNKtOks5t5_O_gaJpZM4UQbr7 .

amberleitl avatar Jun 06 '18 15:06 amberleitl

@amberleitl ; group buttler is rather easy to install . Try to find some tutorials on internet ;) you will succeed !

aorfevre avatar Jun 06 '18 15:06 aorfevre

I did and I follow the tutorials but it doesn't work for me 😢

On Wed, Jun 6, 2018, 11:41 AM Alex [email protected] wrote:

@amberleitl https://github.com/amberleitl ; group buttler is rather easy to install . Try to find some tutorials on internet ;) you will succeed !

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yagop/node-telegram-bot-api/issues/594#issuecomment-395115410, or mute the thread https://github.com/notifications/unsubscribe-auth/AmFPbq-5GKqQbeHI0i8P1-0kDVYF13E8ks5t5_g5gaJpZM4UQbr7 .

amberleitl avatar Jun 06 '18 17:06 amberleitl

Am I the only one confused in this topic? Are we talking about working on backend nodejs telegram bot, or just adding bot to the group without coding?

icepolarizer avatar Jul 07 '18 10:07 icepolarizer

I'm looking for the solution cause my node script is just giving me a polling error every time, and looks like many people are having same problem. But seems like nobody has a solution.

icepolarizer avatar Jul 07 '18 10:07 icepolarizer

check syntax in your app

sergeyrudenko avatar Aug 29 '18 12:08 sergeyrudenko

If you are making two instance of TelegramBot with same token, it will definitely ends in polling error. So check your process and kill all node processes. After that try to run the bot. It will work.

droidmanspace avatar Sep 16 '18 23:09 droidmanspace

@kenixer and @amberleitl, if you still facing the issue. I CAN HELP YOU. Telegram :, https://t.me/droid_man

droidmanspace avatar Sep 16 '18 23:09 droidmanspace

Is there any way we can run it without polling?

deshmukhsanket avatar Mar 19 '20 04:03 deshmukhsanket