mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
Merge pull request #39 from marcogll/feat/cleanup-and-refactor-15004564199648452045l
chore: Remove obsolete test scripts and documentation
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
import datetime
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Add app directory to path
|
|
||||||
sys.path.append(os.path.join(os.getcwd(), 'talia_bot'))
|
|
||||||
|
|
||||||
from modules.calendar import get_events
|
|
||||||
from config import CALENDAR_ID
|
|
||||||
|
|
||||||
def test_get_events():
|
|
||||||
print(f"Testing with CALENDAR_ID: {CALENDAR_ID}")
|
|
||||||
now = datetime.datetime.now(datetime.timezone.utc)
|
|
||||||
start_of_day = now.replace(hour=0, minute=0, second=0, microsecond=0)
|
|
||||||
end_of_day = start_of_day + datetime.timedelta(days=1)
|
|
||||||
|
|
||||||
print(f"Fetching events from {start_of_day.isoformat()} to {end_of_day.isoformat()}...")
|
|
||||||
try:
|
|
||||||
events = get_events(start_of_day, end_of_day)
|
|
||||||
print(f"Found {len(events)} events.")
|
|
||||||
for event in events:
|
|
||||||
print(f"- {event.get('summary')} at {event['start'].get('dateTime', event['start'].get('date'))}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error: {e}")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test_get_events()
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
import os
|
|
||||||
import requests
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Cargar variables de entorno
|
|
||||||
load_dotenv()
|
|
||||||
|
|
||||||
VIKUNJA_API_URL = os.getenv("VIKUNJA_API_URL", "https://tasks.soul23.cloud/api/v1")
|
|
||||||
VIKUNJA_API_TOKEN = os.getenv("VIKUNJA_API_TOKEN")
|
|
||||||
|
|
||||||
def test_vikunja_connection():
|
|
||||||
if not VIKUNJA_API_TOKEN:
|
|
||||||
print("Error: VIKUNJA_API_TOKEN no configurado en .env")
|
|
||||||
return
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"Authorization": f"Bearer {VIKUNJA_API_TOKEN}",
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
print(f"Probando conexión a Vikunja: {VIKUNJA_API_URL}")
|
|
||||||
try:
|
|
||||||
# Intentar obtener información del usuario actual para validar el token
|
|
||||||
response = requests.get(f"{VIKUNJA_API_URL}/user", headers=headers)
|
|
||||||
if response.status_code == 200:
|
|
||||||
user_data = response.json()
|
|
||||||
print(f"¡Conexión exitosa! Usuario: {user_data.get('username')}")
|
|
||||||
else:
|
|
||||||
print(f"Error de conexión: {response.status_code} - {response.text}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error durante la prueba: {e}")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test_vikunja_connection()
|
|
||||||
35
vikunja.md
35
vikunja.md
@@ -1,35 +0,0 @@
|
|||||||
# Vikunja Integration Flow (/vik)
|
|
||||||
|
|
||||||
## Objective
|
|
||||||
|
|
||||||
Implement a temporary flow controlled by the `/vik` command to manage tasks in Vikunja (https://tasks.soul23.cloud). This flow is exclusive to the Admin/Owner.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **View Tasks**: List current tasks from Vikunja.
|
|
||||||
- **Add Task**: Remote task creation.
|
|
||||||
- **Edit Task**: Basic task modification.
|
|
||||||
|
|
||||||
## Technical Requirements
|
|
||||||
|
|
||||||
- **API Base**: `https://tasks.soul23.cloud/api/v1`
|
|
||||||
- **Authentication**: Bearer Token (to be configured in `.env`).
|
|
||||||
- **Access Control**: Only the Admin/Owner can trigger this flow.
|
|
||||||
|
|
||||||
## Webhook Fallback Logic
|
|
||||||
|
|
||||||
The system should implement a dual-webhook strategy:
|
|
||||||
|
|
||||||
1. **Primary**: `N8N_WEBHOOK_URL` (Normal/Production).
|
|
||||||
2. **Fallback**: `N8N_TEST_WEBHOOK_URL` (Test/Development).
|
|
||||||
|
|
||||||
If the primary webhook fails or is not configured, the system must attempt to use the fallback.
|
|
||||||
|
|
||||||
## Project Webhooks
|
|
||||||
|
|
||||||
Vikunja supports sending webhooks per project. This can be used to notify the bot (via n8n) when tasks are created or updated directly in the Vikunja interface, keeping the bot's context in sync.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> This document serves as a specification for the development of the Vikunja module.
|
|
||||||
Reference in New Issue
Block a user