|
|
@@ -38,6 +38,8 @@ from roxbot import guild_settings |
|
|
|
|
|
|
|
|
|
|
|
class Scrapper: |
|
|
|
"""Scrapper is a class to aid in the scrapping of reddit subreddit's of images. |
|
|
|
This includes its own caching system.""" |
|
|
|
# TODO: Reimplement eroshare, eroshae, and erome support. Also implement better api interaction with imgur now we require api key |
|
|
|
def __init__(self, cache_limit=10): |
|
|
|
self.post_cache = {} |
|
|
@@ -61,6 +63,7 @@ class Scrapper: |
|
|
|
extensions = ("png", "jpg", "jpeg", "gif", "gifv", "mp4", "webm", "webp") |
|
|
|
for ext in extensions: |
|
|
|
if fnmatch.fnmatch(url.split(".")[-1], ext+"*"): |
|
|
|
# This is fixing issues where urls will have ".png?2" or some shit |
|
|
|
return url |
|
|
|
|
|
|
|
if await self._imgur_removed(url): |
|
|
@@ -209,6 +212,10 @@ class Reddit: |
|
|
|
else: |
|
|
|
text = "" |
|
|
|
|
|
|
|
# Not using a embed here because we can't use video in rich embeds but they work in embeds now :/ |
|
|
|
output = await ctx.send(title + text + url) |
|
|
|
await roxbot.utils.delete_option(self.bot, ctx, output, self.bot.get_emoji(444410658101002261) or "❌") |
|
|
|
|
|
|
|
if ctx.invoked_with == "subreddit" and isinstance(ctx.channel, discord.TextChannel): |
|
|
|
# Only log the command when it is this command being used. Not the inbuilt commands. |
|
|
|
logging = guild_settings.get(ctx.guild)["logging"] |
|
|
@@ -225,10 +232,6 @@ class Reddit: |
|
|
|
Time=roxbot.datetime_formatting.format(ctx.message.created_at) |
|
|
|
) |
|
|
|
|
|
|
|
# Not using a embed here because we can't use video in rich embeds but they work in embeds now :/ |
|
|
|
output = await ctx.send(title + text + url) |
|
|
|
await roxbot.utils.delete_option(self.bot, ctx, output, self.bot.get_emoji(444410658101002261) or "❌") |
|
|
|
|
|
|
|
@commands.command() |
|
|
|
async def aww(self, ctx): |
|
|
|
""" |