How do I put a member's image and nick on embed? (w/ discord.py)

人盡茶涼 提交于 2019-12-11 04:27:18

问题


I want to put the avatar and nick of the person who ran a command in the embed, something like this:

requested by:
(avatar) (nick) 

but I do not know how to start....


回答1:


sounds like you should read more documentation, here are a few links:

rewrite: embed, send

async: embed, send_message

otherwise here is the code that I recommend using

em = discord.Embed(description='requested by:\n{0}'.format(ctx.author))
em.set_thumbnail(url=ctx.author.avatar_url)

# for rewrite (1.0.0a) do
await ctx.send(embed=em)

# if you're using async 0.16.x do
await bot.say(embed=em)



回答2:


Theres a pretty handy tool online that you can use to create embeds using discord.py.

Heres a link to it: Discord Embed Generator.

However, I highly suggest also reading the docs, to get a better understanding of what you're coding, instead of depending on that resource.

Heres the embed documentation.




回答3:


I used this:

embed.set_thumbnail(url=message.author.avatar_url)
embed.set_footer(text='ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤRequested by: ' + message.author.name)


来源:https://stackoverflow.com/questions/48412010/how-do-i-put-a-members-image-and-nick-on-embed-w-discord-py

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!