-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathenv.py
More file actions
27 lines (22 loc) · 812 Bytes
/
env.py
File metadata and controls
27 lines (22 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
from dotenv import load_dotenv
load_dotenv()
API_ID = os.getenv("API_ID", 0)
API_HASH = os.getenv("API_HASH", "")
BOT_TOKEN = os.getenv("BOT_TOKEN", None)
SUDOERS = list(map(int, os.getenv("SUDOERS", 0).split()))
MONGO_URL = os.getenv("MONGO_URL", None)
LOG_GROUP_ID = os.getenv("LOG_GROUP_ID", None)
MUST_JOIN = os.getenv("MUST_JOIN", "")
DISABLED = os.getenv("DISABLED", "").split()
if not API_ID:
raise SystemExit("No API_ID found. Exiting...")
elif not API_HASH:
raise SystemExit("No API_HASH found. Exiting...")
elif not BOT_TOKEN:
raise SystemExit("No BOT_TOKEN found. Exiting...")
if not MONGO_URL:
print("MONGO_URL environment variable Is Empty Bot")
# Convert the LOG_GROUP_ID variable to an integer if it is not None
if LOG_GROUP_ID:
LOG_GROUP_ID = int(LOG_GROUP_ID)