File size: 1,140 Bytes
3f48026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
34
# Copyright (C) @TheSmartBisnu
# Channel: https://t.me/itsSmartDev

from os import getenv
from time import time
from dotenv import load_dotenv

try:
    load_dotenv("config.env.local")
    load_dotenv("config.env")
except Exception:
    pass

if not getenv("BOT_TOKEN") or getenv("BOT_TOKEN", "").count(":") != 1:
    print("Error: BOT_TOKEN must be in format '123456:abcdefghijklmnopqrstuvwxyz'")
    exit(1)

if not getenv("SESSION_STRING") or getenv("SESSION_STRING") == "xxxxxxxxxxxxxxxxxxxxxxx":
    print("Error: SESSION_STRING must be set with a valid string")
    exit(1)


class PyroConf:
    API_ID   = int(getenv("API_ID", "6"))
    API_HASH = getenv("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e")
    BOT_TOKEN       = getenv("BOT_TOKEN")
    SESSION_STRING  = getenv("SESSION_STRING")
    WEBHOOK_SECRET  = getenv("WEBHOOK_SECRET", "")   # optional: verify X-Telegram-Bot-Api-Secret-Token
    BOT_START_TIME  = time()

    MAX_CONCURRENT_DOWNLOADS = int(getenv("MAX_CONCURRENT_DOWNLOADS", "1"))
    BATCH_SIZE               = int(getenv("BATCH_SIZE", "1"))
    FLOOD_WAIT_DELAY         = int(getenv("FLOOD_WAIT_DELAY", "10"))