Forget ctx and add mongo session for bot

This commit is contained in:
yasirarism 2023-05-16 06:56:20 +00:00 committed by GitHub
parent 5cf1761a21
commit e03a0a6df2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -9,7 +9,7 @@ from pyrogram import Client
from database.session_db import MongoStorage
from misskaty.core import misskaty_patch
from misskaty.vars import API_HASH, API_ID, BOT_TOKEN, DATABASE_URI, TZ, USER_SESSION
from misskaty.vars import API_HASH, API_ID, BOT_TOKEN, DATABASE_URI, TZ, USER_SESSION, DATABASE_NAME
basicConfig(
level=INFO,
@ -39,6 +39,7 @@ app = Client(
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN,
mongodb=dict(uri=DATABASE_URI, db_name=DATABASE_NAME, remove_peers=False),
)
# Pyrogram UserBot Client
@ -47,7 +48,7 @@ user = Client(
session_string=USER_SESSION,
)
jobstores = {"default": MongoDBJobStore(client=pymonclient, database="MissKatyDB", collection="nightmode")}
jobstores = {"default": MongoDBJobStore(client=pymonclient, database=DATABASE_NAME, collection="nightmode")}
scheduler = AsyncIOScheduler(jobstores=jobstores, timezone=TZ)
app.start()

View file

@ -93,7 +93,7 @@ async def donate(client, ctx):
InlineButton('PayPal', url='https://paypal.me/yasirarism'),
)
await ctx.reply(
f"Hai {message.from_user.mention}, jika kamu merasa bot ini besrguna bisa melakukan donasi dengan ke rekening diatas yaa. Karena server bot ini tidaklah gratis. Terimakasih..\n\nHi {message.from_user.mention}, if you feel this bot is useful, you can make a donation to the account above. Because this bot server is not free. Thank you..",
f"Hai {ctx.from_user.mention}, jika kamu merasa bot ini besrguna bisa melakukan donasi dengan ke rekening diatas yaa. Karena server bot ini tidaklah gratis. Terimakasih..\n\nHi {message.from_user.mention}, if you feel this bot is useful, you can make a donation to the account above. Because this bot server is not free. Thank you..",
)