thehamkercat 5 سال پیش
والد
کامیت
4cc27c32c4
2فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 2 0
      wbb/modules/karma.py
  2. 3 3
      wbb/utils/dbfunctions.py

+ 2 - 0
wbb/modules/karma.py

@@ -23,6 +23,7 @@ SOFTWARE.
 """
 from wbb import app
 from wbb.core.decorators.errors import capture_err
+from wbb.modules.admin import member_permissions
 from wbb.utils.dbfunctions import (update_karma, get_karma, get_karmas,
                                    int_to_alpha, alpha_to_int, is_karma_on,
                                    karma_on, karma_off)
@@ -32,6 +33,7 @@ from pyrogram import filters
 __MODULE__ = "Karma"
 __HELP__ = """[UPVOTE] - Use upvote keywords like "+", "+1", "thanks" etc to upvote a message.
 [DOWNVOTE] - Use downvote keywords like "-", "-1", etc to downvote a message.
+/karma_toggle [ON|OFF] - Enable or Disable Karma System In Your Chat.
 Reply to a message with /karma to check a user's karma
 Send /karma without replying to any message to chek karma list of top 10 users"""
 

+ 3 - 3
wbb/utils/dbfunctions.py

@@ -332,7 +332,7 @@ async def update_karma(chat_id: int, name: str, karma: dict):
 
 
 async def is_karma_on(chat_id: int) -> bool:
-    chat = await karmadb.find_one({"chat_id": chat_id})
+    chat = await karmadb.find_one({"chat_id_toggle": chat_id})
     if not chat:
         return True
     return False
@@ -342,14 +342,14 @@ async def karma_on(chat_id: int):
     is_karma = await is_karma_on(chat_id)
     if is_karma:
         return
-    return await karmadb.delete_one({"chat_id": chat_id})
+    return await karmadb.delete_one({"chat_id_toggle": chat_id})
 
 
 async def karma_off(chat_id: int):
     is_karma = await is_karma_on(chat_id)
     if not is_karma:
         return
-    return await karmadb.insert_one({"chat_id": chat_id})
+    return await karmadb.insert_one({"chat_id_toggle": chat_id})
 
 
 """ Chats log functions """