attachment.py

 1from bale import Bot, Message, InputFile
 2
 3client = Bot("Your Token")
 4
 5@client.event
 6async def on_ready():
 7    print(client.user, "is Ready!")
 8    
 9@client.event
10async def on_message(message: Message):
11    if message.content == "/photo":
12        file = open('attachment.png', 'rb').read()
13        photo = InputFile(file)
14        return await message.reply_photo(photo=photo, caption="This is a simple photo")
15
16    elif message.attachment and message.photos:
17        file = open('./attachment.{}'.format(message.attachment.mime_type), 'wb')
18        await message.attachment.save_to_memory(file)
19        return await message.reply("I saved this image!")
20
21client.run()