Skip to content

Commit

Permalink
fix(reporting): update reporting setting logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMissx committed Jul 16, 2024
1 parent c938790 commit a9a6bfb
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions anjani/plugins/reporting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Admin reporting plugin """

# Copyright (C) 2020 - 2023 UserbotIndo Team, <https://github.com/userbotindo.git>
#
# This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -109,19 +110,12 @@ async def on_message(self, message: Message) -> None:

async def setting(self, chat_id: int, is_private: bool, setting: bool) -> None:
if is_private:
if setting:
await self.user_db.update_one(
{"_id": chat_id}, {"$set": {"setting": True}}, upsert=True
)
else:
await self.user_db.delete_one({"_id": chat_id})
else:
if setting:
await self.db.update_one(
{"chat_id": chat_id}, {"$set": {"setting": True}}, upsert=True
)
else:
await self.db.delete_one({"chat_id": chat_id})
await self.user_db.update_one(
{"_id": chat_id}, {"$set": {"setting": setting}}, upsert=True
)
return

await self.db.update_one({"chat_id": chat_id}, {"$set": {"setting": setting}}, upsert=True)

async def is_active(self, uid: int, is_private: bool) -> bool:
"""Get current setting default to True"""
Expand Down

0 comments on commit a9a6bfb

Please sign in to comment.