understanding commited on
Commit
9e9ab3f
·
verified ·
1 Parent(s): bf573ad

Update bot/core/auth.py

Browse files
Files changed (1) hide show
  1. bot/core/auth.py +7 -2
bot/core/auth.py CHANGED
@@ -1,13 +1,18 @@
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)
 
1
  # PATH: bot/core/auth.py
 
2
  from bot.config import Telegram
3
  from bot.integrations.cf_worker2 import is_allowed
4
 
5
  def is_owner_id(uid: int | None) -> bool:
6
  return bool(uid and uid == Telegram.OWNER_ID)
7
 
8
+ def is_admin_id(uid: int | None) -> bool:
9
+ if not uid:
10
+ return False
11
+ if is_owner_id(uid):
12
+ return True
13
+ return uid in (Telegram.ADMIN_IDS or [])
14
+
15
  async def require_allowed(uid: int) -> bool:
 
16
  if is_owner_id(uid):
17
  return True
18
  return await is_allowed(uid)