Answer the question
In order to leave comments, you need to log in
It is necessary for the bot to brother the username through the id. That's what happened, what needs to be fixed?
elif message.text == '123' or message.text == '1245':
m = message.from_user.username(user_id = 1616641932)
bot.reply_to(message, 'Yes, @'+ m + ' is he?')
Error:
m = message.from_user.username(user_id = 1616641932)
TypeError: 'str' object is not callable
Answer the question
In order to leave comments, you need to log in
message.from_user.username is not a method, no arguments are given to it. It will give you the username of the person whose message was triggered by this handler.
name = message.from_user.username #или
name = message.from_user.full_name
lang = message.from_user.locale
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question