Closed dmvakh closed 8 years ago
Hi!
You cant call methods like this:
$.api.editMessageText(chat_id = cId, message_id = mId, 'Upd')
in js.
Do it like this:
$.api.editMessageText('new text', { chat_id: chatId, message_id: messageId })
Where chatId
and messageId
are variables containing chat id and message id.
Try update message - receive error:
"error ReferenceError: chat_id is not defined"
code:
'use strict'
const Telegram = require('telegram-node-bot') const TelegramBaseController = Telegram.TelegramBaseController const tg = new Telegram.Telegram('MY_TOKEN')
let cId, mId;
class TestController extends TelegramBaseController { addHandler($) { $.sendMessage('Add') .then(()=>{ cId = $.message.chat.id mId = $.message.messageId }) }
}
tg.router .when(['/add'], new TestController()) .when(['/upd'], new TestController())