小编Nan*_*ion的帖子

discord.py中的错误400

我正在使用Discord.py创建一个机器人,并且在尝试发送带有嵌入的消息时我一直收到错误.

这是我得到的错误:

Traceback (most recent call last):
  File "C:\Users\pc\Documents\Storage\python\NanoBot\bot.py", line 101, in on_message
    await client.send_message(message.channel, embed=embed)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\http.py", line 198, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)
Run Code Online (Sandbox Code Playgroud)

我的代码:

embed = discord.Embed(color=target.color)
embed.set_thumbnail(url=target.avatar_url)
embed.set_author(name=str(target.name), url="Playing " + str(target.game))
embed.set_footer(text="!!userinfo command")
embed.add_field(name="Status", value=str(target.status))
embed.add_field(name="Nickname", value=str(target.nick))
embed.add_field(name="Account Created", value=str(target.created_at))
embed.add_field(name="Roles", value=str(roles))
embed.add_field(name="Joined at", value=str(target.joined_at))
await client.send_message(message.channel, embed=embed)
Run Code Online (Sandbox Code Playgroud)

python python-asyncio discord

4
推荐指数
1
解决办法
6611
查看次数

标签 统计

discord ×1

python ×1

python-asyncio ×1