Answer the question
In order to leave comments, you need to log in
Mention a person via discord.py?
Good day! I apologize in advance, but I'm probably too blind to find a solution to this problem. The fact is that, as I understand it, there was an update to discrod.py sometime there and now my bot cannot display the person's name. Please help and tell me what needs to be fixed?
I don’t throw off all the code, since everything is standard there, the problem appears in this line:
author = bot.get_user(my_user_id)
await message_channel.send(f'@{author} - Welcome back!')
Answer the question
In order to leave comments, you need to log in
Make sure you are passing in get_user
ID in int
.
author = bot.get_user(int(my_user_id))
await message_channel.send(f'{author.mention} - Welcome back!')
get_user
gets data from the bot's cache, and intents are needed to fill it await message_channel.send(f'<@{my_user_id}> - Welcome back!')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question