|
@@ -1,8 +1,8 @@
|
|
|
import requests as r
|
|
import requests as r
|
|
|
from pyrogram import filters
|
|
from pyrogram import filters
|
|
|
-from wbb import app
|
|
|
|
|
|
|
+from wbb import app, ARQ
|
|
|
from wbb.utils.errors import capture_err
|
|
from wbb.utils.errors import capture_err
|
|
|
-
|
|
|
|
|
|
|
+from wbb.utils.fetch import fetch
|
|
|
|
|
|
|
|
__MODULE__ = "Reddit"
|
|
__MODULE__ = "Reddit"
|
|
|
__HELP__ = "/reddit [query] - results something from reddit"
|
|
__HELP__ = "/reddit [query] - results something from reddit"
|
|
@@ -13,14 +13,13 @@ async def reddit(_, message):
|
|
|
if len(message.command) != 2:
|
|
if len(message.command) != 2:
|
|
|
await message.reply_text("/reddit needs an argument")
|
|
await message.reply_text("/reddit needs an argument")
|
|
|
return
|
|
return
|
|
|
- subreddit = message.command[1]
|
|
|
|
|
- res = r.get(f"https://meme-api.herokuapp.com/gimme/{subreddit}")
|
|
|
|
|
- res = res.json()
|
|
|
|
|
- rpage = res.get(str("subreddit")) # Subreddit
|
|
|
|
|
- title = res.get(str("title")) # Post title
|
|
|
|
|
- memeu = res.get(str("url")) # meme pic url
|
|
|
|
|
- plink = res.get(str("postLink"))
|
|
|
|
|
- caps = f"<b>Title</b>: {title}\n"
|
|
|
|
|
- caps += f"<b>Subreddit: </b>r/{rpage}\n"
|
|
|
|
|
- caps += f"<b>PostLink:</b> {plink}"
|
|
|
|
|
- await message.reply_photo(photo=memeu, caption=(caps))
|
|
|
|
|
|
|
+ subreddit = message.text.split(None, 1)[1]
|
|
|
|
|
+ res = await fetch(f"{ARQ}reddit?query={subreddit}")
|
|
|
|
|
+ sreddit = res["subreddit"]
|
|
|
|
|
+ title = res["title"]
|
|
|
|
|
+ image = res["url"]
|
|
|
|
|
+ link = res["postLink"]
|
|
|
|
|
+ caption = f"""**Title:** `{title}`
|
|
|
|
|
+**Subreddit:** {sreddit}
|
|
|
|
|
+**PostLink:** {link}"""
|
|
|
|
|
+ await message.reply_photo(photo=image, caption=caption)
|