-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
28 lines (22 loc) · 882 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict';
let express = require('express');
let bodyParser = require('body-parser');
let bot = require("./telegramBot")
let analytics = require('./analytics')
let app = express();
app.use(express.static('public'));
app.use(bodyParser.json());
app.get("/", (req, resp) => {
resp.sendFile(__dirname + '/views/index.html');
})
app.post("/" + process.env.TELEGRAM_BOT_TOKEN, (req, resp) => {
console.log("msg from telegram", req.body)
bot.processUpdate(req.body)
resp.send(200)
})
var listener = app.listen(process.env.PORT, () => {
console.log('Your app is listening on port ' + listener.address().port);
})
analytics.getEmotions("https://static6.businessinsider.de/image/5841903ddd089538448b4725/vor-24-jahren-starb-pablo-escobar--hier-sind-3-theorien-wer-ihn-wirklich-erschossen-hat.jpg").then(emotions => {
console.log("emo", JSON.stringify(emotions))
})