Selaa lähdekoodia

Added /paste command and Fixed many other things

TheHamkerCat 5 vuotta sitten
vanhempi
sitoutus
6a368b611d

+ 5 - 2
wbb/modules/greetings.py

@@ -1,5 +1,6 @@
 from wbb import app
 from pyrogram import filters, emoji
+import asyncio
 
 
 MESSAGE = "{} Welcome {}!"
@@ -8,5 +9,7 @@ MESSAGE = "{} Welcome {}!"
 @app.on_message(filters.new_chat_members)
 async def welcome(client, message):
     new_members = [i.mention for i in message.new_chat_members]
-    text = MESSAGE.format(emoji.CROWN, ", ".join(new_members))
-    await message.reply_text(text, disable_web_page_preview=True)
+    text = MESSAGE.format(emoji.CROWN, ",  ".join(new_members))
+    m = await message.reply_text(text, disable_web_page_preview=True)
+    await asyncio.sleep(20)
+    await m.delete()

+ 1 - 1
wbb/modules/music.py

@@ -15,7 +15,7 @@ ydl_opts = {
 
 
 @app.on_message(cust_filter.command(commands=("music")))
-async def commit(client, message):
+async def music(client, message):
     await message.reply_chat_action("typing")
     app.set_parse_mode("html")
     link = (message.text.split(None, 1)[1])

+ 35 - 0
wbb/modules/paste.py

@@ -0,0 +1,35 @@
+from wbb.utils import cust_filter, nekobin
+from wbb import app
+import os
+
+
+__MODULE__ = "Paste"
+__HELP__ = "/paste - To Paste Replied Text Or Document To Neokobin"
+
+
+@app.on_message(cust_filter.command(commands=("paste")))
+async def paste(client, message):
+    if bool(message.reply_to_message) is True:
+        app.set_parse_mode("markdown")
+        if bool(message.reply_to_message.text) is True:
+            m = await message.reply_text("```Pasting To Nekobin...```")
+            message_get = message.reply_to_message.text
+            message_as_str = str(message_get)
+            paste_link = await nekobin.neko(message_as_str)
+            final_link = f"[Nekobin]({paste_link})"
+            await m.edit(final_link, disable_web_page_preview=True)
+
+        elif bool(message.reply_to_message.document) is True:
+            m = await message.reply_text("```Pasting To Nekobin...```")
+            await message.reply_to_message.download(file_name='paste.txt')
+            f = open("downloads/paste.txt", "r")
+            paste_link = await nekobin.neko(f.read())
+            os.remove('downloads/paste.txt')
+            final_link = f"[Nekobin]({paste_link})"
+            await m.edit(final_link, disable_web_page_preview=True)
+    elif bool(message.reply_to_message) is False:
+        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'.'''
+        )

+ 1 - 1
wbb/modules/quotes.py

@@ -6,5 +6,5 @@ __HELP__ = "/quote - Generate Funny Linux Quotes"
 
 
 @app.on_message(cust_filter.command(commands=("quote")))
-async def commit(client, message):
+async def quotes(client, message):
     await message.reply_text((await random_line('wbb/utils/quotes.txt')))

+ 3 - 28
wbb/modules/repo.py

@@ -1,39 +1,14 @@
 from wbb import app
 from wbb.utils import cust_filter
-import requests
+
 
 __MODULE__ = "Repo"
 __HELP__ = "/repo - To Get My Github Repository Link"
 
-api = 'https://api.github.com/repos/thehamkercat/' \
-      'WilliamButcherBot/stats/contributors'
-
-print(api)
-
 
 @app.on_message(cust_filter.command(commands=("repo")))
 async def repo(client, message):
     app.set_parse_mode("markdown")
-    profile_url = []
-    username = []
-
-# Get The List Of Usernames And Profile Url
-    for item in requests.get(api).json():
-        profile_url.append(f"{item['author']['html_url']}")
-        username.append(f"{item['author']['login']}")
-
-# Join Usernames And Profile Url For Markdown
-    no_of_contributors = len(username)
-    i = 0
-    n = 1
-    contributors = ""
-    while i < no_of_contributors:
-        contributors += f"[{n}. {username[i]}]({profile_url[i]})\n"
-        n += 1
-        i += 1
-
-    await message.reply_text(f'''
-```Devs and Contributors```
-{contributors}
-```Source Code```[Github](https://github.com/thehamkercat/WilliamButcherBot)
+    await message.reply_text('''
+[Github](https://github.com/thehamkercat/WilliamButcherBot)
 ''', disable_web_page_preview=True)

+ 1 - 1
wbb/modules/rice.py

@@ -6,7 +6,7 @@ __HELP__ = "/rice - To Forward Your Linux Rice To DE_WM's Rice Gallery"
 
 
 @app.on_message(cust_filter.command(commands=("rice")))
-async def ping(client, message):
+async def rice(client, message):
     app.set_parse_mode("markdown")
     m = await message.reply_text("```Forwarding!```")
     id = message.reply_to_message.from_user.id

+ 1 - 1
wbb/modules/sudoers.py

@@ -7,7 +7,6 @@ import psutil
 import time
 import os
 
-
 __MODULE__ = "Sudoers"
 __HELP__ = '''
 /log - To Get Logs From Last Run.
@@ -62,6 +61,7 @@ async def paste_log_neko(client, query):
             query.id, "'Blue Button Must Press', huh?", show_alert=True
         )
 
+
 # SpeedTest Module