Add ThreadABC helper, that'll contain functions that threads can call

This commit is contained in:
Mads Marquart
2020-01-09 00:35:43 +01:00
parent 4199439e07
commit 152f20027a
7 changed files with 80 additions and 34 deletions

View File

@@ -108,11 +108,6 @@ class Client:
FETCH METHODS
"""
def _forced_fetch(self, thread_id, mid):
params = {"thread_and_message_id": {"thread_id": thread_id, "message_id": mid}}
(j,) = self.graphql_requests(_graphql.from_doc_id("1768656253222505", params))
return j
def fetch_threads(self, thread_location, before=None, after=None, limit=None):
"""Fetch all threads in ``thread_location``.
@@ -1820,7 +1815,8 @@ class Client:
self.on_unknown_messsage_type(msg=m)
else:
thread_id = str(delta["threadKey"]["threadFbId"])
fetch_info = self._forced_fetch(thread_id, mid)
thread = Thread(session=self.session, id=thread_id)
fetch_info = thread._forced_fetch(mid)
fetch_data = fetch_info["message"]
author_id = fetch_data["message_sender"]["id"]
at = _util.millis_to_datetime(int(fetch_data["timestamp_precise"]))