diff --git a/misskaty/__init__.py b/misskaty/__init__.py index 8d869fab..05d370fd 100644 --- a/misskaty/__init__.py +++ b/misskaty/__init__.py @@ -3,6 +3,7 @@ from logging import ERROR, INFO, StreamHandler, basicConfig, getLogger, handlers from apscheduler.jobstores.mongodb import MongoDBJobStore from apscheduler.schedulers.asyncio import AsyncIOScheduler +from database import dbname from motor.motor_asyncio import AsyncIOMotorClient from pymongo import MongoClient from pyrogram import Client @@ -49,7 +50,7 @@ user = Client( jobstores = {"default": MongoDBJobStore(client=pymonclient, database=DATABASE_NAME, collection="nightmode")} scheduler = AsyncIOScheduler(jobstores=jobstores, timezone=TZ) - + app.start() BOT_ID = app.me.id BOT_NAME = app.me.first_name diff --git a/misskaty/__main__.py b/misskaty/__main__.py index 1b49682b..69734202 100644 --- a/misskaty/__main__.py +++ b/misskaty/__main__.py @@ -72,6 +72,10 @@ async def start_bot(): except Exception as e: LOGGER.error(str(e)) scheduler.start() + if "web" not in await dbname.list_collection_names(): + for key, value in web.items(): + webdb = dbname.web + await webdb.insert_one({key: value}) if os.path.exists("restart.pickle"): with open('restart.pickle', 'rb') as status: chat_id, message_id = pickle.load(status) diff --git a/misskaty/plugins/chatbot_ai.py b/misskaty/plugins/chatbot_ai.py index 558d970c..afa85680 100644 --- a/misskaty/plugins/chatbot_ai.py +++ b/misskaty/plugins/chatbot_ai.py @@ -31,7 +31,7 @@ async def chatbot(self: Client, ctx: Message, strings): num = 0 answer = "" try: - response = await openai.ChatCompletion.acreate(model="gpt-3.5-turbo", messages=[{"role": "user", "content": pertanyaan}], temperature=0.2, stream=True) + response = await openai.ChatCompletion.acreate(model="gpt-3.5-turbo", messages=[{"role": "user", "content": pertanyaan}], temperature=0.7, stream=True) async for chunk in response: if not chunk.choices[0].delta or chunk.choices[0].delta.get("role"): continue diff --git a/misskaty/plugins/web_scraper.py b/misskaty/plugins/web_scraper.py index 0f6298b5..bd6cb5aa 100644 --- a/misskaty/plugins/web_scraper.py +++ b/misskaty/plugins/web_scraper.py @@ -55,7 +55,6 @@ web = { "oplovers": "https://oploverz.top", } - def split_arr(arr, size: 5): arrs = [] while len(arr) > size: