@@ -9,6 +9,7 @@ |
||
9 | 9 |
"author": "James Peret", |
10 | 10 |
"license": "ISC", |
11 | 11 |
"dependencies": { |
12 |
+ "body-parser": "^1.17.1", |
|
12 | 13 |
"express": "^4.15.2", |
13 | 14 |
"node-telegram-bot-api": "^0.27.1", |
14 | 15 |
"parent-require": "^1.0.0", |
@@ -10,11 +10,14 @@ console.log("socket.io server on port " + port); |
||
10 | 10 |
|
11 | 11 |
express = require('express') |
12 | 12 |
app = express() |
13 |
+bodyParser = require("body-parser") |
|
14 |
+app.use(bodyParser.urlencoded({ extended: false })) |
|
15 |
+app.use(bodyParser.json()); |
|
13 | 16 |
|
14 | 17 |
app.listen 3000, => |
15 | 18 |
console.log('HTTP server on port 3000') |
16 | 19 |
|
17 |
-TelegramBot = require('node-telegram-bot-api'); |
|
20 |
+TelegramBot = require('node-telegram-bot-api') |
|
18 | 21 |
#Telegram bot token (given when you create a new bot using the BotFather); |
19 | 22 |
telegramBot = new TelegramBot(process.env.TELEGRAM_TOKEN, {polling: false}); |
20 | 23 |
|
@@ -56,6 +59,7 @@ class MultiAdapter extends Adapter |
||
56 | 59 |
|
57 | 60 |
app.post '/telegram-api', (req, res) => |
58 | 61 |
console.log(req.body.message) |
62 |
+ res.end() |
|
59 | 63 |
|
60 | 64 |
@emit 'connected' |
61 | 65 |
|