understanding commited on
Commit
3dcde77
·
verified ·
1 Parent(s): 7b05db0

Create bot/config.py

Browse files
Files changed (1) hide show
  1. bot/config.py +29 -0
bot/config.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from os import environ as env
2
+
3
+ def _to_int_list(s: str):
4
+ if not s:
5
+ return []
6
+ out = []
7
+ for part in s.replace(",", " ").split():
8
+ try:
9
+ out.append(int(part.strip()))
10
+ except:
11
+ pass
12
+ return out
13
+
14
+ class Telegram:
15
+ API_ID = int(env.get("TELEGRAM_API_ID", "0") or "0")
16
+ API_HASH = env.get("TELEGRAM_API_HASH", "")
17
+ SESSION_STRING = env.get("SESSION_STRING", "") # ✅ use this (generated by your gen.py)
18
+ OWNER_ID = int(env.get("OWNER_ID", "0") or "0")
19
+
20
+ # Optional: extra allowlist (space-separated ids)
21
+ ALLOWED_USER_IDS = set(_to_int_list(env.get("ALLOWED_USER_IDS", "")))
22
+
23
+ BOT_USERNAME = env.get("TELEGRAM_BOT_USERNAME", "")
24
+ CHANNEL_ID = int(env.get("TELEGRAM_CHANNEL_ID", "0") or "0")
25
+
26
+ class Server:
27
+ BASE_URL = env.get("BASE_URL", "")
28
+ BIND_ADDRESS = env.get("BIND_ADDRESS", "0.0.0.0")
29
+ PORT = int(env.get("PORT", "7860") or "7860")