Skip to content
Discussion options

You must be logged in to vote

First enable inline mode for the bot in @Botfather. Then handle InlineQuery, create an article result, and pass it to answerInlineQuery:

bot.getEvents().onInlineQuery([&bot](TgBot::InlineQuery::Ptr query) {
    auto text = std::make_shared<TgBot::InputTextMessageContent>();
    text->messageText = "You entered: " + query->query;

    auto content = std::make_shared<TgBot::InputMessageContent>();
    content->value = text;

    auto article = std::make_shared<TgBot::InlineQueryResultArticle>();
    article->id = "text-result";
    article->title = "Send result";
    article->inputMessageContent = content;

    auto result = std::make_shared<TgBot::InlineQueryResult>();
    result->value = …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by reo7sp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants