Resolve IDs passed to .id
This commit is contained in:
		
							parent
							
								
									7f091ce6c9
								
							
						
					
					
						commit
						b4f3a06ee5
					
				|  | @ -117,6 +117,25 @@ async def id(client, message): | ||||||
|             text += f' <code>{reply.forward_from.id}</code>\n' |             text += f' <code>{reply.forward_from.id}</code>\n' | ||||||
|             text_unping += text |             text_unping += text | ||||||
|             text_ping += f'\n<b><a href="tg://user?id={reply.forward_from.id}">Forwarded User ID:</a></b> <code>{reply.forward_from.id}</code>\n' |             text_ping += f'\n<b><a href="tg://user?id={reply.forward_from.id}">Forwarded User ID:</a></b> <code>{reply.forward_from.id}</code>\n' | ||||||
|  |     text_unping += '\n' | ||||||
|  |     text_ping += '\n' | ||||||
|  |     for i in message.command[1:]: | ||||||
|  |         try: | ||||||
|  |             entity, entity_client = await get_entity(client, i) | ||||||
|  |         except Exception as ex: | ||||||
|  |             text_unping += f'<b>{html.escape(i)}:</b> Unknown\n' | ||||||
|  |             text_ping += f'<b>{html.escape(i)}:</b> Unknown\n' | ||||||
|  |         else: | ||||||
|  |             if entity.username: | ||||||
|  |                 text_unping += f'<b><a href="https://t.me/{entity.username}">{html.escape(i)}:</a></b> <code>{entity.id}</code>\n' | ||||||
|  |             else: | ||||||
|  |                 text_unping += f'<b>{html.escape(i)}:</b> <code>{entity.id}</code>\n' | ||||||
|  |             if entity.type == 'private': | ||||||
|  |                 text_ping += f'<b><a href="tg://user?id={entity.id}">{html.escape(i)}:</a></b> <code>{entity.id}</code>\n' | ||||||
|  |             elif entity.username: | ||||||
|  |                 text_ping += f'<b><a href="https://t.me/{entity.username}">{html.escape(i)}:</a></b> <code>{entity.id}</code>\n' | ||||||
|  |             else: | ||||||
|  |                 text_ping += f'<b>{html.escape(i)}:</b> <code>{entity.id}</code>\n' | ||||||
|     reply = await message.reply_text(text_unping, disable_web_page_preview=True) |     reply = await message.reply_text(text_unping, disable_web_page_preview=True) | ||||||
|     if text_unping != text_ping: |     if text_unping != text_ping: | ||||||
|         await reply.edit_text(text_ping, disable_web_page_preview=True) |         await reply.edit_text(text_ping, disable_web_page_preview=True) | ||||||
|  | @ -126,4 +145,4 @@ help_dict['info'] = ('Info', | ||||||
| {prefix}info <i>(as reply to message)</i> - Get entity info of replied user | {prefix}info <i>(as reply to message)</i> - Get entity info of replied user | ||||||
| Aliases: {prefix}whois | Aliases: {prefix}whois | ||||||
| 
 | 
 | ||||||
| {prefix}id <i>[maybe reply to message]</i> - Gets IDs''') | {prefix}id <i>[maybe reply to message]</i> <i>[entities]...</i> - Gets IDs''') | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue