Discord.py obtaining user ID from username

I have a discord.py code that needs to transfrom a username (example: duviz#0) to a user id.
How can I do that? I searched on google but I didn’t find anything

Okay I found the solution:

user = discord.utils.get(bot.users, name=USERNAME)

Leave a Comment