|
| 1 | +import discord |
| 2 | +from discord.ext import commands |
| 3 | + |
| 4 | +intents = discord.Intents.default() |
| 5 | +intents.members = True |
| 6 | + |
| 7 | +bot = commands.Bot(command_prefix='+', intents=intents) |
| 8 | + |
| 9 | +@bot.tree.command(name="userinfo", description="Mostra informações de um usuário") |
| 10 | +async def userinfo(interaction: discord.Interaction, membro: discord.Member = None): |
| 11 | + if membro is None: |
| 12 | + membro = interaction.user |
| 13 | + |
| 14 | + joined = membro.joined_at.strftime("%d/%m/%Y %H:%M:%S") if membro.joined_at else "Indisponível" |
| 15 | + created = membro.created_at.strftime("%d/%m/%Y %H:%M:%S") |
| 16 | + top_role = membro.top_role.mention if membro.top_role != interaction.guild.default_role else "Nenhum" |
| 17 | + roles = [r.mention for r in membro.roles if r != interaction.guild.default_role] |
| 18 | + roles_str = ", ".join(roles[:10]) + (" ..." if len(roles) > 10 else "") |
| 19 | + |
| 20 | + embed = discord.Embed( |
| 21 | + title=f"👤 {membro.display_name}", |
| 22 | + description=f"Tag: **{membro}**", |
| 23 | + color=discord.Color.blurple() |
| 24 | + ) |
| 25 | + embed.set_thumbnail(url=membro.display_avatar.url) |
| 26 | + embed.add_field(name="🤖 Bot?", value="Sim" if membro.bot else "Não", inline=True) |
| 27 | + embed.add_field(name="📅 Conta criada", value=created, inline=False) |
| 28 | + embed.add_field(name="📥 Entrou no servidor", value=joined, inline=False) |
| 29 | + embed.add_field(name="🏷️ Top cargo", value=top_role, inline=True) |
| 30 | + embed.add_field(name=f"🎭 Cargos ({len(roles)})", value=roles_str or "Nenhum", inline=False) |
| 31 | + |
| 32 | + await interaction.response.send_message(embed=embed) |
0 commit comments