Edit Media
import { Photo, Video, Document } from 'degreet-telegram/src/creators'
import { IContext } from 'degreet-telegram/src/types'
import * as path from 'path'
// You can use new Video, new Document also
bot.onClick('edit', async (ctx: IContext): Promise<any> => {
try {
// edit local photo
await ctx.answer.edit(
new Photo('path', path.resolve(__dirname, 'mountain.jpg'))
.setCaption('Hello, world!')
)
// edit photo by url
await ctx.answer.edit(
new Photo('url', 'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/11/25/thumbs/800x531/74707.jpg')
.setCaption('Hello, world!')
)
} catch (e: any) {
console.error(e)
}
})
const { Photo, Video, Document } = require('degreet-telegram/build/creators')
const path = require('path')
// You can use new Video, new Document also
bot.onClick('edit', async (ctx) => {
try {
// edit local photo
await ctx.answer.edit(
new Photo('path', path.resolve(__dirname, 'mountain.jpg'))
.setCaption('Hello, world!')
)
// edit photo by url
await ctx.answer.edit(
new Photo('url', 'https://idsb.tmgrup.com.tr/ly/uploads/images/2020/11/25/thumbs/800x531/74707.jpg')
.setCaption('Hello, world!')
)
} catch (e) {
console.error(e)
}
})
Last updated