Answer the question
In order to leave comments, you need to log in
How to host Node.js telegram bot on heroku?
Help me please.
Here is my action
git push heroku mastergit clone https://github.com/heroku/node-js-getting-started.git
cd node-js-getting-started
npm install
npm install node-telegram-bot-api -
-save
heroku create.
I create index.js,bot.js,web.js
// index.js//
require('./bot');
require('./web');
//end//
//web.js//
var express = require('express');
var packageInfo = require('./package.json');
var app = express();
app.get('/', function (req, res) {
res.json({ version: packageInfo.version });
});
var server = app.listen(process.env.PORT || 5000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Web server started at http://%s:%s', host, port);
});
//end//
//bot.js//
var token = 'XXX';
var Bot = require('node-telegram-bot-api'),
bot = new Bot(token, { polling: true });
bot.onText(/\/echo/, (msg, match) => {
bot.sendMessage(msg.chat.id, 'You said ' + match[1])
});
Answer the question
In order to leave comments, you need to log in
Log the app and see the log at
https://dashboard.heroku.com/apps/YOUR_APP_NAME/logs
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question