Sfoglia il codice sorgente

Added /purge command and edited various things

thehamkercat 5 anni fa
parent
commit
86b86b7e26

+ 33 - 0
wbb/modules/admin.py

@@ -0,0 +1,33 @@
+import asyncio
+from pyrogram import Client, filters
+from wbb.utils import cust_filter
+from wbb import app, Command
+
+@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
+
+    message_ids = []
+    count_del_etion_s = 0
+
+    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) > 0:
+            await client.delete_messages(
+                chat_id=message.chat.id,
+                message_ids=message_ids,
+                revoke=True
+            )
+            count_del_etion_s += len(message_ids)
+
+    status_message = await message.reply_text(
+        f"```Purged!```"
+    )
+    await asyncio.sleep(5)
+    await status_message.delete()

+ 1 - 1
wbb/modules/commit.py

@@ -3,7 +3,7 @@ from pyrogram import filters
 from wbb.utils import cust_filter, random_line
 
 __MODULE__ = "Commit"
-__HELP__ = "A Funny little module, try /commit uwu"
+__HELP__ = "/commit - To Generate Funny Commit Messages"
 
 
 @app.on_message(cust_filter.command(commands=(["commit"])))

+ 3 - 0
wbb/modules/log.py

@@ -4,6 +4,9 @@ from wbb.utils import cust_filter, nekobin
 from wbb import app, OWNER_ID
 
 
+__MODULE__ = "Logs"
+__HELP__ = "/log - To Get Logs From Last Run [Owner Only]"
+
 @app.on_message(filters.user(OWNER_ID) & cust_filter.command("log"))
 async def logs_chat(client, message):
     keyb = types.InlineKeyboardMarkup(

+ 7 - 1
wbb/modules/music.py

@@ -6,6 +6,10 @@ from wbb import app, Command
 import os
 import glob
 
+__MODULE__ = "Music"
+__HELP__ = "/music [link] To Download Music From Various Websites"
+
+
 ydl_opts = {
     'format': 'bestaudio/best',
     'postprocessors': [{
@@ -23,14 +27,16 @@ ydl_opts = {
 @app.on_message(cust_filter.command(commands=(["music"])))
 async def commit(client, message):
     app.set_parse_mode("markdown")
-    await message.reply_chat_action("upload_audio")
+    down = await message.reply_text("```Downloading Media!```")
     link = (message.text.split(None, 1)[1])
     with youtube_dl.YoutubeDL(ydl_opts) as ydl:
         ydl.download([link])
     for filename in glob.glob("*.mp3"):
         filename_final = filename.split("-")[0]+" - "+filename.split("-")[-2]+".mp3"
         os.rename(filename, filename_final)
+        await down.edit(f"```Uploading Media!```")
         m = await message.reply_audio(filename_final)
+        await down.delete()
         await m.edit_caption(f"[{filename_final}]({link})")
         os.remove(filename_final)
 

+ 1 - 1
wbb/modules/ping.py

@@ -3,7 +3,7 @@ from wbb.utils import cust_filter
 import requests
 import time
 __MODULE__ = "Ping"
-__HELP__ = " - /ping - to check if I am Alive or Not"
+__HELP__ = " /ping - To Get Response Time From All TG Datacenters"
 
 
 

+ 5 - 4
wbb/modules/repo.py

@@ -3,14 +3,15 @@ from pyrogram import filters
 from wbb.utils import cust_filter
 
 __MODULE__ = "Repo"
-__HELP__ = "Do /repo To Get My Github Repository Link"
+__HELP__ = "/repo - To Get My Github Repository Link"
 
 
 @app.on_message(cust_filter.command(commands=(["repo"])))
 async def repo(client, message):
+    app.set_parse_mode("markdown")
     await message.reply_text(f'''
-👨‍💻 Developer - @TheHamkerCat
+```👨‍💻 Developer``` - @TheHamkerCat
 
-🔗 Repo - github.com/thehamkercat/WilliamButcherBot
+```🔗 Repo``` - github.com/thehamkercat/WilliamButcherBot
 
-❤️ PRs Are Always Welcomed''', disable_web_page_preview=True)
+```❤️ PRs Are Always Welcomed```''', disable_web_page_preview=True)

+ 2 - 2
wbb/modules/speedtest.py

@@ -5,7 +5,7 @@ import speedtest
 
 
 __MODULE__ = "Speedtest"
-__HELP__ = " - /speedtest - to perform a speedtest [only for owner]"
+__HELP__ = " - /speedtest - To Perform A Speedtest [Owner Only]"
 
 
 def speed_convert(size):
@@ -21,7 +21,7 @@ def speed_convert(size):
 @app.on_message(filters.user(OWNER_ID) & cust_filter.command(commands=(["speedtest"])))
 async def speeeed(client, message):
     app.set_parse_mode("markdown")
-    m = await message.reply_text("```Wait, Doing Speedtest!```")
+    m = await message.reply_text("```Performing A Speedtest!```")
     speed = speedtest.Speedtest()
     x = speed.get_best_server()
     y = speed.download()

+ 6 - 2
wbb/modules/stats.py

@@ -5,7 +5,7 @@ import psutil
 from wbb.utils import cust_filter, formater
 
 __MODULE__ = "Stats"
-__HELP__ = "For Bot Owner to Check system Status"
+__HELP__ = "/stats - For Bot Owner To Check System Status [Owner Only]"
 
 
 @app.on_message(filters.user(OWNER_ID) & cust_filter.command(commands=(["stats"])))
@@ -13,5 +13,9 @@ async def stats(client, message):
     cpu = psutil.cpu_percent(interval=0.5)
     mem = psutil.virtual_memory().percent
     disk = psutil.disk_usage("/").percent
-    stats = f"<b>Uptime:</b> {formater.get_readable_time((time.time() - bot_start_time))}" f"\n<b>CPU:</b> {cpu}% " f"\n<b>RAM:</b> {mem}% " f"\n<b>Disk:</b> {disk}%"
+    stats = (f'''
+```Uptime: {formater.get_readable_time((time.time() - bot_start_time))} 
+CPU: {cpu}% 
+RAM: {mem}% 
+Disk: {disk}%```''')
     await message.reply_text(stats)