Add Translator Bot for Telegram

This commit is contained in:
2024-07-11 02:54:47 +02:00
parent 5821636a01
commit fbecbbf0a1
6 changed files with 320 additions and 14 deletions

View File

@@ -0,0 +1,19 @@
# config.py
# Este módulo gestiona la configuración y la carga de variables de entorno.
import os
from dotenv import load_dotenv
# Cargar las variables de entorno desde el archivo .env
load_dotenv('.env')
# Obtener el token del bot y el ID del chat de grupo desde las variables de entorno
BOT_TOKEN = os.getenv('BOT_TOKEN')
GROUP_CHAT_ID = os.getenv('GROUP_CHAT_ID')
# Validar que las variables de entorno estén configuradas
if not BOT_TOKEN or not GROUP_CHAT_ID:
raise AssertionError("Por favor, configura las variables de entorno BOT_TOKEN y GROUP_CHAT_ID")
# Convertir GROUP_CHAT_ID a entero
GROUP_CHAT_ID = int(GROUP_CHAT_ID)