TheHamkerCat před 5 roky
rodič
revize
49690cee18
1 změnil soubory, kde provedl 25 přidání a 6 odebrání
  1. 25 6
      wbb/modules/search.py

+ 25 - 6
wbb/modules/search.py

@@ -2,14 +2,33 @@ from search_engine_parser import GoogleSearch
 from pyrogram import filters
 from wbb import app, arq
 from wbb.utils.errors import capture_err
-
+from wikipedia import summary
 
 __MODULE__ = "Search"
-__HELP__ = '''/ud - Search For Something In Urban Dictionary
-/google - Search For Something On Google
-/so - Search For Something On Stack OverFlow
-/gh - Search For Something On GitHub
-/yt - Search For Something On YouTube'''
+__HELP__ = '''/wiki - Query Wikipedia
+/ud - Query Urban Dictionary
+/google - Query Google
+/so - Query Stack OverFlow
+/gh - Query GitHub
+/yt - Query YouTube'''
+
+
+# wikipedia
+
+@app.on_message(filters.command("wiki") & ~filters.edited)
+async def wiki(_, message):
+    if len(message.command) != 2:
+        await message.reply_text("'**/wiki** Needs An Argument")
+        return
+    m = await message.reply_text("Searching")
+    await m.edit(
+            summary
+            (
+                message.text.split(None ,1)[1],
+                sentences = 3
+                )
+            )
+
 
 # ud -  urbandictionary