understanding's picture
Create auth.py
87c19c8 verified
raw
history blame
387 Bytes
# PATH: bot/core/auth.py
from hydrogram.types import Message
from bot.config import Telegram
from bot.integrations.cf_worker2 import is_allowed
def is_owner_id(uid: int | None) -> bool:
return bool(uid and uid == Telegram.OWNER_ID)
async def require_allowed(uid: int) -> bool:
# owner always allowed
if is_owner_id(uid):
return True
return await is_allowed(uid)