I'm making a discord bot that replies commands with the user's avatar, member id, and date, but the problem is, it's putting the image at the bottom of the embed, and I would like to have it between the embed title and the id/date field. How do I do that?
My code:
import datetime
bot = discord.Client()
token = 'haha'
@bot.event
async def on_ready():
print(f'{bot.user} has connected to Discord!')
@bot.event
async def on_message(message):
if message.content.startswith('$test'):
teste = message.author.mention
authorId = message.author.id
tempo = datetime.date.today().strftime("%d/%m/%Y")
avatar = message.author.avatar_url_as(format='jpg', static_format='webp', size=2048)
embed=discord.Embed(name="title", description=f"\U0001F5BC {teste} **alterou o avatar**", color=message.author.colour)
embed.set_image(url=avatar)
embed.add_field(name=f"ID do usuário: {authorId} • {tempo}", value="")
await message.channel.send(embed=embed)
bot.run(token)
This is a more general issue with Discord embeds - the layout is somewhat fixed.
You either have fields or you don't.
This illustration from discord.js guide does a good job:
So you would have to settle for either:
set_thumbnail
to have it shown on the right.set_image
and cram your information into the footer using set_footer
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.