16 lines
425 B
Python
16 lines
425 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from .types import TencentSmsAccount
|
||
|
|
|
||
|
|
|
||
|
|
def check_allowlist(account: TencentSmsAccount, phone: str):
|
||
|
|
allow = account.allow_from
|
||
|
|
if not allow:
|
||
|
|
return
|
||
|
|
if phone not in allow:
|
||
|
|
raise PermissionError(f"\u53f7\u7801 {phone[:6]}*** \u4e0d\u5728\u767d\u540d\u5355\u4e2d")
|
||
|
|
|
||
|
|
|
||
|
|
def resolve_dm_policy(account: TencentSmsAccount) -> str:
|
||
|
|
return account.dm_policy or "open"
|