feat: Dockerize application and add MySQL logging

This commit introduces Docker and Docker Compose to containerize the application and orchestrate it with a MySQL database.

Key changes include:
- Added a `Dockerfile` to create a container for the Python bot.
- Created a `docker-compose.yml` file to manage the bot and MySQL services.
- Added a `modules/database.py` module to handle database connections and logging with SQLAlchemy.
- Integrated request logging into all command handlers.
- Updated `requirements.txt` with necessary dependencies for MySQL.
- Updated `.env` and `.gitignore` to manage database credentials securely.
- Updated `Readme.md` with instructions on how to run the application using Docker Compose.
This commit is contained in:
google-labs-jules[bot]
2025-12-14 03:28:56 +00:00
parent 4653eda462
commit fec578bd7c
11 changed files with 213 additions and 107 deletions

View File

@@ -2,15 +2,20 @@ import os
import requests
from telegram import Update, ReplyKeyboardMarkup, ReplyKeyboardRemove
from telegram.ext import ContextTypes, ConversationHandler, CommandHandler, MessageHandler, filters
from modules.database import log_request
TIPO_SOLICITUD, FECHAS, MOTIVO = range(3)
async def start_vacaciones(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
user = update.effective_user
log_request(user.id, user.username, "vacaciones", update.message.text)
context.user_data['tipo'] = 'Vacaciones'
await update.message.reply_text("🌴 **Solicitud de Vacaciones**\n\n¿Para qué fechas las necesitas? (Ej: 10 al 15 de Octubre)")
return FECHAS
async def start_permiso(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
user = update.effective_user
log_request(user.id, user.username, "permiso", update.message.text)
context.user_data['tipo'] = 'Permiso Especial'
await update.message.reply_text("⏱️ **Solicitud de Permiso**\n\n¿Para qué día y horario lo necesitas?")
return FECHAS