AttributeError: module 'discord' has no at

2019-08-24 14:10发布

问题:

I have this code:

embed=discord.Embed(title="Commands - Type '/help [command prefix]' for command info!", color=0xff0d13)
embed.set_footer(text="!blacklist, !clean, !clear, !disconnect, !id, !joinserver, !listids, !np, !pause, !perms, !play, !pldump, !queue, !restart, !resume, !search, !setavatar, !setname, !setnick, !shuffle, !shutdown, !skip, !summon, !volume") 
await self.bot.say(embed=embed)

and I keep getting this error:

AttributeError: module 'discord' has no attribute 'Embed'

But I don't know whats causing it; I have tried installing discord.py again but this still happens.. is it to do with the code itself or something else?

回答1:

Your problem is most likely cause by you naming that file or some other file somewhere in your path to discord.py. To fix it, just rename your file to something else. Maybe run.py or something?