H
H
howuu2019-10-02 19:54:52
Python
howuu, 2019-10-02 19:54:52

Telebot username = None?

I use pyTelegrambotApi , In general, in the logic of my bot, I need to use the username of the user, I add new users to the sqlite database and take their username, via message.from_user.username, but once in a while, new users come and save their chat id, but username becomes None, why does this happen, these people do not have a username or it is closed for display and my bot does not see it, or what can be here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DaZy4, 2020-03-16
@DaZy4

I think that users simply do not set username, so it's better for you to save both first_name and last_name in the database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question