mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-10-31 16:07:44 +03:00 
			
		
		
		
	Implement __bytes__ and use count instead sum
This commit is contained in:
		
							parent
							
								
									2191fbf30b
								
							
						
					
					
						commit
						9db9d1ed5c
					
				|  | @ -50,6 +50,9 @@ class Message: | |||
|     def __repr__(self): | ||||
|         return repr(self.original_message) | ||||
| 
 | ||||
|     def __bytes__(self): | ||||
|         return bytes(self.original_message) | ||||
| 
 | ||||
|     @property | ||||
|     def client(self): | ||||
|         return self._client | ||||
|  | @ -296,7 +299,7 @@ class Message: | |||
|                 returns ``True``. The callable should accept a single | ||||
|                 `telethon.tl.custom.messagebutton.MessageButton` argument. | ||||
|         """ | ||||
|         if sum(int(x is not None) for x in (i, text, filter)) >= 2: | ||||
|         if (i, text, filter).count(None) >= 2: | ||||
|             raise ValueError('You can only set either of i, text or filter') | ||||
| 
 | ||||
|         if not self.buttons: | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user