mirror of
https://github.com/marcogll/telegram_new_socias.git
synced 2026-01-13 21:25:16 +00:00
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:
@@ -17,6 +17,8 @@ from telegram.ext import (
|
||||
Defaults,
|
||||
)
|
||||
|
||||
from modules.database import log_request
|
||||
|
||||
# --- 1. CARGA DE ENTORNO ---
|
||||
load_dotenv() # Carga las variables del archivo .env
|
||||
TOKEN = os.getenv("TELEGRAM_TOKEN")
|
||||
@@ -115,6 +117,7 @@ TECLADO_RELACION_EMERGENCIA = ReplyKeyboardMarkup(
|
||||
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
|
||||
user = update.effective_user
|
||||
context.user_data.clear()
|
||||
log_request(user.id, user.username, "welcome", update.message.text)
|
||||
|
||||
context.user_data["metadata"] = {
|
||||
"telegram_id": user.id,
|
||||
|
||||
Reference in New Issue
Block a user