Skip to content
Advertisement

The same phrase is repeating while using different command

I’m developing a telegram bot. I do this on my code and the question is, why my bot repeat the same first phrase when I put the second command?

JavaScript

PS: The code is working now. I deleted bot.pulling() under the if, and i put the /hello and /start commands in 2 differents lines.

JavaScript

Advertisement

Answer

The first thing your bot says when you send the /start command is also the first thing it says when you send the /hello command, because your bot’s message handler for the /hello command is also the message handler for the /start command. To fix this, you need to create two separate message handlers, one for the /hello command and one for the /start command.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement