Correction des multiples bugs

This commit is contained in:
Mathis 2026-05-01 16:16:33 +02:00
parent 5fe70d754b
commit 07198c20b7
15 changed files with 707 additions and 348 deletions

View file

@ -1,6 +1,7 @@
import discord
import json
import os
import asyncio
from datetime import datetime
from typing import Optional, Dict, List
from src.logger import kuby_logger

View file

@ -63,7 +63,7 @@ class KubyLogger:
def _load_reported_errors(self):
if os.path.exists(REPORTED_ERRORS_FILE):
try:
with open(REPORTED_ERRORS_FILE, "r") as f:
with open(REPORTED_ERRORS_FILE, "r", encoding="utf-8") as f:
return json.load(f)
except Exception as e:
print(f"Error loading reported errors: {e}")
@ -72,8 +72,10 @@ class KubyLogger:
def _save_reported_errors(self):
try:
os.makedirs(os.path.dirname(REPORTED_ERRORS_FILE), exist_ok=True)
with open(REPORTED_ERRORS_FILE, "w") as f:
temp_file = f"{REPORTED_ERRORS_FILE}.tmp"
with open(temp_file, "w", encoding="utf-8") as f:
json.dump(self.last_errors, f, indent=4)
os.replace(temp_file, REPORTED_ERRORS_FILE)
except Exception as e:
print(f"Error saving reported errors: {e}")