Size: a a a

2016 November 15

JB

Jose Berrocal in Dev Chat
The problem should be with express directly
источник

JB

Jose Berrocal in Dev Chat
Ilya Kostichenko
can u share some code example about receiving response and parsing and sending it?
Actually not, I found the piece of code that I share with you in the official docs
источник

RX

Ray X in Dev Chat
Also used express for https together with telegram-bot. It works fine. But never tried with express http protocal
источник

RX

Ray X in Dev Chat
Ilya Kostichenko
can u share some code example about receiving response and parsing and sending it?
Sure. One moment.
источник

JB

Jose Berrocal in Dev Chat
Ray X
Also used express for https together with telegram-bot. It works fine. But never tried with express http protocal
I will look when I get time to use http instead of express directly
источник

JB

Jose Berrocal in Dev Chat
Thanks
источник

RX

Ray X in Dev Chat
NP
источник

RX

Ray X in Dev Chat
'use strict'

var express = require('express')
var bodyParser = require('body-parser');
// var multer = require('multer');

let http = express()
http.use(bodyParser.json()); // for parsing application/json
http.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
// http.use(multer()); // for parsing multipart/form-data

http.post('/bot/api', function(request, response){

   console.log(request.body)
   response.send(request.body)
});
http.listen(9527);
источник

RX

Ray X in Dev Chat
here is  a simple http echo server.
источник

IK

Ilya Kostichenko in Dev Chat
Thanks
источник

RX

Ray X in Dev Chat
class OtherwiseController extends TelegramBaseController {
   /**
    * @param {Scope} $
    */
   handle($) {
       console.log('otherwise', $.chatId)
       tg.api.sendChatAction($.chatId, 'typing')
       tg.api.sendMessage($.chatId, 'bala bala')
   }
};
источник

RX

Ray X in Dev Chat
here is a simple controller which echo message from telegram client.
источник

RX

Ray X in Dev Chat
just add it in tg.router like this:
источник

RX

Ray X in Dev Chat
tg.router.otherwise(new OtherwiseController());
источник

JB

Jose Berrocal in Dev Chat
@HassleSolver i guess that @codydruid needs to combine both
источник

RX

Ray X in Dev Chat
well. http part is just a simple http server that is inrelevent with telegram, but just for test.
источник

IK

Ilya Kostichenko in Dev Chat
api part is ready,it's restful,simply need to test it out with responses sending from bot to users
источник

RX

Ray X in Dev Chat
for the next part, yes, codydruid need combine them together in nodejs code.
источник

RX

Ray X in Dev Chat
So in your scenario, user --(msg)--> bot --(msg)--> server --(msg) --> bot --(msg) --> user ??
источник

IK

Ilya Kostichenko in Dev Chat
yeap
источник