Skip to content

Commit

Permalink
Merge branch 'master' into visual-config
Browse files Browse the repository at this point in the history
  • Loading branch information
stijn-uva committed Aug 22, 2023
2 parents e50ee17 + b3f0097 commit bf872d3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions datasources/telegram/search_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ async def resolve_groups(self, client, message):
self.details_cache[value["user_id"]] = SearchTelegram.serialize_obj(user)

resolved_message[key] = self.details_cache[value["user_id"]]
resolved_message[key]["user_id"] = value["user_id"]
else:
resolved_message[key] = await self.resolve_groups(client, value)

Expand Down Expand Up @@ -675,24 +676,19 @@ def serialize_obj(input_obj):
mapped_obj[item] = value.timestamp()
elif type(value).__module__ in ("telethon.tl.types", "telethon.tl.custom.forward"):
mapped_obj[item] = SearchTelegram.serialize_obj(value)
if type(obj[item]) is not dict:
mapped_obj[item]["_type"] = type(value).__name__
elif type(value) is list:
mapped_obj[item] = [SearchTelegram.serialize_obj(item) for item in value]
elif type(value).__module__[0:8] == "telethon":
# some type of internal telethon struct
continue
elif type(value) is bytes:
mapped_obj[item] = value.hex()
elif type(value) not in scalars and value is not None:
# type we can't make sense of here
continue
elif type(value) is dict:
for key, vvalue in value:
mapped_obj[item][key] = SearchTelegram.serialize_obj(vvalue)
else:
mapped_obj[item] = value

# Add the _type if the original object was a telethon type
if type(input_obj).__module__ in ("telethon.tl.types", "telethon.tl.custom.forward"):
mapped_obj["_type"] = type(input_obj).__name__
return mapped_obj

@staticmethod
Expand Down

0 comments on commit bf872d3

Please sign in to comment.