yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.45k stars 1.53k forks source link

polling error when running a demo code #594

Closed ritsuyan closed 1 year ago

ritsuyan commented 6 years ago

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 .

sidelux commented 6 years ago

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.

amberleitl commented 6 years ago

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

serembon commented 6 years ago

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

amberleitl commented 6 years ago

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 notifications@github.com 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 .

aorfevre commented 6 years ago

There is also that function:

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

})
amberleitl commented 6 years ago

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 notifications@github.com 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 .

aorfevre commented 6 years ago

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

amberleitl commented 6 years ago

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

On Wed, Jun 6, 2018, 11:41 AM Alex notifications@github.com 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 .

icepolarizer commented 6 years ago

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 commented 6 years ago

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.

sergeyrudenko commented 6 years ago

check syntax in your app

droidmanspace commented 6 years ago

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 commented 6 years ago

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

deshmukhsanket commented 4 years ago

Is there any way we can run it without polling?