__init__.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. PHONE_NUMBER
  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. FERNET_ENCRYPTION_KEY = FERNET_ENCRYPTION_KEY
  32. WELCOME_DELAY_KICK_SEC = WELCOME_DELAY_KICK_SEC
  33. LOG_GROUP_ID = LOG_GROUP_ID
  34. SUDOERS = SUDO_USER_ID
  35. SUDOERS.append(OWNER_ID)
  36. MOD_LOAD = []
  37. MOD_NOLOAD = []
  38. bot_start_time = time.time()
  39. mongo_client = MongoClient(MONGO_DB_URI)
  40. db = mongo_client.wbb
  41. print("\nStarting Helper Userbot")
  42. app2 = Client(
  43. "userbot",
  44. phone_number=PHONE_NUMBER,
  45. api_id=API_ID,
  46. api_hash=API_HASH
  47. )
  48. print("\nStarting Main Bot\n")
  49. app = Client(
  50. "wbb",
  51. bot_token=BOT_TOKEN,
  52. api_id=API_ID,
  53. api_hash=API_HASH
  54. )
  55. arq = ARQ(ARQ_API)