question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nothing append when using answerInlineQuery to send photo.

See original GitHub issue

Here is my code, very basic:

bot.on('inline_query', function(query) {
  picturesToSend = [];
  // open the folder and get the number of pictures in
  var files = fs.readdirSync('./img/');
  var numberOfPics = files.length;

  // get 3 random pictures from my folder
  for (var i = 0; i < 3; i++) {
    // get a random picture name in my folder
    pictureName = files[Math.floor(Math.random() * numberOfPics)];
    // open this picture and add it to and array
    picturesToSend.push(fs.readFileSync('./img/' + pictureName));
  }
  // send the array containing 3 pictures
  bot.answerInlineQuery(query.id, picturesToSend);
});

When using answerInlineQuery nothing append and I got no error. Of course I have activate /setinlineBot with botfather

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
yagopcommented, Jan 9, 2016

Your code is wrong. Take a look on answerInlineQuery

0reactions
larfadincommented, Jan 9, 2016

Thank you for your help. For now it’s not possible to send local file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Send a local photo from inline mode in a telegram bot
The bot can message you the photo, get that information and use what you need. Another option is creating a private channel where...
Read more >
telepot reference — telepot 12.7 documentation - Read the Docs
When you are dealing with a particular chat, it is tedious to have to supply the same chat_id every time to send a...
Read more >
amanobot Documentation - Read the Docs
Parameters audio – Same as photo in amanobot.Bot.sendPhoto(). sendDocument(chat_id: Union[int, str], document, thumb=None, caption: str ...
Read more >
Telegram Bot API
New incoming channel post of any kind - text, photo, sticker, etc. ... that happened when trying to synchronize available updates with Telegram...
Read more >
Frequently Asked Questions - Midjourney Documentation
A: Use /relax in a bot channel. This will cost you nothing but images will take longer to generate.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found