Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Inline bot #11
Inline bot #11
Comments
|
@okyrylchuk, try this simple example: var TelegramBot = require('node-telegram-bot-api');
var token = 'WRITE_YOUR_TOKEN_HERE';
var botOptions = {
polling: true
};
var bot = new TelegramBot(token, botOptions);
bot.getMe().then(function(me)
{
console.log('Hello! My name is %s!', me.first_name);
console.log('My id is %s.', me.id);
console.log('And my username is @%s.', me.username);
});
bot.on('inline_query', function(msg)
{
var q_id = msg.id;
var q_query = msg.query;
// var q_from = msg.from;
// var q_offset = msg.offset;
var results = [];
for (var i = 0; i < 10; ++i) {
var InlineQueryResultPhoto = {
'type': 'photo',
'photo_url': 'http://exlmoto.ru/wp-content/Images/E770vE1000/large/' + q_query + '.jpg',
'thumb_url': 'http://exlmoto.ru/wp-content/Images/E770vE1000/' + q_query + '.jpg',
'id': '287878416582808857/' + i,
'photo_width': 48,
'photo_height': 48
};
results.push(InlineQueryResultPhoto);
}
bot.answerInlineQuery(q_id, results);
});
bot.on('chosen_inline_result', function(msg)
{
console.log('Chosen:' + msg);
});Demonstration: And read this: |

Could you please make a bot as inline?