Closed ghost closed 6 years ago
You do not call AppInfo directly.
You will need to retrieve and build AppInfo with application_info()
:
http://discordpy.readthedocs.io/en/latest/api.html#discord.Client.application_info
For a quick example, you could do this in on_ready()
and assign it to your bot:
@bot.event
async def on_ready():
if not hasattr(bot, 'appinfo'):
bot.appinfo = await bot.application_info()
In your code, you could then do:
@bot.event
async def on_message(message):
if message.author.bot:
return
if message.channel.is_private:
embed = discord.Embed(color=0x7daeff)
embed.add_field(name='By', value=str(message.author), inline=True)
embed.add_field(name='Time', value=str(datetime.now().strftime('%Y.%m.%d, %H:%M:%S')), inline=True)
embed.add_field(name='Message content', value=message.content, inline=False)
await bot.send_message(bot.appinfo.owner, embed=embed)
await bot.process_commands(message)
Thank you so much. I'll try to be more attentive next time.
Don't forget to close the Issue.
Code:
Console error:
I do not know what I'm doing wrong. Can any one help me?