Skip to content

Embedding

nbaak edited this page Dec 28, 2023 · 2 revisions

Embedding things in Discord.py

Eample

from discord import Embed, Member
@commands.command(name='userinfo', brief='Userinfo', help='get info for user')
@commands.is_owner()
async def user_info(self, ctx, target: Optional[Member]):
target = target or ctx.author

panel = Embed(title="User Information", color=target.color, timestamp=datetime.utcnow())
panel.set_thumbnail(url=target.avatar)

panel.set_author(name=target.display_name)
panel.add_field(name='ID', value=target.id)
panel.add_field(name='Bot', value=target.bot)

panel.add_field(name='Created at', value=target.created_at.strftime("%d/%m/%Y %H:%M:%S"), inline=False)
if hasattr(target, 'joined_at'):
    panel.add_field(name='Joined at', value=target.joined_at.strftime("%d/%m/%Y %H:%M:%S"))

await ctx.send(embed=panel)
Clone this wiki locally