about summary refs log tree commit diff stats
path: root/cogs/reddit.py
diff options
context:
space:
mode:
authorNoah <mounderfod@gmail.com>2022-06-09 19:04:20 +0100
committerNoah <mounderfod@gmail.com>2022-06-09 19:04:20 +0100
commita52d31de4fa6b3dbdf9927afc3e87b36c64be0b9 (patch)
treea2f0d907dc3ca93f80d61272729cbdbdc489fa89 /cogs/reddit.py
parent360def71e50fe7c0d879a9c2405aa9fec7291306 (diff)
downloadtiny-potato-bot-a52d31de4fa6b3dbdf9927afc3e87b36c64be0b9.tar.gz
The potato is reborn!
Diffstat (limited to 'cogs/reddit.py')
-rw-r--r--cogs/reddit.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/cogs/reddit.py b/cogs/reddit.py
index 39c4b38..6ff144f 100644
--- a/cogs/reddit.py
+++ b/cogs/reddit.py
@@ -1,11 +1,10 @@
-import nextcord
-from nextcord.errors import InvalidArgument
-from nextcord.ext import commands
-from nextcord import ChannelType
+import os
 import random
+
 import asyncpraw
-import os
 from dotenv import load_dotenv
+from discord import ChannelType
+from discord.ext import commands
 
 load_dotenv()
 reddit = asyncpraw.Reddit(
@@ -14,6 +13,7 @@ reddit = asyncpraw.Reddit(
     user_agent="mounderfod.tpbot:v1.0.0 (by u/mounderfod)"
 )
 
+
 class Reddit(commands.Cog):
     def __init__(self, bot):
         self.bot = bot
@@ -23,22 +23,23 @@ class Reddit(commands.Cog):
     """, aliases=['redd', 'r'])
     async def redditimg(self, ctx, sub):
         sub = await reddit.subreddit(sub)
-        img_posts = [i async for i in sub.hot(limit=100) if not i.is_self and i.domain != "v.redd.it" ]
+        img_posts = [i async for i in sub.hot(limit=100) if not i.is_self and i.domain != "v.redd.it"]
         if len(img_posts) == 0:
-            await ctx.reply("This subreddit has no image posts!", mention_author = False)
+            await ctx.reply("This subreddit has no image posts!", mention_author=False)
         else:
             post = random.choice(img_posts)
             nsfw = post.over_18
             if nsfw and ctx.channel.type == ChannelType.text and not ctx.channel.is_nsfw():
-                await ctx.reply("The selected post is NSFW, and this is not an NSFW channel.", mention_author = False)
+                await ctx.reply("The selected post is NSFW, and this is not an NSFW channel.", mention_author=False)
             else:
                 for i in get_image_embed(post):
                     await ctx.send(i)
-            
+
 
 def setup(bot):
     bot.add_cog(Reddit(bot))
 
+
 def get_image_embed(post):
     result = ["Post by " + post.author.name + ": " + post.title]
     if hasattr(post, "is_gallery"):