From b4f3a06ee51c7271d37fa5eed5d4277b99d29464 Mon Sep 17 00:00:00 2001 From: blank X Date: Tue, 9 Nov 2021 11:36:36 +0700 Subject: [PATCH] Resolve IDs passed to .id --- sukuinote/plugins/info.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sukuinote/plugins/info.py b/sukuinote/plugins/info.py index 54d0353..1f26a98 100644 --- a/sukuinote/plugins/info.py +++ b/sukuinote/plugins/info.py @@ -117,6 +117,25 @@ async def id(client, message): text += f' {reply.forward_from.id}\n' text_unping += text text_ping += f'\nForwarded User ID: {reply.forward_from.id}\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'{html.escape(i)}: Unknown\n' + text_ping += f'{html.escape(i)}: Unknown\n' + else: + if entity.username: + text_unping += f'{html.escape(i)}: {entity.id}\n' + else: + text_unping += f'{html.escape(i)}: {entity.id}\n' + if entity.type == 'private': + text_ping += f'{html.escape(i)}: {entity.id}\n' + elif entity.username: + text_ping += f'{html.escape(i)}: {entity.id}\n' + else: + text_ping += f'{html.escape(i)}: {entity.id}\n' reply = await message.reply_text(text_unping, disable_web_page_preview=True) if text_unping != text_ping: await reply.edit_text(text_ping, disable_web_page_preview=True) @@ -126,4 +145,4 @@ help_dict['info'] = ('Info', {prefix}info (as reply to message) - Get entity info of replied user Aliases: {prefix}whois -{prefix}id [maybe reply to message] - Gets IDs''') +{prefix}id [maybe reply to message] [entities]... - Gets IDs''')