There is a piece of code:
@bot.message_handler(func=lambda message: True, content_types=['sticker']) def handle_sticker(message): bot.delete_message(message.chat.id, message.message_id) bot.send_message(message.chat.id, text=("@{!s}, " + strings_data.get(get_language(message.from_user.language_code)).get("withoutstickers")).format(bot.get_chat_member(message.chat.id, message.from_user.id).user.username)) explanation - when receiving a sticker, the bot deletes it and sends a message like '@username, without stickers.' but there are users without a username and then it is accessed '@None'.
it is necessary to check for the presence of username, and in its absence - to return first_name. I know how to get username and first_name bot.get_chat_member(message.chat.id, message.from_user.id).user.username (or user.first_name )
but I don’t know how to attach a check. can you help?