python - 为什么我的从 url 更改 webhook 头像的程序在 discord.py 中不起作用
问题描述
我在 discord.py 中的程序不起作用。我想制作!rules
将创建 webhook 并发送带有规则的消息的命令。我在尝试设置头像时遇到问题。
async def rules(self,ctx,*args):
respone=f"This is rules of **{ctx.guild.name}** server."
numba=1
for o in args:
respone=respone+f"```{numba}. {o}```"
numba=numba+1
web=await ctx.channel.create_webhook(name='Rules')
await web.edit(avatar_url="https://cdn.pixabay.com/photo/2021/01/19/03/56/girl-5929995_960_720.jpg")
await web.send(respone)
await ctx.author.send(f"Because command will be deleted, here's backup of it: \n`{ctx.message.content}`")
await ctx.message.delete()
有人可以帮忙吗?我尝试使用这些图像:
https://cdn.pixabay.com/photo/2021/02/08/16/03/dinosaur-5995333_960_720.png (png)
https://cdn.discordapp.com/avatars/731900211428851744/03adc5705993b66267666ff67be84d34.webp (my discord avatar, webp)
https://cdn.pixabay.com/photo/2021/01/19/03/56/girl-5929995_960_720.jpg (jpg)
谢谢你。
解决方案
尝试等待 web.edit(avatar=ctx.author.avatar_url)
推荐阅读
- css - 是背景图像被覆盖还是缺少 css 文件的原因?
- google-bigquery - BigQuery:计算 APPROX_QUNATILES 中的元素
- bash - 您可以在不创建目录结构副本的情况下使用 wget 反复递归地镜像站点吗?
- reactjs - 下拉菜单未使用新项目更新
- winforms - Winforms 使用 CefSharp 崩溃说 Accessviolation
- django - 在 Django 中查询当前经过身份验证的用户的两个表
- c# - 正确使用 return Task.FromException
- python - 如何求解一个函数y=f(x,y),即函数值取决于自身
- arrays - 如何以特定顺序连接 JSON 数组的两个值?
- kubernetes - 没有标签选择器的 Kubernetes 负载均衡器