问题
I started with discord.py a month or two ago, so this might just be really simple. My code is:
attachment_url = ctx.message.attachments[0].url
await archiver.send(attachment_url)
"archiver" is the channel I'm sending it in. How do I make it send with a spoiler tag? I looked through the docs but they're not helpful.
Thanks.
回答1:
In order for you to upload an image as a spoiler, you need to add SPOILER_
to the start of the image name, you can do that with:
file = ctx.message.attachments[0]
file.filename = f"SPOILER_{file.filename}"
spoiler = await file.to_file()
await archiver.send(file=spoiler)
来源:https://stackoverflow.com/questions/60408884/how-do-i-get-the-bot-to-post-spoiler-images-in-discord-py