Search code examples
pythondiscord.pyembed

discord.py embed footer with timestamp


So I am trying to make something like this: enter image description here

Here is my current code:

time = datetime.datetime.utcnow()
embed.set_footer(text = time, icon_url = "https://i.imgur.com/uZIlRnK.png")

But it shows this: enter image description here

So how can I change the time of the second image like that of the first image?


Solution

  • You should use Embed.timestamp which takes a datetime.datetime object.

    You have two ways to add it

    First way:

    embed = discord.Embed(title='test',timestamp=datetime.datetime.utcnow())
    embed.set_footer(text='\u200b',icon_url="https://i.imgur.com/uZIlRnK.png")
    

    Second way:

    embed.timestamp = datetime.datetime.utcnow()
    embed.set_footer(text='\u200b',icon_url="https://i.imgur.com/uZIlRnK.png")
    

    Note: \u200b is just a empty line.

    EDIT:

    Added footer icon.