From bd43ee15ae1023006f985429049cd19cc5011962 Mon Sep 17 00:00:00 2001 From: profitroll Date: Mon, 11 Mar 2024 21:37:01 +0100 Subject: [PATCH] Replaced find_one_and* with proper methods --- classes/pyroclient.py | 4 +--- plugins/callbacks/submission.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/classes/pyroclient.py b/classes/pyroclient.py index 2789f9a..ebab94a 100644 --- a/classes/pyroclient.py +++ b/classes/pyroclient.py @@ -226,9 +226,7 @@ class PyroClient(PyroClient): ) raise SubmissionDuplicatesError(str(filepath), duplicates) - await col_submitted.find_one_and_update( - {"_id": ObjectId(id)}, {"$set": {"done": True}} - ) + await col_submitted.update_one({"_id": ObjectId(id)}, {"$set": {"done": True}}) try: if db_entry["temp"]["uuid"] is not None: diff --git a/plugins/callbacks/submission.py b/plugins/callbacks/submission.py index 72103a8..fb749fe 100644 --- a/plugins/callbacks/submission.py +++ b/plugins/callbacks/submission.py @@ -127,9 +127,7 @@ async def callback_query_no(app: PyroClient, callback: CallbackQuery): user = await app.find_user(callback.from_user) fullcallback = str(callback.data).split("_") - db_entry = await col_submitted.find_one_and_delete( - {"_id": ObjectId(fullcallback[2])} - ) + db_entry = await col_submitted.delete_one({"_id": ObjectId(fullcallback[2])}) if ( db_entry["temp"]["uuid"] is not None