I want to create a command using id from pinged user and the return id like that : <@696986678887317556>
and i want it : 696986678887317556
, so i have coding this :
@bot.command() @commands.has_permissions(administrator=True) async def autp(ctx, name): print(name) name = str(name) nachar = ["@", "<", ">"] for x in nachar: id = name.replace(x, '') print(id)
And the result are this :
<@696986678887317556
how i can code it pls ðŸ˜
Advertisement
Answer
The mentioned user will be in ctx.message.mentions
so loop that or get the first item in the list, and you will find the first mention with also the id that doesen’t contained special characters.