TheHamkerCat 5 rokov pred
rodič
commit
496690face
2 zmenil súbory, kde vykonal 2 pridanie a 171 odobranie
  1. 2 26
      wbb/modules/images.py
  2. 0 145
      wbb/modules/search.py

+ 2 - 26
wbb/modules/images.py

@@ -8,7 +8,8 @@ from wbb.utils.errors import capture_err
 
 __MODULE__ = "Images"
 __HELP__ = '''/cat  - Get Cute Cats Images
-/wall - Get Wallpapers'''
+For more images like wallpapers, use inline mode.
+send /inline for inline help.'''
 
 
 async def delete_message_with_delay(delay, message):
@@ -25,28 +26,3 @@ async def cat(_, message):
         data = json.loads(url.read().decode())
     cat_url = (data[0]['url'])
     await message.reply_photo(cat_url)
-
-
-@app.on_message(filters.command("wall") & ~filters.edited)
-@capture_err
-async def wall(_, message):
-    if len(message.command) < 2:
-        await message.reply_text("/wall needs an argument")
-        return
-    initial_term = message.text.split(None, 1)[1]
-    m = await message.reply_text("Searching!")
-    term = initial_term.replace(' ', '%20')
-    try:
-        wallpapers = await arq.wall(term)
-    except KeyError:
-        await m.edit("Found literally nothing!,"
-                     + "You should work on your English.")
-        return
-    if len(wallpapers) > 10:
-        selection = 10
-    else:
-        selection = len(wallpapers)
-    index = randint(0, selection - 1)
-    wallpaper = wallpapers[index].url_image
-    await message.reply_document(wallpaper)
-    await m.delete()

+ 0 - 145
wbb/modules/search.py

@@ -1,145 +0,0 @@
-from search_engine_parser import GoogleSearch
-from pyrogram import filters
-from wbb import app, arq
-from wbb.utils.errors import capture_err
-
-__MODULE__ = "Search"
-__HELP__ = '''/ud - Query Urban Dictionary
-/google - Query Google
-/so - Query Stack OverFlow
-/gh - Query GitHub
-/yt - Query YouTube'''
-
-# ud -  urbandictionary
-
-
-@app.on_message(filters.command("ud") & ~filters.edited)
-@capture_err
-async def urbandict(_, message):
-    if len(message.command) < 2:
-        await message.reply_text('"/ud" Needs An Argument.')
-        return
-    text = message.text.split(None, 1)[1]
-    try:
-        results = await arq.urbandict(text)
-        reply_text = f"""**Definition:** __{results[0].definition}__
-
-**Example:** __{results[0].example}__"""
-    except IndexError:
-        reply_text = ("Sorry could not find any matching results!")
-    ignore_chars = "[]"
-    reply = reply_text
-    for chars in ignore_chars:
-        reply = reply.replace(chars, "")
-    if len(reply) >= 4096:
-        reply = reply[:4096]
-    await message.reply_text(reply)
-
-# google
-
-
-@app.on_message(filters.command("google") & ~filters.edited)
-@capture_err
-async def google(_, message):
-    try:
-        if len(message.command) < 2:
-            await message.reply_text('/google Needs An Argument')
-            return
-        text = message.text.split(None, 1)[1]
-        gresults = await GoogleSearch().async_search(text, 1)
-        result = ""
-        for i in range(4):
-            try:
-                title = gresults["titles"][i].replace("\n", " ")
-                source = gresults["links"][i]
-                description = gresults["descriptions"][i]
-                result += f"[{title}]({source})\n"
-                result += f"`{description}`\n\n"
-            except IndexError:
-                pass
-        await message.reply_text(result, disable_web_page_preview=True)
-    except Exception as e:
-        await message.reply_text(str(e))
-
-
-# StackOverflow [This is also a google search with some added args]
-
-
-@app.on_message(filters.command("so") & ~filters.edited)
-@capture_err
-async def stack(_, message):
-    try:
-        if len(message.command) < 2:
-            await message.reply_text('"/so" Needs An Argument')
-            return
-        gett = message.text.split(None, 1)[1]
-        text = gett + ' "site:stackoverflow.com"'
-        gresults = await GoogleSearch().async_search(text, 1)
-        result = ""
-        for i in range(4):
-            try:
-                title = gresults["titles"][i].replace("\n", " ")
-                source = gresults["links"][i]
-                description = gresults["descriptions"][i]
-                result += f"[{title}]({source})\n"
-                result += f"`{description}`\n\n"
-            except IndexError:
-                pass
-        await message.reply_text(result, disable_web_page_preview=True)
-    except Exception as e:
-        await message.reply_text(str(e))
-
-
-# Github [This is also a google search with some added args]
-
-
-@app.on_message(filters.command("gh") & ~filters.edited)
-@capture_err
-async def github(_, message):
-    try:
-        if len(message.command) < 2:
-            await message.reply_text('"/gh" Needs An Argument')
-            return
-        gett = message.text.split(None, 1)[1]
-        text = gett + ' "site:github.com"'
-        gresults = await GoogleSearch().async_search(text, 1)
-        result = ""
-        for i in range(4):
-            try:
-                title = gresults["titles"][i].replace("\n", " ")
-                source = gresults["links"][i]
-                description = gresults["descriptions"][i]
-                result += f"[{title}]({source})\n"
-                result += f"`{description}`\n\n"
-            except IndexError:
-                pass
-        await message.reply_text(result, disable_web_page_preview=True)
-    except Exception as e:
-        await message.reply_text(str(e))
-
-
-# YouTube
-
-
-@app.on_message(filters.command("yt") & ~filters.edited)
-@capture_err
-async def ytsearch(_, message):
-    try:
-        if len(message.command) < 2:
-            await message.reply_text("/yt needs an argument")
-            return
-        query = message.text.split(None, 1)[1]
-        m = await message.reply_text("Searching....")
-        results = await arq.youtube(query, 3)
-        i = 0
-        text = ""
-        while i < 3:
-            text += f"Title - {results[i].title}\n"
-            text += f"Duration - {results[i].duration}\n"
-            text += f"Views - {results[i].views}\n"
-            text += f"Channel - {results[i].channel}\n"
-            text += f"https://youtube.com{results[i].url_suffix}\n\n"
-            i += 1
-        await m.edit(text, disable_web_page_preview=True)
-    except Exception as e:
-        await message.reply_text(str(e))