Naltox / telegram-node-bot

Node module for creating Telegram bots.
MIT License
721 stars 143 forks source link

tests inlineQuery #111

Closed ccabreraq closed 7 years ago

ccabreraq commented 8 years ago

Greetings, I'm doing a test with inlineQuery, the code is as follows:

'use strict' const Telegram = require('telegram-node-bot') const TelegramBaseController = Telegram.TelegramBaseController const TelegramBaseInlineQueryController = Telegram.TelegramBaseInlineQueryController const tg = new Telegram.Telegram('241796819:AAFMfO8xz-DL1McgqPQ7-mTU4ohBfUt-MUA')

class inlineController extends TelegramBaseInlineQueryController { handle($) { var msg = $.query tg.answerInlineQuery($.id, [{ type: "article", title: msg, input_message_content: { message_text: msg

    }
  }]) 
}

}

tg.router .inlineQuery(new inlineController())

I am giving me the following error:

[error] 

error TypeError: tg.answerInlineQuery is not a function at inlineController.handle (/mnt/app/server.js:14:10) at InlineQueryUpdateProcessor.process (/mnt/app/node_modules/telegram-node-bot/lib/updateProcessors/InlineQueryUpdateProcessor.js:48:63) at UpdateProcessorsManager.process (/mnt/app/node_modules/telegram-node-bot/lib/updateProcessors/UpdateProcessorsManager.js:34:23) at updates.forEach.update (/mnt/app/node_modules/telegram-node-bot/lib/Telegram.js:65:43) at Array.forEach (native) at Telegram._getUpdates (/mnt/app/node_modules/telegram-node-bot/lib/Telegram.js:63:21) at api.getUpdates.then.updates (/mnt/app/node_modules/telegram-node-bot/lib/Telegram.js:155:17) at process._tickCallback (internal/process/next_tick.js:103:7)

in controller inlineController { _api: null, _localization: null }

for update Update { _updateId: 969510554, _message: null, _editedMessage: null, _inlineQuery: InlineQuery { _id: '448688109547523170', _from: User { _id: 104468341, _firstName: 'Carlos', _lastName: 'Cabrera', _username: null }, _location: null, _query: '', _offset: '' }, _chosenInlineResult: null, _callbackQuery: null }

someone can help me to identify I'm doing wrong or can give me a sample code

Thank you

Naltox commented 7 years ago

Format your code, please

ccabreraq commented 7 years ago

Hi, I was using the wrong method, apologies

liorbentov commented 7 years ago

@ccabreraq, can you publish a working code?

AlexiRJamal commented 5 years ago

Hi, I was using the wrong method, apologies

Can you share the working code please?