-
Notifications
You must be signed in to change notification settings - Fork 1
/
Config.py
27 lines (25 loc) · 1009 Bytes
/
Config.py
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
ENVIRONMENT = os.environ.get('ENVIRONMENT', False)
if ENVIRONMENT:
try:
API_ID = int(os.environ.get('API_ID', 0))
except ValueError:
raise Exception("Your API_ID is not a valid integer.")
API_HASH = os.environ.get('API_HASH', None)
BOT_TOKEN = os.environ.get('BOT_TOKEN', None)
DATABASE_URL = os.environ.get('DATABASE_URL', None)
DATABASE_URL = DATABASE_URL.replace("postgres", "postgresql") # Sqlalchemy dropped support for "postgres" name.
# https://stackoverflow.com/questions/62688256/sqlalchemy-exc-nosuchmoduleerror-cant-load-plugin-sqlalchemy-dialectspostgre
MUST_JOIN = os.environ.get('MUST_JOIN', None)
if MUST_JOIN.startswith("@"):
MUST_JOIN = MUST_JOIN.replace("@", "")
else:
# Fill the Values
API_ID = 0
API_HASH = ""
BOT_TOKEN = ""
DATABASE_URL = ""
DATABASE_URL = DATABASE_URL.replace("postgres", "postgresql")
MUST_JOIN = ""
if MUST_JOIN.startswith("@"):
MUST_JOIN = MUST_JOIN[1:]