servii-backend/unit_test.py
2024-09-13 04:00:51 +02:00

43 lines
1.4 KiB
Python

import os
import shutil
from typing import Callable, Union
import firebase_manager
def ban_user(user_id: str):
try:
firebase_manager.auth.update_user(user_id, disabled=False)
print("Banned : " + user_id)
except Exception as e:
print("Error banning user " + user_id, "|", str(e), type(e).__name__)
def organize_minecraft_files(file_list: list[str], target_directory: str):
os.makedirs(target_directory, exist_ok=True)
for file_name in file_list:
if file_name.endswith('.jar'):
version = file_name.split('-')[1]
version_folder = os.path.join(target_directory, version)
os.makedirs(version_folder, exist_ok=True)
source_path = os.path.join(target_directory, file_name)
destination_path = os.path.join(version_folder, 'server.jar')
shutil.move(source_path, destination_path)
if __name__ == '__main__':
#ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
#file_manager.log_action("gqZN3eCHF3V2er3Py3rlgk8u2t83", "test", "DeleteServer")
#firebase_manager.set_servers_not_running()
#print(firebase_manager.get_server_field("secret :)", "AMITIE" ,"version"))
'''
organize_minecraft_files(
listdir("/home/hapso/Desktop/Personal/servii-backend/servers/paper"),
"/home/hapso/Desktop/Personal/servii-backend/servers/paper")
'''
pass