mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-03 11:04:51 +00:00
Tes web domain in DB
This commit is contained in:
parent
0bf8595132
commit
fd1960a38e
4 changed files with 7 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ web = {
|
|||
"oplovers": "https://oploverz.top",
|
||||
}
|
||||
|
||||
|
||||
def split_arr(arr, size: 5):
|
||||
arrs = []
|
||||
while len(arr) > size:
|
||||
|
|
|
|||
Loading…
Reference in a new issue