Add support for backfilling private chats
This commit is contained in:
@@ -315,5 +315,10 @@ async def backfill(evt: CommandEvent) -> None:
|
|||||||
try:
|
try:
|
||||||
await portal.backfill(evt.sender)
|
await portal.backfill(evt.sender)
|
||||||
except TakeoutInitDelayError:
|
except TakeoutInitDelayError:
|
||||||
await evt.reply("Please accept the data export request from a mobile device, "
|
msg = ("Please accept the data export request from a mobile device, "
|
||||||
"then re-run the backfill command.")
|
"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
|
min_id = last.tgid if last else 0
|
||||||
self.backfilling = True
|
self.backfilling = True
|
||||||
self.backfill_leave = set()
|
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
|
max_file_size = min(config["bridge.max_document_size"], 1500) * 1024 * 1024
|
||||||
async with source.client.takeout(files=True, megagroups=self.megagroup,
|
async with source.client.takeout(files=True, megagroups=self.megagroup,
|
||||||
chats=self.peer_type == "chat",
|
chats=self.peer_type == "chat",
|
||||||
|
|||||||
Reference in New Issue
Block a user