嘿,我尝试在discord上获取头像图片,然后在上面添加文本,最后将其发送回tchat
因此,我尝试了以下方法来获取用户的图像:
这是我执行以下步骤的代码:
@bot.command(name="pic")
async def get_pic(ctx):
url = f"{str(ctx.author.avatar_url)[:-4]}128" # get url and change 1024 to 128
avatar = Image.open(urllib.request.urlopen(url))
不幸的是,我得到一个错误403:禁止。 如何解决这个问题
那么它是这样描述的
意思是服务器收到了你的请求,但我猜你没有权限
快乐编码
您可以使用^{} 获取表示所需大小的化身的^{} object ,将该数据读入类似文件的对象,然后使用PIL打开该类似文件的对象
相关问题 更多 >
编程相关推荐