Files
xavier 2ea18701b5
Build and Push Docker Image / build-and-push (push) Successful in 1m45s
Test : Intégration bouton PayPal Sandbox et activation du Serveur Mail
2026-08-23 09:47:14 +02:00

24 lines
865 B
Python

import os
import json
import time
BASE_DIR = "/DATA/AppData/MULTI-IA-AETHAS38"
os.makedirs(BASE_DIR, exist_ok=True)
HISTORY_FILE = os.path.join(BASE_DIR, "aethas_history.json")
def load_history():
if not os.path.exists(HISTORY_FILE):
with open(HISTORY_FILE, 'w', encoding='utf-8') as f: json.dump({}, f)
with open(HISTORY_FILE, 'r', encoding='utf-8') as f: return json.load(f)
def save_history(history):
with open(HISTORY_FILE, 'w', encoding='utf-8') as f: json.dump(history, f, indent=4)
def nettoyer_vieilles_discussions():
history = load_history()
now = time.time()
un_an = 365 * 24 * 60 * 60
a_supprimer = [cid for cid, data in history.items() if not data.get('pinned', False) and now - data.get('timestamp', now) > un_an]
if a_supprimer:
for cid in a_supprimer: del history[cid]
save_history(history)