Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline keyboard doesn't work #11

Open
lsndr opened this issue Jun 26, 2017 · 2 comments
Open

Inline keyboard doesn't work #11

lsndr opened this issue Jun 26, 2017 · 2 comments

Comments

@lsndr
Copy link

lsndr commented Jun 26, 2017

Использование context.inlineKeyboard не дает никаких результатов, кроме ошибки в консоле сразу же после отправки сообщения
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: 400 {"ok":false,"error_code":400,"description":"Bad Request: message can't be edited"} (node:16320) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code

Если попытаться отправить клавиатура через параметр reply_markup, то она появляется в сообщении, но после нажатия появляется ошибка
Unhandled rejection SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at CommandHandler.handle (D:\nodejs\vkm2\node_modules\bot-brother\lib\command-handler.js:211:30) at D:\nodejs\vkm2\node_modules\bot-brother\lib\bot.js:349:42 at tryCatcher (D:\nodejs\vkm2\node_modules\bluebird\js\main\util.js:26:23) at Promise._settlePromiseFromHandler (D:\nodejs\vkm2\node_modules\bluebird\js\main\promise.js:510:31) at Promise._settlePromiseAt (D:\nodejs\vkm2\node_modules\bluebird\js\main\promise.js:584:18) at Promise._settlePromises (D:\nodejs\vkm2\node_modules\bluebird\js\main\promise.js:700:14) at Async._drainQueue (D:\nodejs\vkm2\node_modules\bluebird\js\main\async.js:123:16) at Async._drainQueues (D:\nodejs\vkm2\node_modules\bluebird\js\main\async.js:133:10) at Immediate.Async.drainQueues (D:\nodejs\vkm2\node_modules\bluebird\js\main\async.js:15:14) at runCallback (timers.js:800:20) at tryOnImmediate (timers.js:762:5) at processImmediate [as _immediateCallback] (timers.js:733:5)

Пример из readme также нерабочий. Тут даже нет метода отправки сообщения с inlineKeyboard
`bot.bommand('inline_example')
.use('before', function (ctx) {
// set any your data to callbackData.
// IMPORTANT! Try to fit your data in 60 chars, because Telegram has limit for inline buttons
ctx.inlineKeyboard([[
{'Option 1': {callbackData: {myVar: 1}, isShown: function (ctx) { return ctx.callbackData.myVar != 1 }}},
{'Option 2': {callbackData: {myVar: 2}, isShown: function (ctx) { return ctx.callbackData.myVar != 2 }}},
// use syntax:
// 'callback${{CALLBACK_COMMAND}}' (or 'cb${{CALLBACK_COMMAND}}')
// 'invoke${{INVOKE_COMMAND}}'
// to go to another command
{'Option 3': {go: 'cb$go_inline_example'}},
{'Option 4': {go: 'invoke$go_inline_example'}}
]])
})
.answer(function (ctx) {
ctx.sendMessage('Inline data example')
})
.callback(function (ctx) {
ctx.updateText('Callback data: ' + ctx.callbackData.myVar)
})

bot.command('go_inline_example')
.invoke(function (ctx) {
ctx.sendMessage('This command invoked directly')
})
.callback(function (ctx) {
ctx.updateText('Command invoked via callback! type /inline_example to start again')
})`

@mhs-mlkn
Copy link

i have the same problem
did you managed to solve this problem?

@lsndr
Copy link
Author

lsndr commented Aug 23, 2017

Yes. I switched to https://github.com/telegraf/telegraf

R.I.P. bot-brother

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants