Install postgresql, fix session import on heroku

pull/1/head
hikariatama 2022-05-30 20:16:07 +00:00
parent 867f2c542d
commit e67b98a999
2 changed files with 4 additions and 20 deletions

View File

@ -24,7 +24,7 @@ def publish(
app, config = get_app(key, api_token, create_new)
# Will be configured later in app
config["HIKKA_SESSION"] = None
config["HIKKA_SESSION"] = "None"
config["heroku_api_token"] = key
if api_token is not None:
@ -41,6 +41,8 @@ def publish(
]
)
app.install_addon("heroku-postgresql")
repo = get_repo()
url = app.git_url.replace("https://", f"https://api:{key}@")

View File

@ -290,24 +290,6 @@ class Hikka:
self._get_api_token()
self._get_proxy()
if "DYNO" in os.environ and "HIKKA_SESSION" in os.environ:
try:
client = TelegramClient(
StringSession(os.environ.get("HIKKA_SESSION")),
self.api_token.ID,
self.api_token.HASH,
connection=self.conn,
proxy=self.proxy,
connection_retries=None,
device_model="Hikka",
)
client.start()
install_entity_caching(client)
self.clients += [client]
except Exception:
logging.exception("Failed to load session")
def _get_proxy(self):
"""
Get proxy tuple from --proxy-host, --proxy-port and --proxy-secret
@ -346,7 +328,7 @@ class Hikka:
)
]
if "HIKKA_SESSION" in os.environ:
if os.environ.get("HIKKA_SESSION") not in {None, "None"}:
self.sessions += [StringSession(os.environ.get("HIKKA_SESSION"))]
def _get_api_token(self):