我不能有2个嵌入

时间:2019-01-14 16:40:26

标签: python-3.x discord.py

所以我有一个问题;每当运行此脚本并键入=help时,我都不会有2个嵌入,但是会出现错误消息,但是当我键入=about时,它就可以正常工作。

这是错误消息:

  

等待client.send_message(message.channel,embed = emb)
  UnboundLocalError:分配前引用了本地变量'emb'

  elif message.content.startswith("=about"):
    emb = (discord.Embed(description="This is the Real Talk Bot! It's developed by Parched. :smile:", colour=0xff0000))
    emb.set_author(name="About RT Bot", icon_url="https://cdn.discordapp.com/attachments/520265639680671747/533389224913797122/rtgang.jpeg")
    emb.set_footer(text="Developed by Parched in discord.py, which is a python library.")
await client.send_message(message.channel, embed=emb)

if message.content.startswith("=help"):
    helpmsg = discord.Embed(description="Here are the commands, prefix is =.", colour=0xff0000)
    helpmsg.set_author(name="Commands", icon_url="https://cdn.discordapp.com/attachments/520265639680671747/533389224913797122/rtgang.jpeg")
    helpmsg.add_field(name="=help", value="Displays all commands.", inline=True)
    helpmsg.set_footer(text="Developed by Parched in discord.py, which is a python library.")
await client.send_message(message.channel, embed=helpmsg)

0 个答案:

没有答案