Fixed some paths

This commit is contained in:
Profitroll 2023-01-04 13:31:42 +01:00
parent 8cb3ef283b
commit 083281e784

View File

@ -22,7 +22,7 @@ if configGet("enabled", "scheduler", "cache_members"):
async for member in app.get_chat_members(configGet("destination_group")): async for member in app.get_chat_members(configGet("destination_group")):
list_of_users.append(member.user.id) list_of_users.append(member.user.id)
makedirs("cache", exist_ok=True) makedirs("cache", exist_ok=True)
jsonSave(list_of_users, f"cache{sep}group_members") jsonSave(list_of_users, path.join(configGet("cache", "locations"), "group_members"))
if configGet("enabled", "scheduler", "cache_admins"): if configGet("enabled", "scheduler", "cache_admins"):
@scheduler.scheduled_job(trigger="interval", seconds=configGet("interval", "scheduler", "cache_admins")) @scheduler.scheduled_job(trigger="interval", seconds=configGet("interval", "scheduler", "cache_admins"))
@ -31,7 +31,7 @@ if configGet("enabled", "scheduler", "cache_admins"):
async for member in app.get_chat_members(configGet("admin_group")): async for member in app.get_chat_members(configGet("admin_group")):
list_of_users.append(member.user.id) list_of_users.append(member.user.id)
makedirs("cache", exist_ok=True) makedirs("cache", exist_ok=True)
jsonSave(list_of_users, f"cache{sep}admins") jsonSave(list_of_users, path.join(configGet("cache", "locations"), "admins"))
# Cache the avatars of group members # Cache the avatars of group members
if configGet("enabled", "scheduler", "cache_avatars"): if configGet("enabled", "scheduler", "cache_avatars"):
@ -45,7 +45,7 @@ if configGet("enabled", "scheduler", "cache_avatars"):
if user.photo != None: if user.photo != None:
if not path.exists(f'{configGet("cache", "locations")}{sep}avatars{sep}{user.photo.big_file_id}'): if not path.exists(f'{configGet("cache", "locations")}{sep}avatars{sep}{user.photo.big_file_id}'):
print(f'Pre-cached avatar {user.photo.big_file_id} of {user.id}', flush=True) print(f'Pre-cached avatar {user.photo.big_file_id} of {user.id}', flush=True)
await app.download_media(user.photo.big_file_id, file_name=f'{configGet("cache", "locations")}{sep}avatars{sep}{user.photo.big_file_id}') await app.download_media(user.photo.big_file_id, file_name=path.join(configGet("cache", "locations"), "avatars", user.photo.big_file_id))
logWrite("Avatars caching performed") logWrite("Avatars caching performed")