import { InputMediaBuilder } from "https://deno.land/x/grammy@v1.29.0/mod.ts";
Holds a number of helper methods for building InputMedia*
objects. They are
useful when sending media groups and when editing media messages.
For example, media groups can be sent like this.
const paths = [
'/tmp/pic0.jpg',
'/tmp/pic1.jpg',
'/tmp/pic2.jpg',
]
const files = paths.map((path) => new InputFile(path))
const media = files.map((file) => InputMediaBuilder.photo(file))
await bot.api.sendMediaGroup(chatId, media)
Media can be edited like this.
const file = new InputFile('/tmp/pic0.jpg')
const media = InputMediaBuilder.photo(file, {
caption: 'new caption'
})
await bot.api.editMessageMedia(chatId, messageId, media)
type
{ photo(media: string | InputFile, options?: InputMediaOptions<InputMediaPhoto>): InputMediaPhoto; video(media: string | InputFile, options?: InputMediaOptions<InputMediaVideo>): InputMediaVideo; animation(media: string | InputFile, options?: InputMediaOptions<InputMediaAnimation>): InputMediaAnimation; audio(media: string | InputFile, options?: InputMediaOptions<InputMediaAudio>): InputMediaAudio; document(media: string | InputFile, options?: InputMediaOptions<InputMediaDocument>): InputMediaDocument; }