mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 13:25:19 +00:00
Merge pull request #53 from marcogll/feature/system-stabilization-audit-12843995660965804010
Feature/system stabilization audit 12843995660965804010
This commit is contained in:
@@ -18,7 +18,8 @@ ADMIN_ID = os.getenv("TELEGRAM_OWNER_CHAT_ID") # Renamed for consistency in the
|
|||||||
GOOGLE_SERVICE_ACCOUNT_FILE = os.getenv("GOOGLE_SERVICE_ACCOUNT_FILE")
|
GOOGLE_SERVICE_ACCOUNT_FILE = os.getenv("GOOGLE_SERVICE_ACCOUNT_FILE")
|
||||||
if GOOGLE_SERVICE_ACCOUNT_FILE and not os.path.isabs(GOOGLE_SERVICE_ACCOUNT_FILE):
|
if GOOGLE_SERVICE_ACCOUNT_FILE and not os.path.isabs(GOOGLE_SERVICE_ACCOUNT_FILE):
|
||||||
GOOGLE_SERVICE_ACCOUNT_FILE = str(Path(__file__).parent.parent / GOOGLE_SERVICE_ACCOUNT_FILE)
|
GOOGLE_SERVICE_ACCOUNT_FILE = str(Path(__file__).parent.parent / GOOGLE_SERVICE_ACCOUNT_FILE)
|
||||||
CALENDAR_ID = os.getenv("GOOGLE_CALENDAR_ID")
|
WORK_GOOGLE_CALENDAR_ID = os.getenv("WORK_GOOGLE_CALENDAR_ID")
|
||||||
|
PERSONAL_GOOGLE_CALENDAR_ID = os.getenv("PERSONAL_GOOGLE_CALENDAR_ID")
|
||||||
|
|
||||||
# --- Webhooks (n8n) ---
|
# --- Webhooks (n8n) ---
|
||||||
N8N_WEBHOOK_URL = os.getenv("N8N_WEBHOOK_URL")
|
N8N_WEBHOOK_URL = os.getenv("N8N_WEBHOOK_URL")
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import logging
|
|||||||
from google.oauth2 import service_account
|
from google.oauth2 import service_account
|
||||||
from googleapiclient.discovery import build
|
from googleapiclient.discovery import build
|
||||||
from googleapiclient.errors import HttpError
|
from googleapiclient.errors import HttpError
|
||||||
from talia_bot.config import GOOGLE_SERVICE_ACCOUNT_FILE, CALENDAR_ID
|
from talia_bot.config import GOOGLE_SERVICE_ACCOUNT_FILE, WORK_GOOGLE_CALENDAR_ID
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ service = build("calendar", "v3", credentials=creds)
|
|||||||
|
|
||||||
|
|
||||||
def get_available_slots(
|
def get_available_slots(
|
||||||
start_time, end_time, duration_minutes=30, calendar_id=CALENDAR_ID
|
start_time, end_time, duration_minutes=30, calendar_id=WORK_GOOGLE_CALENDAR_ID
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Busca espacios disponibles en el calendario dentro de un rango de tiempo.
|
Busca espacios disponibles en el calendario dentro de un rango de tiempo.
|
||||||
@@ -84,7 +84,7 @@ def get_available_slots(
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def create_event(summary, start_time, end_time, attendees, calendar_id=CALENDAR_ID):
|
def create_event(summary, start_time, end_time, attendees, calendar_id=WORK_GOOGLE_CALENDAR_ID):
|
||||||
"""
|
"""
|
||||||
Crea un nuevo evento (cita) en el calendario.
|
Crea un nuevo evento (cita) en el calendario.
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ def create_event(summary, start_time, end_time, attendees, calendar_id=CALENDAR_
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_events(start_time, end_time, calendar_id=CALENDAR_ID):
|
def get_events(start_time, end_time, calendar_id=WORK_GOOGLE_CALENDAR_ID):
|
||||||
"""
|
"""
|
||||||
Obtiene la lista de eventos entre dos momentos.
|
Obtiene la lista de eventos entre dos momentos.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user