Forráskód Böngészése

fixed many things

TheHamkerCat 5 éve
szülő
commit
69f8f44c00

+ 1 - 1
wbb/__main__.py

@@ -61,7 +61,7 @@ async def start(client, message):
     if message.chat.type != "private":
         await message.reply_text((await random_line("wbb/utils/start.txt")))
         return
-    await message.reply("Hi, try /help")
+    await message.reply("Get Some /help")
 
 
 @app.on_message(cust_filter.command("help"))

+ 44 - 30
wbb/modules/admin.py

@@ -1,50 +1,64 @@
 import asyncio
 from wbb.utils import cust_filter
-from wbb import app
-from wbb.utils.is_admin import is_admin
+from wbb import app, OWNER_ID
 
 
 __MODULE__ = "Admin"
-__HELP__ = '''
-/purge - Purge Messages [Limit = 100]
+__HELP__ = "/purge - Purge Messages [Limit = 100]"
 
-'''
+# Purge Messages
 
 
 @app.on_message(cust_filter.command(commands=("purge")))
 async def purge(client, message):
-    app.set_parse_mode("markdown")
     if message.chat.type not in (("supergroup", "channel")):
         return
-    admin = await is_admin(message)
-
-    if not admin:
-        return
 
     message_ids = []
+    # Admin check logic
+    group_id = message.chat.id
+    list_of_admins = []
+    async for member in app.iter_chat_members(
+            group_id, filter="administrators"):
+        list_of_admins.append(member.user.id)
 
-    if message.reply_to_message:
-        for a_s_message_id in range(
-            message.reply_to_message.message_id,
-            message.message_id
-        ):
-            message_ids.append(a_s_message_id)
-            if len(message_ids) == 100:
+    if message.from_user.id in list_of_admins \
+            or message.from_user.id == OWNER_ID:
+        if message.reply_to_message:
+            for a_s_message_id in range(
+                message.reply_to_message.message_id,
+                message.message_id
+            ):
+                message_ids.append(a_s_message_id)
+                if len(message_ids) == 100:
+                    await client.delete_messages(
+                        chat_id=message.chat.id,
+                        message_ids=message_ids,
+                        revoke=True
+                    )
+                    message_ids = []
+            if len(message_ids) > 0:
                 await client.delete_messages(
                     chat_id=message.chat.id,
                     message_ids=message_ids,
                     revoke=True
                 )
-                message_ids = []
-        if len(message_ids) > 0:
-            await client.delete_messages(
-                chat_id=message.chat.id,
-                message_ids=message_ids,
-                revoke=True
-            )
-
-    m = await message.reply_text(
-        "```Purged!```"
-    )
-    await asyncio.sleep(2)
-    await m.delete()
+
+        m = await message.reply_text("Purged!")
+        await asyncio.sleep(1)
+        await m.delete()
+
+    else:
+        await message.reply_text("You Are Not Admin, Stop Spamming! else /bun")
+
+# Kicking users
+
+
+@app.on_message(cust_filter.command(commands=("kick")))
+async def kick(client, message):
+    username = (message.text.split(None, 1)[1])
+    if username != "":
+        
+
+
+

+ 2 - 1
wbb/modules/images.py

@@ -7,7 +7,8 @@ import requests as r
 
 __MODULE__ = "Images"
 __HELP__ = "/cat - Get Cute Cats Images\n" + \
-           "/dog - Get Cute Dogs Images"
+           "/dog - Get Cute Dogs Images\n" + \
+           "/wall [something] - Get Wallpapers"
 
 
 @app.on_message(cust_filter.command(commands=("cat")))

+ 1 - 1
wbb/modules/paste.py

@@ -31,5 +31,5 @@ async def paste(client, message):
         await message.reply_text(
             "```Reply To A Message With /paste, Just Hitting /paste " +
             "Won't Do Anything Other Than Proving Everyone That " +
-            "You Are Obsessed To 'BlueTextMustClickofobia'```"
+            "You Are A Spammer Who Is Obsessed To 'BlueTextMustClickofobia'```"
             )

+ 6 - 4
wbb/modules/repo.py

@@ -3,12 +3,14 @@ from wbb.utils import cust_filter
 
 
 __MODULE__ = "Repo"
-__HELP__ = "/repo - To Get My Github Repository Link"
+__HELP__ = "/repo - To Get My Github Repository Link" + \
+           "And Support Group Link"
 
 
 @app.on_message(cust_filter.command(commands=("repo")))
 async def repo(client, message):
     app.set_parse_mode("markdown")
-    await message.reply_text('''
-[Github](https://github.com/thehamkercat/WilliamButcherBot)
-''', disable_web_page_preview=True)
+    await message.reply_text(
+        "[Github](https://github.com/thehamkercat/WilliamButcherBot)" +
+        " | [Group](t.me/Thepirategang)", disable_web_page_preview=True
+        )

+ 17 - 9
wbb/modules/rice.py

@@ -10,12 +10,20 @@ __HELP__ = "/rice - To Forward Your Linux Rice To DE_WM's" \
 
 @app.on_message(filters.chat('DE_WM') & cust_filter.command(commands=("rice")))
 async def rice(client, message):
-    app.set_parse_mode("markdown")
-    m = await message.reply_text("```Forwarding!```")
-    id = message.reply_to_message.from_user.id
-    await message.reply_to_message.forward('RiceGallery')
-    await m.edit(
-        f"[Your](tg://user?id={id}) Rice Forwared"
-        " To [Rice Gallery](https://t.me/RiceGallery)",
-        disable_web_page_preview=True
-    )
+    if bool(message.reply_to_message) is True:
+        app.set_parse_mode("markdown")
+        m = await message.reply_text("```Forwarding!```")
+        id = message.reply_to_message.from_user.id
+        await message.reply_to_message.forward('RiceGallery')
+        await m.edit(
+            f"[Your](tg://user?id={id}) Rice Forwared"
+            " To [Rice Gallery](https://t.me/RiceGallery)",
+            disable_web_page_preview=True
+        )
+
+    elif bool(message.reply_to_message) is False:
+        await message.reply_text(
+            "```Reply To A Message With /rice, Just Hitting /rice " +
+            "Won't Do Anything Other Than Proving Everyone That " +
+            "You Are A Spammer Who Is Obsessed To 'BlueTextMustClickofobia'```"
+            )

+ 0 - 32
wbb/utils/is_admin.py

@@ -1,32 +0,0 @@
-from pyrogram.types import Message
-
-
-async def is_admin(message: Message) -> bool:
-    if not message.from_user:
-        return False
-
-    if message.chat.type not in ["supergroup", "channel"]:
-        return False
-
-    if message.from_user.id in [
-        777000,  # Telegram Service Notifications
-        1087968824  # GroupAnonymousBot
-    ]:
-        return True
-
-    client = message._client
-    chat_id = message.chat.id
-    user_id = message.from_user.id
-
-    check_status = await client.get_chat_member(
-        chat_id=chat_id,
-        user_id=user_id
-    )
-    admin_strings = [
-        "creator",
-        "administrator"
-    ]
-    if check_status.status not in admin_strings:
-        return False
-    else:
-        return True