From 2e2604975e6e6b1579bb3267a70298d74a422341 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Sun, 14 Nov 2021 18:48:41 +0700 Subject: [PATCH] none --- main.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/main.py b/main.py index 6d8b2f8..9f68e5e 100644 --- a/main.py +++ b/main.py @@ -1,15 +1,39 @@ +import os import asyncio +import logging from pytgcalls import idle +from pyrogram import idle as pidle from driver.veez import call_py, bot + +if os.path.exists('log.txt'): + with open('log.txt', 'r+') as f: + f.truncate(0) + +logging.basicConfig( + format='%(asctime)s | %(levelname)s | %(name)s | %(message)s', + datefmt="[%X]", + handlers=[ + logging.FileHandler('log.txt'), + logging.StreamHandler()], + level=logging.INFO) +logging.getLogger("pyrogram").setLevel(logging.WARNING) + +LOGGER = logging.getLogger(__name__) + + async def mulai_bot(): print("[VEEZ]: STARTING BOT CLIENT") await bot.start() print("[VEEZ]: STARTING PYTGCALLS CLIENT") await call_py.start() await idle() + await pidle() print("[VEEZ]: STOPPING BOT & USERBOT") await bot.stop() loop = asyncio.get_event_loop() loop.run_until_complete(mulai_bot()) + + +LOGGER.info("✅ bot has been started")