jehy / telegram-test-api

Simple implimentation of telegram API which can be used for testing telegram bots
MIT License
98 stars 24 forks source link

When the bot sends a message, it does not get the message object as a return #19

Closed jgsmarques closed 3 years ago

jgsmarques commented 5 years ago

Hi,

I'm doing a test where the user sends a message to the bot, the bot responds, and needs to keep hold of the message_id that is in the response object. However, I've seen that during the tests the bot is not able to receive this message_id. I tracked it to the routes/bot/sendMessage.js file in the following code:

const sendMessage = (app, telegramServer)=> {
  handle(app, '/bot:token/sendMessage', (req, res, unusedNext) => {
    const botToken = req.params.token;
    telegramServer.addBotMessage(req.body, botToken);
    const data = {ok: true, result: null};
    res.sendResult(data);
  });
};

Here I see that the bot receives a data object, but it probably does not match the object it gets from Telegram.