core: harden the handling of received messages
This commit is contained in:
		
							parent
							
								
									79a307a7b5
								
							
						
					
					
						commit
						ec22c72afb
					
				
							
								
								
									
										6
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								main.py
									
									
									
									
									
								
							@ -319,12 +319,14 @@ def queue_processor():
 | 
			
		||||
def message_handler(update, context):
 | 
			
		||||
    global lock
 | 
			
		||||
    with lock:
 | 
			
		||||
        if update.message.text.__class__ == str and update.message.text.startswith("$"):
 | 
			
		||||
        if update.message and update.message.text.__class__ == str and update.message.text.startswith("$"):
 | 
			
		||||
            print("[DEBUG] Received new message with high priority")  # just for testing
 | 
			
		||||
            message_queue.insert(0, update.message)
 | 
			
		||||
        else:
 | 
			
		||||
        elif update.message:
 | 
			
		||||
            print("[DEBUG] Received new message")  # just for testing
 | 
			
		||||
            message_queue.append(update.message)
 | 
			
		||||
        else:
 | 
			
		||||
            print(f"[DEBUG] Received {update.message} instead of a message")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# --- Final stage ---
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user