servii-backend/unit_test.py

45 lines
1.4 KiB
Python
Raw Normal View History

2024-09-11 02:15:56 +00:00
import os
import shutil
from typing import Callable, Union
2024-09-09 22:54:14 +00:00
import firebase_manager
import server_mc_manager
from generic_executor import mc_manager
def ban_user(user_id: str):
try:
firebase_manager.auth.update_user(user_id, disabled=False)
2024-08-15 08:49:41 +00:00
print("Banned : " + user_id)
except Exception as e:
2024-08-15 08:49:41 +00:00
print("Error banning user " + user_id, "|", str(e), type(e).__name__)
2024-08-11 09:02:10 +00:00
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")
2024-08-24 11:38:22 +00:00
#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")
'''S
pass