@bot.on.message_handler(text='photo_from_bytes', lower=True)
async def photo_from_bytes(ans: Message):
    image = Image.new('RGB', (320, 320), (0, 0, 0))
    fp = BytesIO()
    image.save(fp, 'RGB')
    setattr(fp, 'name', 'image.png')
    photo = (await photo_uploader.upload_message_photo(fp))
    (await ans(attachment=photo))
@bot.on.message_handler(text='photo_from_bytes', lower=True)
async def photo_from_bytes(ans: Message):
    image = Image.new('RGB', (320, 320), (0, 0, 0))
    fp = BytesIO()
    image.save(fp, 'RGB')
    setattr(fp, 'name', 'image.png')
    photo = (await photo_uploader.upload_message_photo(fp))
    (await ans(attachment=photo))