From 9f5eee1420433479978968ddf65194ae5cfa925e Mon Sep 17 00:00:00 2001 From: Dan Elkouby Date: Tue, 28 Aug 2018 10:16:17 +0000 Subject: [PATCH] @Lonami scolded me --- stdplugins/who.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/stdplugins/who.py b/stdplugins/who.py index 0e1ebc3..309008f 100644 --- a/stdplugins/who.py +++ b/stdplugins/who.py @@ -3,6 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from telethon import events +from telethon import utils from telethon.tl import types @@ -16,14 +17,9 @@ async def _(event): who = await borg.get_entity( msg.forward.from_id or msg.forward.channel_id) else: - who = await borg.get_entity(msg.from_id) + who = await msg.get_sender() - if isinstance(who, types.User): - who_string = who.first_name - if who.last_name: - who_string += f" {who.last_name}" - else: - who_string = who.title + who_string = utils.get_display_name(who) if isinstance(who, (types.User, types.Channel)) and who.username: who_string += f" (@{who.username})" who_string += f", #{who.id}"