【发布时间】:2021-10-03 12:31:53
【问题描述】:
代码任务:
使用该命令时,机器人会拍摄用户或用户标记的照片并添加模糊效果。
我的代码问题:
在查看了很多资源以完成我的任务后,我找不到详细的答案。在我看来,我的代码看起来不错,但它不起作用,尽管没有输出错误。
代码:
from PIL import Image, ImageFilter
@Bot.command()
async def blur(ctx, user: discord.Member = None):
async with ctx.channel.typing():
await ctx.message.delete()
url = user.avatar_url
image = Image.open(url)
blurred_url = image.filter(ImageFilter.BLUR)
blurred_url.save("sas.png")
file = discord.File("sas.png", filename="sas.png")
await ctx.send(file=file)
【问题讨论】:
标签: discord.py python-imaging-library imagefilter