mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-10-30 23:47:33 +03:00 
			
		
		
		
	Return deleted count from delete_messages
This commit is contained in:
		
							parent
							
								
									d81ebe92f7
								
							
						
					
					
						commit
						b3c23e343a
					
				|  | @ -13,7 +13,7 @@ good chance you were not relying on this to begin with". | |||
| **Please read this document in full before upgrading your code to Telethon 2.0.** | ||||
| 
 | ||||
| 
 | ||||
| Pyhton 3.5 is no longer supported | ||||
| Python 3.5 is no longer supported | ||||
| --------------------------------- | ||||
| 
 | ||||
| The library will no longer attempt to support Python 3.5. The minimum version is now Python 3.6. | ||||
|  | @ -218,6 +218,14 @@ your handlers much more easily. | |||
| // TODO provide standalone alternative for this? | ||||
| 
 | ||||
| 
 | ||||
| Deleting messages now returns a more useful value | ||||
| ------------------------------------------------- | ||||
| 
 | ||||
| It used to return a list of :tl:`messages.affectedMessages` which I expect very little people were | ||||
| actually using. Now it returns an ``int`` value indicating the number of messages that did exist | ||||
| and were deleted. | ||||
| 
 | ||||
| 
 | ||||
| The aggressive parameter hack has been removed | ||||
| ---------------------------------------------- | ||||
| 
 | ||||
|  |  | |||
|  | @ -644,11 +644,13 @@ async def delete_messages( | |||
|         ty = helpers._EntityType.USER | ||||
| 
 | ||||
|     if ty == helpers._EntityType.CHANNEL: | ||||
|         return await self([_tl.fn.channels.DeleteMessages( | ||||
|                         entity, list(c)) for c in utils.chunks(message_ids)]) | ||||
|         res = await self([_tl.fn.channels.DeleteMessages( | ||||
|                 entity, list(c)) for c in utils.chunks(message_ids)]) | ||||
|     else: | ||||
|         return await self([_tl.fn.messages.DeleteMessages( | ||||
|                         list(c), revoke) for c in utils.chunks(message_ids)]) | ||||
|         res = await self([_tl.fn.messages.DeleteMessages( | ||||
|             list(c), revoke) for c in utils.chunks(message_ids)]) | ||||
| 
 | ||||
|     return sum(r.pts_count for r in res) | ||||
| 
 | ||||
| async def send_read_acknowledge( | ||||
|         self: 'TelegramClient', | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user