diff --git a/index.js b/index.js index 34fa95f..3f1c5f6 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,21 @@ -const TelegramBot = require('node-telegram-bot-api'); - -const port = process.env.PORT || 443, - host = '0.0.0.0', // probably this change is not required - externalUrl = process.env.HOSTURL, - token = process.env.TOKEN || 'YOUR TELEGRAM TOKEN', - bot = new TelegramBot(token, { - webHook: { - port: port, - host: host - } - }); -bot.setWebHook(externalUrl + ':443/bot' + token); +const TelegramBot = require('node-telegram-bot-api'); +const token = 'yout telegram token'; +const bot = new TelegramBot(token, {polling: true}); + +bot.on('message', (msg) => { + const chatId = msg.chat.id + if(msg.text=="Hai" || msg.text=="Hello"){ + bot.sendMessage(chatId, "hello"); + } + else if(msg.text=="How are you?" || msg.text=="How r u?"){ + bot.sendMessage(chatId,"Ha HA fine..."); + } + else if (msg.text=="Entha parupadi"){ + + bot.sendMessage(chatId,"veruthe rest eduka"); + } + + else{ + bot.sendMessage(chatId,"manasilayilla"); + } +});