user14118636
user14118636

Reputation: 3

Problem with embed in discord, doesn't write

I write !time but the command is simply deleted and embed does not appear image

@client.command(aliases = ['время'])
async def time(ctx):
    emb = discord.Embed( colour = discord.Color.blue() )

    await ctx.channel.purge( limit = 1 )

    emb.set_author( name = ctx.author.name, icon_url= ctx.author.avatar_url )
    emb.set_footer( text = 'Приятного времяпрепровождения', icon_url = client.user.avatar_url )
    
    emb.set_thumbnail( icon_url = 'https://sun1.sibirix.userapi.com/ZrrVDtUgPy8BqsrY4iPa-8qQCLm_KHLaoyfWgQ/q5txWSzV1Zc.jpg' )

    now_date = datetime.datetime.now()

    emb.add_field( name ='501st LEGION', value = 'Дата и время: {}'.format( now_date ) )

    await ctx.send( embed = emb )

I can throw off the full code

Upvotes: 0

Views: 50

Answers (1)

Abdulaziz
Abdulaziz

Reputation: 3426

Your issue was with the thumbnail.

@client.command(aliases=['время'])
async def time(ctx):
    emb = discord.Embed(colour=discord.Color.blue())

    await ctx.message.delete()

    emb.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url)
    emb.set_footer(text='Приятного времяпрепровождения',
                   icon_url=client.user.avatar_url)

    emb.set_thumbnail(url='https://sun1.sibirix.userapi.com/ZrrVDtUgPy8BqsrY4iPa-8qQCLm_KHLaoyfWgQ/q5txWSzV1Zc.jpg')

    now_date = datetime.datetime.now()

    emb.add_field(name='501st LEGION',value='Дата и время: {}'.format(now_date))

    await ctx.send(embed=emb)

You can also format the date output.using now_date.strftime('%a, %b %e %H:%M:%S') to be like this Mon, Aug 17 11:24:56

enter image description here

Upvotes: 1

Related Questions