Media Input
Class-helper with static methods that represents the content of a media message to be sent.
document
Represents a general file to be sent.
ts
// ctx from bot.on("message", (ctx) => ...)
ctx.sendMediaGroup([
MediaInput.document(
MediaUpload.url(
"https://raw.githubusercontent.com/gramiojs/types/main/README.md"
)
),
MediaInput.document(MediaUpload.path("./package.json")),
]);
audio
Represents an audio file to be treated as music to be sent.
ts
// ctx from bot.on("message", (ctx) => ...)
ctx.sendMediaGroup([
MediaInput.audio(MediaUpload.url("https://.../music.mp3")),
MediaInput.audio(MediaUpload.path("./music.mp3")),
]);
photo
Represents a photo to be sent.
ts
// ctx from bot.on("message", (ctx) => ...)
ctx.sendMediaGroup([
MediaInput.photo(
MediaUpload.url(
"https://w7.pngwing.com/pngs/140/552/png-transparent-kitten-if-cats-could-talk-the-meaning-of-meow-pet-sitting-dog-pet-dog-mammal-animals-cat-like-mammal.png"
),
{ has_spoiler: true, caption: "MaybeCat<TelegramInputFile>" }
),
MediaInput.photo(MediaUpload.path("./no-cat.png")),
]);
video
Represents a video to be sent.
ts
// ctx from bot.on("message", (ctx) => ...)
ctx.sendMediaGroup([
MediaInput.video(MediaUpload.url("https://.../video.mp4"), {
has_spoiler: true,
thumbnail: MediaUpload.buffer(/**file buffer */),
}),
MediaInput.photo(MediaUpload.path("./cat-walk.mp4")),
]);
animation
Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
ts
MediaInput.animation(
MediaUpload.url(
"https://media1.tenor.com/m/47qpxBq_Tw0AAAAd/cat-cat-meme.gif"
)
);