require('dotenv').config();

const _                        = require('lodash');
const BookSearch               = require('./lib/goodreads/bookSearch');
const InlineQueryResultArticle = require('./model/inlineQueryResultArticle');
const Telegraf                 = require('telegraf');
const bot                      = new Telegraf(process.env.TELEGRAM_BOT_TOKEN);
const URL                      = process.env.URL || 'https://goodreaderbot.herokuapp.com';

bot.on('inline_query', (ctx) => {

    const processAnswers = _.flowRight(
        _.partial(ctx.answerInlineQuery.bind(ctx), _),
        (books) => books.map((b) => new InlineQueryResultArticle(b))
    );

    new BookSearch(process.env.GOODREADS_API_KEY).execute(ctx.update.inline_query.query)
                                                 .then(processAnswers)
                                                 .catch(console.log.bind(console));
});

bot.telegram.setWebhook(`${URL}/${process.env.TELEGRAM_BOT_TOKEN}`);

bot.startWebhook(`/${process.env.TELEGRAM_BOT_TOKEN}`,null, process.env.PORT);

bot.catch(console.log.bind(console));

console.log('Goodreader bot has Started!');
@@ -142,24 +142,94 @@
 okSearch');%0A
+const BookShow                 = require('./lib/goodreads/bookShow');%0A
 const Inline
@@ -971,24 +971,720 @@
 ole));%0A%7D);%0A%0A
+bot.on('callback_query', (ctx) =%3E %7B%0A    const createMessageUpdate = (b) =%3E %60%3Ca href=%22$%7Bb.thumb_url%7D%22 target=%22_black%22%3E&#8203;%3C/a%3E%3Cb%3E$%7Bb.title%7D ($%7Bb.rating%7D)%3C/b%3E%5CnBy %3Ca href=%22https://www.goodreads.com/author/show/$%7Bb.author.id%7D%22%3E$%7Bb.author.name%7D%3C/a%3E%5Cn%5Cn%3Ci%3E$%7B b.description %7D%3C/i%3E%5Cn%5CnRead more about this book on %3Ca href=%22https://www.goodreads.com/book/show/$%7Bb.id%7D%22%3EGoodreads%3C/a%3E.%60;%0A%0A    new BookShow(process.env.GOODREADS_API_KEY).execute(ctx.update.callback_query.data)%0A                                               .then((book) =%3E %7B ctx.editMessageText(createMessageUpdate(book), %7B parse_mode: 'HTML' %7D); %7D)%0A                                               .catch(console.log.bind(console));%0A%7D);%0A%0A
 bot.telegram

Implement callback_query support for read_more button.