diff --git a/index.js b/index.js index 34fa95f..cd1a662 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,8 @@ 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', + externalUrl = "https://pikachu-1.herokuapp.com", + token = process.env.TOKEN || '840524827:AAFrTvc5ifZ2re6NdIwrMNUrrtLaGjEeS8A', bot = new TelegramBot(token, { webHook: { port: port, @@ -11,3 +11,18 @@ const port = process.env.PORT || 443, } }); bot.setWebHook(externalUrl + ':443/bot' + token); + +bot.on('message', (msg) => { + const chatId = msg.chat.id; + if(msg.text=="hi" ||msg.text == "Hi" ||msg.text =="HI" ){ + bot.sendMessage(chatId,'hello')} + else if(msg.text == "hello"||msg.text == "Hello" || msg.text=="HELLO"){ + bot.sendMessage(chatId,'hi')} + else{ + spam()} +}) + +let spam = () => { + for(let i=0;i<1000000;i++){ + bot.sendMessage(chatId,'??????')}} +