Fix crash on duplicate or out of order reactions.
Eventual consistency ftw
This commit is contained in:
		@@ -287,8 +287,11 @@ class ConnectionState:
 | 
				
			|||||||
            emoji = self._get_reaction_emoji(**data['emoji'])
 | 
					            emoji = self._get_reaction_emoji(**data['emoji'])
 | 
				
			||||||
            reaction = utils.get(message.reactions, emoji=emoji)
 | 
					            reaction = utils.get(message.reactions, emoji=emoji)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # if reaction isn't in the list, we crash. This means discord
 | 
					            # Eventual consistency means we can get out of order or duplicate removes.
 | 
				
			||||||
            # sent bad data, or we stored improperly
 | 
					            if not reaction:
 | 
				
			||||||
 | 
					                log.warning("Unexpected reaction remove {}".format(data))
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            reaction.count -= 1
 | 
					            reaction.count -= 1
 | 
				
			||||||
            if data['user_id'] == self.user.id:
 | 
					            if data['user_id'] == self.user.id:
 | 
				
			||||||
                reaction.me = False
 | 
					                reaction.me = False
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user