mirror of
https://github.com/gentoo-root/telegram-tracker
synced 2025-08-19 13:00:45 -07:00
traker: Update I/O to add people names
This commit is contained in:
parent
03348d571f
commit
0110871b37
1 changed files with 7 additions and 1 deletions
|
@ -28,7 +28,6 @@ from time import mktime, sleep
|
|||
|
||||
import telethon.sync
|
||||
|
||||
|
||||
DATETIME_FORMAT = '%Y-%m-%d @ %H:%M:%S'
|
||||
|
||||
|
||||
|
@ -51,6 +50,8 @@ dataFile = open('shuTimes.txt', 'a+')
|
|||
|
||||
online = None
|
||||
last_offline = None
|
||||
|
||||
printName=True
|
||||
while True:
|
||||
try:
|
||||
dataFile = open('trackerLogs.txt', 'a+', encoding = 'utf-8')
|
||||
|
@ -60,6 +61,10 @@ while True:
|
|||
contact = client.get_me()
|
||||
else:
|
||||
contact = client.get_entity(contact_id)
|
||||
user = contact.first_name+' '+contact.last_name
|
||||
if printName==True:
|
||||
print(user, file=dataFile)
|
||||
print(user)
|
||||
|
||||
if isinstance(contact.status, UserStatusOffline):
|
||||
if online != False:
|
||||
|
@ -86,5 +91,6 @@ while True:
|
|||
print(f'~{datetime.now().strftime(DATETIME_FORMAT)}: User went offline.')
|
||||
last_offline = None
|
||||
sleep(15)
|
||||
printName=False
|
||||
finally:
|
||||
dataFile.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue