-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
49 lines (37 loc) · 1.21 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import asyncio
import os
import fake_useragent
from aiogram import Bot, Dispatcher
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from pydantic import BaseSettings
from myloguru.mailer import get_mailer_logger
# Constants
DISCORD_BASE_URL: str = f'https://discord.com/api/v9/channels/'
# flag for saving files
SAVING: bool = False
class Settings(BaseSettings):
STAGE: str = 'local'
LOGGING_LEVEL: int = 20
TELEBOT_TOKEN: str = ''
PROXY_USER: str = ''
PROXY_PASSWORD: str = ''
DEFAULT_PROXY: str = ''
BASE_API_URL: str = ''
PROXY_TEST_URL: str = ''
ADMINS: list[str] = []
PROXIES: list[str] = None
SEMAPHORE_MAX_TASKS: int = 10
DEBUG: bool = False
settings = Settings(_env_file='.env', _env_file_encoding='utf-8')
# logger
if not os.path.exists('./logs'):
os.mkdir("./logs")
logger = get_mailer_logger(level=settings.LOGGING_LEVEL)
# set admins list
admins_list = settings.ADMINS[:]
# configure bot
bot = Bot(token=settings.TELEBOT_TOKEN)
storage = MemoryStorage()
dp = Dispatcher(bot, storage=storage)
SEMAPHORE = asyncio.Semaphore(settings.SEMAPHORE_MAX_TASKS)
user_agent = fake_useragent.UserAgent(path='./useragent.json', verify_ssl=False)['google chrome']