2021-12-06 04:46:52 +01:00
|
|
|
#!/usr/bin/python3
|
2022-01-02 04:23:43 +01:00
|
|
|
import sys
|
|
|
|
sys.path.append("/var/telelog")
|
2021-12-06 04:46:52 +01:00
|
|
|
from telethon.sync import TelegramClient
|
|
|
|
from config import *
|
|
|
|
|
|
|
|
from telethon.tl.types import User
|
|
|
|
|
2022-01-02 04:23:43 +01:00
|
|
|
with TelegramClient('/var/telelog/log', api_id, api_hash) as client:
|
2021-12-06 04:46:52 +01:00
|
|
|
for dialog in client.iter_dialogs():
|
|
|
|
entity = dialog.entity
|
|
|
|
if isinstance(entity, User):
|
2022-01-02 04:23:43 +01:00
|
|
|
f = open(f'/var/telelog/logs/{dialog.id}', "a")
|
2021-12-06 04:46:52 +01:00
|
|
|
f.write("Message history for " + str(dialog.id) + ":\n")
|
|
|
|
f.close()
|