mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-10-31 07:57:38 +03:00 
			
		
		
		
	Improve edit_message message type hint
This also allows utils.get_message_id to get the ID of InputMessageID.
This commit is contained in:
		
							parent
							
								
									792adb78b3
								
							
						
					
					
						commit
						455acc43f6
					
				|  | @ -1066,7 +1066,7 @@ class MessageMethods: | |||
|     async def edit_message( | ||||
|             self: 'TelegramClient', | ||||
|             entity: 'typing.Union[hints.EntityLike, types.Message]', | ||||
|             message: 'hints.MessageLike' = None, | ||||
|             message: 'typing.Union[int, types.Message, types.InputMessageID, str]' = None, | ||||
|             text: str = None, | ||||
|             *, | ||||
|             parse_mode: str = (), | ||||
|  | @ -1096,7 +1096,7 @@ class MessageMethods: | |||
|                 which is the only way to edit messages that were sent | ||||
|                 after the user selects an inline query result. | ||||
| 
 | ||||
|             message (`int` | `Message <telethon.tl.custom.message.Message>` | `str`): | ||||
|             message (`int` | `Message <telethon.tl.custom.message.Message>` | :tl:`InputMessageID` | `str`): | ||||
|                 The ID of the message (or `Message | ||||
|                 <telethon.tl.custom.message.Message>` itself) to be edited. | ||||
|                 If the `entity` was a `Message | ||||
|  |  | |||
|  | @ -600,6 +600,9 @@ def get_message_id(message): | |||
|     if isinstance(message, int): | ||||
|         return message | ||||
| 
 | ||||
|     if isinstance(message, types.InputMessageID): | ||||
|         return message.id | ||||
| 
 | ||||
|     try: | ||||
|         if message.SUBCLASS_OF_ID == 0x790009e3: | ||||
|             # hex(crc32(b'Message')) = 0x790009e3 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user