Parcourir la source

Added update and checks for reporting. (#124)

* Added support and checks for reporting.

* Added some checks before tagging
* Added support for admins, admin report
ÁÑÑÍHÌLÅTØR SPÄRK il y a 5 ans
Parent
commit
9e60d4a68d
1 fichiers modifiés avec 15 ajouts et 4 suppressions
  1. 15 4
      wbb/modules/admin.py

+ 15 - 4
wbb/modules/admin.py

@@ -55,7 +55,7 @@ __HELP__ = """/ban - Ban A User
 /tmute - Mute A User For Specific Time
 /unmute - Unmute A User
 /ban_ghosts - Ban Deleted Accounts
-/report | @admins - Report A Message To Admins."""
+/report | @admins | @admin - Report A Message To Admins."""
 
 
 async def member_permissions(chat_id: int, user_id: int):
@@ -610,17 +610,28 @@ async def check_warns(_, message: Message):
 
 
 @app.on_message(
-    (filters.command("report") | filters.command("admins", prefixes="@"))
+    filters.command(["admins", "admin", "report"], prefixes="@")
     & ~filters.edited
     & ~filters.private
 )
 @capture_err
 async def report_user(_, message):
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a message to report user.")
+        return await message.reply_text(
+          "Reply to a message to report that user."
+        )
+ 
+    if message.reply_to_message.from_user.id == message.from_user.id:
+        return await message.reply_text("Why are you reporting yourself ?")
+
     list_of_admins = await list_admins(message.chat.id)
+    if message.reply_to_message.from_user.id in list_of_admins:
+        return await message.reply_text(
+          "Do you know that the user you are replying is an admin ?"
+        )
+ 
     user_mention = message.reply_to_message.from_user.mention
-    text = f"Reported {user_mention} to admins."
+    text = f"Reported {user_mention} to admins!"
     for admin in list_of_admins:
         text += f"[\u2063](tg://user?id={admin})"
     await message.reply_to_message.reply_text(text)