forked from mullwar/telebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inline-query.js
41 lines (32 loc) · 971 Bytes
/
inline-query.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const TeleBot = require('../');
const bot = new TeleBot('TELEGRAM_BOT_TOKEN');
// On inline query
bot.on('inlineQuery', msg => {
let query = msg.query;
console.log(`inline query: ${ query }`);
// Create a new answer list object
const answers = bot.answerList(msg.id, {cacheTime: 60});
// Article
answers.addArticle({
id: 'query',
title: 'Inline Title',
description: `Your query: ${ query }`,
message_text: 'Click!'
});
// Photo
answers.addPhoto({
id: 'photo',
caption: 'Telegram logo.',
photo_url: 'https://telegram.org/img/t_logo.png',
thumb_url: 'https://telegram.org/img/t_logo.png'
});
// Gif
answers.addGif({
id: 'gif',
gif_url: 'https://telegram.org/img/tl_card_wecandoit.gif',
thumb_url: 'https://telegram.org/img/tl_card_wecandoit.gif'
});
// Send answers
return bot.answerQuery(answers);
});
bot.start();