mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
docs: Translate comments and logging messages to Spanish across various modules and the scheduler.
This commit is contained in:
@@ -1,34 +1,39 @@
|
||||
# app/permissions.py
|
||||
# Este script maneja los permisos de los usuarios según su ID de chat de Telegram.
|
||||
|
||||
from config import OWNER_CHAT_ID, ADMIN_CHAT_IDS, TEAM_CHAT_IDS
|
||||
|
||||
def get_user_role(chat_id):
|
||||
"""
|
||||
Determines the role of a user based on their chat ID.
|
||||
Determina el rol de un usuario basado en su ID de chat.
|
||||
|
||||
Roles posibles: owner (dueño), admin (administrador), team (equipo), client (cliente).
|
||||
"""
|
||||
chat_id_str = str(chat_id)
|
||||
|
||||
# Si el ID coincide con el del dueño
|
||||
if chat_id_str == OWNER_CHAT_ID:
|
||||
return "owner"
|
||||
|
||||
# Si el ID está en la lista de administradores
|
||||
if chat_id_str in ADMIN_CHAT_IDS:
|
||||
return "admin"
|
||||
|
||||
# Si el ID está en la lista del equipo
|
||||
if chat_id_str in TEAM_CHAT_IDS:
|
||||
return "team"
|
||||
|
||||
# Si no es ninguno de los anteriores, es un cliente normal
|
||||
return "client"
|
||||
|
||||
def is_owner(chat_id):
|
||||
"""
|
||||
Checks if a user is the owner.
|
||||
"""
|
||||
"""Verifica si un usuario es el dueño."""
|
||||
return get_user_role(chat_id) == "owner"
|
||||
|
||||
def is_admin(chat_id):
|
||||
"""
|
||||
Checks if a user is an admin.
|
||||
"""
|
||||
"""Verifica si un usuario es administrador o dueño."""
|
||||
return get_user_role(chat_id) in ["owner", "admin"]
|
||||
|
||||
def is_team_member(chat_id):
|
||||
"""
|
||||
Checks if a user is a team member.
|
||||
"""
|
||||
"""Verifica si un usuario es parte del equipo, administrador o dueño."""
|
||||
return get_user_role(chat_id) in ["owner", "admin", "team"]
|
||||
|
||||
Reference in New Issue
Block a user