2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Use __name__ instead of .split(".")[-1]

This commit is contained in:
Dan 2018-05-02 00:36:39 +02:00
parent f29b8bb7e4
commit 3d3c1e2c0e

View File

@ -72,11 +72,12 @@ class Encoder(JSONEncoder):
else:
return repr(o)
name = o.__class__.__name__
o = objects.get(getattr(o, "ID", None), None)
if o is not None:
if o.startswith("pyrogram.client"):
r = remove_none(OrderedDict([("_", o.split(".")[-1])] + [i for i in content.items()]))
r = remove_none(OrderedDict([("_", name)] + [i for i in content.items()]))
r.pop("client", None)
return r