Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
484 views
in Technique[技术] by (71.8m points)

typescript - How can I send uploaded image as sticker in Telegram? (Telegraf Library)

I want to send uploaded image as sticker in channel. I can't find any source for this. It's my code:

ctx.telegram.getFileLink(photo.file_id).then(url => {    
    axios({url, responseType: 'stream'}).then(response => {
        response.data.pipe(fs.createWriteStream(`images/public/images/${photo.file_id}.png`))
        .on('finish', async() => {
           ctx.replyWithSticker({source: `images/public/images/${photo.file_id}.png`})
        })
        .on('error', (e: Error) => { 
           ctx.reply("An error occured")})
        })
    })
})

But it sending me this:

Image

Can someone help me? Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...