所以我有一个问题;每当运行此脚本并键入=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)