'DISCORD.PY - Bot bot sends image as spoiler
I'm trying to get my bot to send an image as a spoiler, but I'm not having success. The image comes from a URL, but how do I mark it as a spoiler?
my code:
@client.command()
async def ordema(archiver): #command
await archiver.send(f'https://imageproxy.ifunny.co/crop:x-20,resize:640x,quality:90x75/images/a475315bd258dc83078c79ea338a0118919944fbecdc8b1bb5d4bda5d3dbab53_1.jpg') #image url
Solution 1:[1]
As said in my comment:
Discord supports the addition of SPOILER_ to images. Your code could look something like this:
file = ctx.message.attachments[0]
file.filename = f"SPOILER_{file.filename}"
spoiler = await file.to_file()
await archiver.send(file=spoiler)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Thornily |
