__init__.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. )
  6. from pyrogram import Client
  7. from motor.motor_asyncio import AsyncIOMotorClient as MongoClient
  8. from Python_ARQ import ARQ
  9. import time
  10. import logging
  11. f = open("error.log", "w")
  12. f.write("PEAK OF LOG FILE")
  13. LOG_FORMAT = (
  14. '''
  15. [%(asctime)s.%(msecs)03d] %(filename)s:%(lineno)s
  16. %(levelname)s: %(message)s''')
  17. logging.basicConfig(
  18. level=logging.INFO,
  19. format=LOG_FORMAT,
  20. datefmt="%m-%d %H:%M",
  21. filename="error.log",
  22. filemode="w",
  23. )
  24. console = logging.StreamHandler()
  25. console.setLevel(logging.ERROR)
  26. formatter = logging.Formatter(LOG_FORMAT)
  27. console.setFormatter(formatter)
  28. logging.getLogger("").addHandler(console)
  29. log = logging.getLogger()
  30. FERNET_ENCRYPTION_KEY = FERNET_ENCRYPTION_KEY
  31. WELCOME_DELAY_KICK_SEC = WELCOME_DELAY_KICK_SEC
  32. LOG_GROUP_ID = LOG_GROUP_ID
  33. SUDOERS = SUDO_USER_ID
  34. SUDOERS.append(OWNER_ID)
  35. MOD_LOAD = []
  36. MOD_NOLOAD = []
  37. bot_start_time = time.time()
  38. mongo_client = MongoClient(MONGO_DB_URI)
  39. db = mongo_client.wbb
  40. print("\nStarting Helper Userbot")
  41. app2 = Client("userbot", api_id=API_ID, api_hash=API_HASH)
  42. print("\nStarting Main Bot\n")
  43. app = Client("wbb", bot_token=BOT_TOKEN, api_id=API_ID, api_hash=API_HASH)
  44. arq = ARQ(ARQ_API)