G
G
GrummHD2022-01-07 14:22:07
Python
GrummHD, 2022-01-07 14:22:07

How to make an avatar command on discord.py?

when recording

spoiler
(prefix)
avatar @user
so that the picture appears

(I already have the necessary libraries)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bogdan Buchko, 2022-01-07
@INDMops

I am using this code. If when you enter the command !avatar (! - as a prefix), without mentioning the participant, then the avatar of the user who entered the command is displayed.

@bot.command()
async def avatar(ctx, member: discord.Member  = None):
    if member == None:#если не упоминать участника тогда выводит аватар автора сообщения
        member = ctx.author
    embed = discord.Embed(color = 0x22ff00, title = f"Аватар участника - {member.name}", description = f"[Нажмите что бы скачать аватар]({member.avatar_url})")
    embed.set_image(url = member.avatar_url)
    await ctx.send(embed = embed)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question