Add support for backfilling private chats
This commit is contained in:
@@ -315,5 +315,10 @@ async def backfill(evt: CommandEvent) -> None:
|
||||
try:
|
||||
await portal.backfill(evt.sender)
|
||||
except TakeoutInitDelayError:
|
||||
await evt.reply("Please accept the data export request from a mobile device, "
|
||||
"then re-run the backfill command.")
|
||||
msg = ("Please accept the data export request from a mobile device, "
|
||||
"then re-run the backfill command.")
|
||||
if portal.peer_type == "user":
|
||||
from mautrix.appservice import IntentAPI
|
||||
await portal.main_intent.send_notice(evt.room_id, msg)
|
||||
else:
|
||||
await evt.reply(msg)
|
||||
|
||||
@@ -361,6 +361,11 @@ class PortalTelegram(BasePortal, ABC):
|
||||
min_id = last.tgid if last else 0
|
||||
self.backfilling = True
|
||||
self.backfill_leave = set()
|
||||
if self.peer_type == "user":
|
||||
sender = p.Puppet.get(source.tgid)
|
||||
await self.main_intent.invite_user(self.mxid, sender.default_mxid)
|
||||
await sender.default_mxid_intent.join_room_by_id(self.mxid)
|
||||
self.backfill_leave.add(sender.default_mxid_intent)
|
||||
max_file_size = min(config["bridge.max_document_size"], 1500) * 1024 * 1024
|
||||
async with source.client.takeout(files=True, megagroups=self.megagroup,
|
||||
chats=self.peer_type == "chat",
|
||||
|
||||
Reference in New Issue
Block a user