is anyone using the new inline features?
please share a code example, or are the methods not added to this library yet?
@paOol, try this: simple inline photo 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);
});
Thank you.
in above code chosen_inline_result is not working
what is the advantage of _id_ in _InlineQueryResultPhoto_ ?
@sanjeev444456
You must activate this option via @BotFather
Enable feedback.@abbddo
The official documentation says:
Field | Type | Description
-- | -- | --
id | String | Unique identifier for this result, 1-64 Bytes
So then you must generate a unique id for each inline-result. You can do this in any way. Also for the id it is possible to use not only digits, but also symbols.
Most helpful comment
Thank you.