E
E
Egorian2017-12-12 22:12:45
Node.js
Egorian, 2017-12-12 22:12:45

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])
});

git push heroku master
heroku ps:scale web=1.
Where is the mistake?
Works on local, but not on server

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
monochromer, 2017-12-22
@monochromer

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 question

Ask a Question

731 491 924 answers to any question