mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 13:25:19 +00:00
feat: Initial project structure
- Creates the initial project structure for the Talía bot, including the `app` and `app/modules` directories. - Adds placeholder files for the core application logic, modules, and configuration. - Includes a `Dockerfile` and `docker-compose.yml` for containerization. - Adds a `requirements.txt` file with the necessary dependencies. - Creates a `tasks.md` file to track development progress.
This commit is contained in:
34
app/permissions.py
Normal file
34
app/permissions.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# app/permissions.py
|
||||
|
||||
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.
|
||||
"""
|
||||
chat_id_str = str(chat_id)
|
||||
if chat_id_str == OWNER_CHAT_ID:
|
||||
return "owner"
|
||||
if chat_id_str in ADMIN_CHAT_IDS:
|
||||
return "admin"
|
||||
if chat_id_str in TEAM_CHAT_IDS:
|
||||
return "team"
|
||||
return "client"
|
||||
|
||||
def is_owner(chat_id):
|
||||
"""
|
||||
Checks if a user is the owner.
|
||||
"""
|
||||
return get_user_role(chat_id) == "owner"
|
||||
|
||||
def is_admin(chat_id):
|
||||
"""
|
||||
Checks if a user is an admin.
|
||||
"""
|
||||
return get_user_role(chat_id) in ["owner", "admin"]
|
||||
|
||||
def is_team_member(chat_id):
|
||||
"""
|
||||
Checks if a user is a team member.
|
||||
"""
|
||||
return get_user_role(chat_id) in ["owner", "admin", "team"]
|
||||
Reference in New Issue
Block a user