mirror of
				https://github.com/cdryzun/tg_bot_collections.git
				synced 2025-11-04 16:56:43 +08:00 
			
		
		
		
	fix: 'NoneType' object has no attribute 'startswith'
This commit is contained in:
		@ -192,8 +192,12 @@ def latest_handle_messages(message: Message, bot: TeleBot):
 | 
				
			|||||||
    """ignore"""
 | 
					    """ignore"""
 | 
				
			||||||
    chat_id = message.chat.id
 | 
					    chat_id = message.chat.id
 | 
				
			||||||
    chat_user_id = message.from_user.id
 | 
					    chat_user_id = message.from_user.id
 | 
				
			||||||
 | 
					    # if not text, ignore
 | 
				
			||||||
 | 
					    if message.text is None:
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # if is bot command, ignore
 | 
					    # if is bot command, ignore
 | 
				
			||||||
    if message.text and message.text.startswith("/"):
 | 
					    if message.text.startswith("/"):
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    # start command ignore
 | 
					    # start command ignore
 | 
				
			||||||
    elif message.text.startswith(
 | 
					    elif message.text.startswith(
 | 
				
			||||||
@ -218,9 +222,6 @@ def latest_handle_messages(message: Message, bot: TeleBot):
 | 
				
			|||||||
    # answer_it command ignore
 | 
					    # answer_it command ignore
 | 
				
			||||||
    elif message.text.startswith("answer_it"):
 | 
					    elif message.text.startswith("answer_it"):
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    # if not text, ignore
 | 
					 | 
				
			||||||
    elif not message.text:
 | 
					 | 
				
			||||||
        return
 | 
					 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        if chat_user_dict.get(chat_user_id):
 | 
					        if chat_user_dict.get(chat_user_id):
 | 
				
			||||||
            message.text += chat_message_dict[chat_id].text
 | 
					            message.text += chat_message_dict[chat_id].text
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user