Skip to content

Instantly share code, notes, and snippets.

@carafelix
Created May 28, 2024 21:24
Show Gist options
  • Save carafelix/803b51ab299432186bbc9d72e3fa6a82 to your computer and use it in GitHub Desktop.
Save carafelix/803b51ab299432186bbc9d72e3fa6a82 to your computer and use it in GitHub Desktop.
bot.use(posts());
bot.command('papin', async (c) => {
c.replyWithPhoto(new InputFile('/example/Georges_Perec.jpg'))
.then(async update => {
c.api.raw.deleteMessage({
chat_id: update.chat.id,
message_id: update.message_id
})
update.photo.sort((a, b) => b.height * b.width - a.height * a.width)
const fileTelegramPath = (await c.api.raw.getFile({ file_id: update.photo[0].file_id })).file_path
const _url = `https://api.telegram.org/file/bot${bot.token}/${fileTelegramPath}`
const url = await mediaUpload(_url)
c.replyWithPost(`papi media foto: ![](${url})`)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment