Answer the question
In order to leave comments, you need to log in
How to make the bot display the username and not none?
If you write directly to the bot, then it gives out the username of the one who wrote to him, and when added to the group chat, it starts issuing @none
a = [f"На сегодня @{message.chat.username} лучший в мире", f"Оууу теперь @{message.chat.username} микро челик"]
b = random.choice(a)
bot.send_message(message.chat.id, b)
Answer the question
In order to leave comments, you need to log in
I advise you to change the library altogether, there are many disadvantages.
with regards to the problem, try it
usernames = message.from_user.username
(May not work, because I myself am sitting on pyrogram)
Check in the program itself, for example, through debugging, which in the case of a group chat is written in message.chat.username.
None most likely means that there is an empty value, that is, something should have been written to this variable, but it was not written.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question