rename image before send to discord
This commit is contained in:
parent
28ca2e57b8
commit
0c038a550d
@ -112,10 +112,11 @@ async def process_image_requests():
|
|||||||
image_data = await resp.read()
|
image_data = await resp.read()
|
||||||
timestamp = message.created_at.strftime('%Y%m%d%H%M%S')
|
timestamp = message.created_at.strftime('%Y%m%d%H%M%S')
|
||||||
filename = f"images/{timestamp}_generated_image.png"
|
filename = f"images/{timestamp}_generated_image.png"
|
||||||
|
new_filename = f"{timestamp}_generated_image.png" # There is probably a better way to do this.
|
||||||
with open(filename, "wb") as f:
|
with open(filename, "wb") as f:
|
||||||
f.write(image_data)
|
f.write(image_data)
|
||||||
with open(filename, "rb") as f:
|
with open(filename, "rb") as f:
|
||||||
await message.channel.send(file=discord.File(f))
|
await message.channel.send(file=discord.File(f, new_filename))
|
||||||
else:
|
else:
|
||||||
await message.channel.send("`GarfBot Error: Odie`")
|
await message.channel.send("`GarfBot Error: Odie`")
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user