When trying to edit an embed:
py
@client.command()
async def ping(self):
"""Pings the bot"""
pingtime = time.time()
e = discord.Embed(title="Pinging...", colour=0xFF0000)
await self.bot.say(embed=e)
ping = time.time() - pingtime
complete = "Pong, %.01f seconds" % ping
em = discord.Embed(title=complete, colour=0xFF0000)
await self.bot.edit_message(e, embed=em)
I get the following error:
AttributeError: 'Embed' object has no attribute 'channel'
But I have no clue how to fix it. Could you please help.. ^Shiney
The first param of edit_message is the Message object, not the Embed object. Use the return value from await self.bot.say to get the message.
Could you give an example please?
No, please read the docs. If you want help, the place is the API server linked in the README, not GitHub issues. These are for issues with the library.
Oh oki..
@client.command()
async def ping(self):
"""Pings the bot"""
pingtime = time.time()
e = discord.Embed(title="Pinging...", colour=0xFF0000)
msg = await self.bot.say(embed=e)
ping = time.time() - pingtime
complete = "Pong, %.01f seconds" % ping
em = discord.Embed(title=complete, colour=0xFF0000)
await self.bot.edit_message(msg, embed=em)```
The answer given by Bluescream is right.
You get the message object via the return of e.g. await bot.say. Then you pass it to bot.edit_message.
Most helpful comment
The answer given by Bluescream is right.
You get the message object via the return of e.g.
await bot.say. Then you pass it tobot.edit_message.