understanding commited on
Commit
87c19c8
·
verified ·
1 Parent(s): 760b1a7

Create auth.py

Browse files
Files changed (1) hide show
  1. bot/core/auth.py +13 -0
bot/core/auth.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PATH: bot/core/auth.py
2
+ from hydrogram.types import Message
3
+ from bot.config import Telegram
4
+ from bot.integrations.cf_worker2 import is_allowed
5
+
6
+ def is_owner_id(uid: int | None) -> bool:
7
+ return bool(uid and uid == Telegram.OWNER_ID)
8
+
9
+ async def require_allowed(uid: int) -> bool:
10
+ # owner always allowed
11
+ if is_owner_id(uid):
12
+ return True
13
+ return await is_allowed(uid)