How to create Telegram bot??? part #2

How to create Telegram bot??? part #2

Our last bot just answer to user questions example:

user: Test

bot: You said: Test

Ok so now we should add message logging so add this:

bot.on('text', function (msg) {
console.log(`[text] ${ msg.chat.id } ${ msg.text }`);
});

Sometimes bot can’t start on linux servers so we need to add this at top of our code:
'use strict'

so this is our source:

See also: HOW TO INSTALL NODEJS 8.x.x ON LINUX SERVER

Leave a Reply

Your email address will not be published. Required fields are marked *