__init__.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from config import (
  2. BOT_TOKEN, API_ID ,API_HASH, OWNER_ID, SUDO_USER_ID,
  3. LOG_GROUP_ID, FERNET_ENCRYPTION_KEY, MONGO_DB_URI,
  4. WELCOME_DELAY_KICK_SEC, ARQ_API_BASE_URL as ARQ_API,
  5. SUDO_CHAT_ID
  6. )
  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(MONGO_DB_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)