Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ';资产';对象没有属性';从'开始;在使用avatar_url和create_webhook时_Python_Python 3.x_Discord.py_Discord.py Rewrite - Fatal编程技术网

Python ';资产';对象没有属性';从'开始;在使用avatar_url和create_webhook时

Python ';资产';对象没有属性';从'开始;在使用avatar_url和create_webhook时,python,python-3.x,discord.py,discord.py-rewrite,Python,Python 3.x,Discord.py,Discord.py Rewrite,我有一个创建webhook的命令,创建webhook和name可以找到,但是当我添加头像并将其设置为提到的人的头像url时,我得到了错误:'Asset'对象没有属性'startswith'我想我可能必须使用with open或类似的东西才能从我的pc打开我不想要的图像,我希望它是提到的人的形象,而不是从我的电脑图像文件,无论如何要这样做 @bot.command() async def whook(ctx,user:discord.Member): await ctx.channel.c

我有一个创建webhook的命令,创建webhook和name可以找到,但是当我添加
头像
并将其设置为提到的人的头像url时,我得到了错误:
'Asset'对象没有属性'startswith'
我想我可能必须使用
with open
或类似的东西才能从我的pc打开我不想要的图像,我希望它是提到的人的形象,而不是从我的电脑图像文件,无论如何要这样做

@bot.command()
async def whook(ctx,user:discord.Member):
    await ctx.channel.create_webhook(name="Mr. W.Hook",avatar=user.avatar_url)
    print("Created")

阿凡达必须是一个角色。你可以调用user.avatar\u url,在本地下载它,然后设置它。考虑到这一点,但只是不知道如何做,我该如何下载用户的化身?化身需要是一个。你可以调用user.avatar\u url,在本地下载,然后设置它。考虑到这一点,但只是不知道如何做,我该如何下载用户的化身?