Upload any file and get a permanent direct link โ stored on Cloudinary CDN, tracked in MongoDB. Fast anywhere in the world.
# Install once
# pip3 install badbox
from badbox import upload_file
# Works directly โ no setup needed
url = upload_file("photo.jpg")
print(url)
# โ https://res.cloudinary.com/...
from badbox import upload_bytes
async def handle_photo(update, ctx):
photo = update.message.photo[-1]
f = await ctx.bot.get_file(photo.file_id)
data = await f.download_as_bytearray()
url = upload_bytes(bytes(data), "photo.jpg")
await update.message.reply_text(url)