mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-10-31 07:57:38 +03:00 
			
		
		
		
	Fix voice notes default filename being "None - None.oga"
This commit is contained in:
		
							parent
							
								
									7f97997e8d
								
							
						
					
					
						commit
						3301bf3ff6
					
				|  | @ -1622,18 +1622,27 @@ class TelegramClient(TelegramBareClient): | ||||||
| 
 | 
 | ||||||
|         file_size = document.size |         file_size = document.size | ||||||
| 
 | 
 | ||||||
|  |         kind = 'document' | ||||||
|         possible_names = [] |         possible_names = [] | ||||||
|         for attr in document.attributes: |         for attr in document.attributes: | ||||||
|             if isinstance(attr, DocumentAttributeFilename): |             if isinstance(attr, DocumentAttributeFilename): | ||||||
|                 possible_names.insert(0, attr.file_name) |                 possible_names.insert(0, attr.file_name) | ||||||
| 
 | 
 | ||||||
|             elif isinstance(attr, DocumentAttributeAudio): |             elif isinstance(attr, DocumentAttributeAudio): | ||||||
|                 possible_names.append('{} - {}'.format( |                 kind = 'audio' | ||||||
|                     attr.performer, attr.title |                 if attr.performer and attr.title: | ||||||
|                 )) |                     possible_names.append('{} - {}'.format( | ||||||
|  |                         attr.performer, attr.title | ||||||
|  |                     )) | ||||||
|  |                 elif attr.performer: | ||||||
|  |                     possible_names.append(attr.performer) | ||||||
|  |                 elif attr.title: | ||||||
|  |                     possible_names.append(attr.title) | ||||||
|  |                 elif attr.voice: | ||||||
|  |                     kind = 'voice' | ||||||
| 
 | 
 | ||||||
|         file = self._get_proper_filename( |         file = self._get_proper_filename( | ||||||
|             file, 'document', utils.get_extension(document), |             file, kind, utils.get_extension(document), | ||||||
|             date=date, possible_names=possible_names |             date=date, possible_names=possible_names | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user