mirror of
https://github.com/gentoo-root/telegram-tracker
synced 2025-08-19 21:03:49 -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
|
import telethon.sync
|
||||||
|
|
||||||
|
|
||||||
DATETIME_FORMAT = '%Y-%m-%d @ %H:%M:%S'
|
DATETIME_FORMAT = '%Y-%m-%d @ %H:%M:%S'
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,6 +50,8 @@ dataFile = open('shuTimes.txt', 'a+')
|
||||||
|
|
||||||
online = None
|
online = None
|
||||||
last_offline = None
|
last_offline = None
|
||||||
|
|
||||||
|
printName=True
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
dataFile = open('trackerLogs.txt', 'a+', encoding = 'utf-8')
|
dataFile = open('trackerLogs.txt', 'a+', encoding = 'utf-8')
|
||||||
|
@ -60,6 +61,10 @@ while True:
|
||||||
contact = client.get_me()
|
contact = client.get_me()
|
||||||
else:
|
else:
|
||||||
contact = client.get_entity(contact_id)
|
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 isinstance(contact.status, UserStatusOffline):
|
||||||
if online != False:
|
if online != False:
|
||||||
|
@ -86,5 +91,6 @@ while True:
|
||||||
print(f'~{datetime.now().strftime(DATETIME_FORMAT)}: User went offline.')
|
print(f'~{datetime.now().strftime(DATETIME_FORMAT)}: User went offline.')
|
||||||
last_offline = None
|
last_offline = None
|
||||||
sleep(15)
|
sleep(15)
|
||||||
|
printName=False
|
||||||
finally:
|
finally:
|
||||||
dataFile.close()
|
dataFile.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue