forked from LonamiWebs/Telebackup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
42 lines (29 loc) · 1016 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from backuper import Backuper
from utils import create_client
import telethon.tl as tl
import re
def searchEntityByStr(client, sSearch):
chats = client(tl.functions.messages.GetAllChatsRequest([]))
r=re.compile('.*'+sSearch+'.*')
SubGrupo = (x for x in chats.chats if r.match(x.title))
return next(SubGrupo)
def main(client):
"""Main method"""
"""
entity = client.get_dialogs(1)[1][0]
backuper = Backuper(client, entity)
#backuper.start_backup()
backuper.start_media_backup(dl_propics=False,dl_photos=False,dl_docs=True,saveName=True)
"""
entity = searchEntityByStr(client,'.*') #Search Entity
backuper = Backuper(client, entity)
backuper.start_backup()
backuper.start_media_backup(dl_propics=False,dl_photos=False,dl_docs=True,saveName=True,filter=None)
if __name__ == '__main__':
client = None
try:
client = create_client()
main(client)
finally:
if client:
client.disconnect()