import { InlineQueryResultBuilder } from "https://deno.land/x/grammy@v1.32.0/convenience/inline_query.ts";
Holds a number of helper methods for building InlineQueryResult*
objects.
For example, letting the user pick one out of three photos can be done like this.
const results = [
InlineQueryResultBuilder.photo('id0', 'https://grammy.dev/images/Y.png'),
InlineQueryResultBuilder.photo('id1', 'https://grammy.dev/images/Y.png'),
InlineQueryResultBuilder.photo('id2', 'https://grammy.dev/images/Y.png'),
];
await ctx.answerInlineQuery(results)
If you want the message content to be different from the content in the inline query result, you can perform another method call on the resulting objects.
const results = [
InlineQueryResultBuilder.photo("id0", "https://grammy.dev/images/Y.png")
.text("Picked photo 0!"),
InlineQueryResultBuilder.photo("id1", "https://grammy.dev/images/Y.png")
.text("Picked photo 1!"),
InlineQueryResultBuilder.photo("id2", "https://grammy.dev/images/Y.png")
.text("Picked photo 2!"),
];
await ctx.answerInlineQuery(results)
Be sure to check the documentation on inline mode.
type
{ article(); audio(); audioCached(); contact(); documentPdf(); documentZip(); documentCached(); game(); gif(); gifCached(); location(); mpeg4gif(); mpeg4gifCached(); photo(); photoCached(); stickerCached(); venue(); videoHtml(); videoMp4(); videoCached(); voice(); voiceCached(); }
id: string,
title: string,
audio_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultAudio, "title" | "audio_url">,
id: string,
audio_file_id: string,
options?: InlineQueryResultOptions<InlineQueryResultCachedAudio, "audio_file_id">,
id: string,
phone_number: string,
first_name: string,
options?: InlineQueryResultOptions<InlineQueryResultContact, "phone_number" | "first_name">,
id: string,
title: string,
document_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultDocument, "mime_type" | "title" | "document_url">,
id: string,
title: string,
document_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultDocument, "mime_type" | "title" | "document_url">,
id: string,
title: string,
document_file_id: string,
options?: InlineQueryResultOptions<InlineQueryResultCachedDocument, "title" | "document_file_id">,
id: string,
game_short_name: string,
options?: InlineQueryResultOptions<InlineQueryResultGame, "game_short_name">,
id: string,
gif_url: string | URL,
thumbnail_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultGif, "gif_url" | "thumbnail_url">,
id: string,
gif_file_id: string,
options?: InlineQueryResultOptions<InlineQueryResultCachedGif, "gif_file_id">,
id: string,
title: string,
latitude: number,
longitude: number,
options?: InlineQueryResultOptions<InlineQueryResultLocation, "title" | "latitude" | "longitude">,
id: string,
mpeg4_url: string | URL,
thumbnail_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultMpeg4Gif, "mpeg4_url" | "thumbnail_url">,
id: string,
mpeg4_file_id: string,
options?: InlineQueryResultOptions<InlineQueryResultCachedMpeg4Gif, "mpeg4_file_id">,
id: string,
photo_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultPhoto, "photo_url">,
id: string,
photo_file_id: string,
options?: InlineQueryResultOptions<InlineQueryResultCachedPhoto, "photo_file_id">,
id: string,
sticker_file_id: string,
options?: InlineQueryResultOptions<InlineQueryResultCachedSticker, "sticker_file_id">,
id: string,
title: string,
latitude: number,
longitude: number,
address: string,
options?: InlineQueryResultOptions<InlineQueryResultVenue, >,
| "title"
| "latitude"
| "longitude"
| "address"
id: string,
title: string,
video_url: string | URL,
thumbnail_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultVideo, >,
| "mime_type"
| "title"
| "video_url"
| "thumbnail_url"
id: string,
title: string,
video_url: string | URL,
thumbnail_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultVideo, >,
| "mime_type"
| "title"
| "video_url"
| "thumbnail_url"
id: string,
title: string,
video_file_id: string,
options?: InlineQueryResultOptions<InlineQueryResultCachedVideo, "title" | "video_file_id">,
id: string,
title: string,
voice_url: string | URL,
options?: InlineQueryResultOptions<InlineQueryResultVoice, "title" | "voice_url">,
id: string,
title: string,
voice_file_id: string,
options?: InlineQueryResultOptions<InlineQueryResultCachedVoice, "title" | "voice_file_id">,