MissKatyPyro/misskaty/__init__.py
yasirarism 3bebdfee43
Add auto updater and fix genss because pillow v10 (#127)
* auto updater tess

* forgot

* fixx

* tess lagi

* pusing

* no cache

* ok

* Update update.py

* Update requirements.txt

* Update requirements.txt

* Lock pillow version

* Fix error

* Update __init__.py

* style: format code with black and isort (#126)

Format code with black and isort

This commit fixes the style issues introduced in 0188bba according to the output
from Black and isort.

Details: https://app.deepsource.com/gh/yasirarism/MissKatyPyro/transform/dbe242ae-b4d5-4a9a-8998-ba9fe569a4e0/

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2023-07-02 12:26:26 +07:00

79 lines
1.9 KiB
Python

# * @author Yasir Aris M <yasiramunandar@gmail.com>
# * @date 2023-06-21 22:12:27
# * @projectName MissKatyPyro
# * Copyright ©YasirPedia All rights reserved
import time
from logging import ERROR, INFO, StreamHandler, basicConfig, getLogger, handlers
from apscheduler.jobstores.mongodb import MongoDBJobStore
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from async_pymongo import AsyncClient
from pymongo import MongoClient
from pyrogram import Client
from misskaty.core import misskaty_patch
from misskaty.vars import (
API_HASH,
API_ID,
BOT_TOKEN,
DATABASE_NAME,
DATABASE_URI,
TZ,
USER_SESSION,
)
basicConfig(
level=INFO,
format="[%(asctime)s - %(levelname)s] - %(name)s.%(funcName)s - %(message)s",
datefmt="%d-%b-%y %H:%M:%S",
handlers=[
handlers.RotatingFileHandler("MissKatyLogs.txt", mode="w+", maxBytes=1000000),
StreamHandler(),
],
)
getLogger("pyrogram").setLevel(ERROR)
getLogger("openai").setLevel(ERROR)
getLogger("httpx").setLevel(ERROR)
MOD_LOAD = []
MOD_NOLOAD = ["subscene_dl"]
HELPABLE = {}
cleanmode = {}
botStartTime = time.time()
misskaty_version = "v2.9.3 - Stable"
# Pyrogram Bot Client
app = Client(
"MissKatyBot",
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN,
mongodb=dict(connection=AsyncClient(DATABASE_URI), remove_peers=False),
)
# Pyrogram UserBot Client
user = Client(
"YasirUBot",
session_string=USER_SESSION,
)
jobstores = {
"default": MongoDBJobStore(
client=MongoClient(DATABASE_URI), database=DATABASE_NAME, collection="nightmode"
)
}
scheduler = AsyncIOScheduler(jobstores=jobstores, timezone=TZ)
app.start()
BOT_ID = app.me.id
BOT_NAME = app.me.first_name
BOT_USERNAME = app.me.username
if USER_SESSION:
user.start()
UBOT_ID = user.me.id
UBOT_NAME = user.me.first_name
UBOT_USERNAME = user.me.username
else:
UBOT_ID = None
UBOT_NAME = None
UBOT_USERNAME = None