__init__.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from config import (
  2. bot_token, api_id, api_hash, OWNER_ID,
  3. sudo_users_id as SUDO_USER_ID, log_group_id as LOG_GROUP_ID,
  4. fernet_encryption_key as FERNET_ENCRYPTION_KEY, mongo_db_uri as mdb_uri,
  5. captcha_delay_in_seconds as WELCOME_DELAY_KICK_SEC,
  6. ARQ_API_BASE_URL as ARQ_API)
  7. from pyrogram import Client
  8. from motor.motor_asyncio import AsyncIOMotorClient as MongoClient
  9. from Python_ARQ import ARQ
  10. import time
  11. import logging
  12. f = open("error.log", "w")
  13. f.write("PEAK OF LOG FILE")
  14. LOG_FORMAT = (
  15. '''
  16. [%(asctime)s.%(msecs)03d] %(filename)s:%(lineno)s
  17. %(levelname)s: %(message)s''')
  18. logging.basicConfig(
  19. level=logging.INFO,
  20. format=LOG_FORMAT,
  21. datefmt="%m-%d %H:%M",
  22. filename="error.log",
  23. filemode="w",
  24. )
  25. console = logging.StreamHandler()
  26. console.setLevel(logging.ERROR)
  27. formatter = logging.Formatter(LOG_FORMAT)
  28. console.setFormatter(formatter)
  29. logging.getLogger("").addHandler(console)
  30. log = logging.getLogger()
  31. SUDOERS = SUDO_USER_ID
  32. SUDOERS.append(OWNER_ID)
  33. MOD_LOAD = []
  34. MOD_NOLOAD = []
  35. bot_start_time = time.time()
  36. mongo_client = MongoClient(mdb_uri)
  37. db = mongo_client.wbb
  38. app = Client("wbb", bot_token=bot_token, api_id=api_id, api_hash=api_hash)
  39. arq = ARQ(ARQ_API)