about summary refs log tree commit diff stats
path: root/cogs
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
parent360def71e50fe7c0d879a9c2405aa9fec7291306 (diff)
downloadtiny-potato-bot-a52d31de4fa6b3dbdf9927afc3e87b36c64be0b9.tar.gz
The potato is reborn!
Diffstat (limited to 'cogs')
-rw-r--r--cogs/fun.py19
-rw-r--r--cogs/modrinth.py38
-rw-r--r--cogs/reddit.py19
-rw-r--r--cogs/utils.py22
4 files changed, 33 insertions, 65 deletions
diff --git a/cogs/fun.py b/cogs/fun.py
index ef5ed6f..a891ccf 100644
--- a/cogs/fun.py
+++ b/cogs/fun.py
@@ -1,8 +1,10 @@
-import nextcord
-import requests
-from nextcord.ext import commands
-import urllib.request
 import random
+import urllib.request
+
+import discord
+import requests
+from discord.ext import commands
+
 
 class Fun(commands.Cog):
     def __init__(self, bot):
@@ -24,17 +26,18 @@ class Fun(commands.Cog):
         else:
             url = random.choice(["https://fabric-drama.herokuapp.com/txt", "https://mc-drama.herokuapp.com/raw"])
         response = urllib.request.urlopen(url).read().decode('utf-8')
-        embed = nextcord.Embed(color=0xa37dca)
+        embed = discord.Embed(color=0xa37dca)
         embed.add_field(name=f"{ctx.author.name} caused drama!", value=response, inline=False)
         embed.set_footer(text="Tiny Potato Bot v1.0.0")
         await ctx.send(embed=embed)
 
-    @commands.command(name="xkcd", brief="Gets XKCD comics.", help="Gets comics from https://xkcd.com, with the given number.")
+    @commands.command(name="xkcd", brief="Gets XKCD comics.",
+                      help="Gets comics from https://xkcd.com, with the given number.")
     async def xkcd(self, ctx, comic=None):
         if comic is None:
             try:
                 response = requests.get('https://xkcd.com/info.0.json').json()
-                embed = nextcord.Embed(title=f"XKCD {response['num']}: {response['safe_title']}", colour=0xa37dca)
+                embed = discord.Embed(title=f"XKCD {response['num']}: {response['safe_title']}", colour=0xa37dca)
                 embed.set_image(url=response['img'])
                 embed.set_footer(text=response['alt'])
                 await ctx.send(embed=embed)
@@ -45,7 +48,7 @@ class Fun(commands.Cog):
         else:
             try:
                 response = requests.get(f'https://xkcd.com/{comic}/info.0.json').json()
-                embed = nextcord.Embed(title=f"XKCD {response['num']}: {response['safe_title']}", colour=0xa37dca)
+                embed = discord.Embed(title=f"XKCD {response['num']}: {response['safe_title']}", colour=0xa37dca)
                 embed.set_image(url=response['img'])
                 embed.set_footer(text=response['alt'])
                 await ctx.send(embed=embed)
diff --git a/cogs/modrinth.py b/cogs/modrinth.py
deleted file mode 100644
index 0dddc78..0000000
--- a/cogs/modrinth.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import nextcord
-from nextcord.ext import commands
-import requests, datetime, math
-
-class Modrinth(commands.Cog):
-    def __init__(self, bot):
-        self.bot = bot
-
-    @commands.command(name="modrinthmod", brief="Finds a given mod on Modrinth.", help="""Finds a given mod on Modrinth.
-    You can provide either the slug (`fabric-for-fabric`) or the project ID (`u6KTKg89`).
-    If you get a JSONDecodeError it's because the mod could not be found!""", aliases=['mrmod', 'modrmod'])
-    async def modrinth_mod(self, ctx, mod): # 5da426
-        response = requests.get(f'https://api.modrinth.com/api/v1/mod/{mod}').json()
-        embed = nextcord.Embed(title = response['title'], url=f'https://modrinth.com/mod/{mod}', description = response['description'], color = 0x5da426)
-        embed.set_thumbnail(url = response['icon_url'])
-        embed.add_field(name='Mod ID', value = response['id'], inline=True)
-        embed.add_field(name='Categories', value = ', '.join(response['categories']), inline=True)
-        embed.add_field(name='Downloads', value = response['downloads'], inline=True)
-        embed.set_footer(text='Tiny Potato Bot')
-        await ctx.send(embed=embed)
-
-    @commands.command(name="modrinthuser", brief="Finds a given user on Modrinth.", help="""Finds a given user on Modrinth.
-        You can provide either the username (`redcreeper14385`) or the user ID (`pdimDmDX`).
-        If you get a JSONDecodeError it's because the user could not be found!""", aliases=['mruser', 'modruser'])
-    async def modrinth_user(self, ctx, user):  # 5da426
-        response = requests.get(f'https://api.modrinth.com/api/v1/user/{user}').json()
-        embed = nextcord.Embed(title=response['username'], url=f'https://modrinth.com/user/{user}',
-                              description=response['bio'], color=0x5da426)
-        embed.set_thumbnail(url=response['avatar_url'])
-        embed.add_field(name='User ID', value=response['id'], inline=True)
-        embed.add_field(name='Registered', value=f"<t:{math.trunc(datetime.datetime.fromisoformat(response['created'].replace('Z', '')).timestamp())}:R>", inline=True)
-        embed.add_field(name='Role', value=response['role'].capitalize(), inline=True)
-        embed.set_footer(text='Tiny Potato Bot')
-        await ctx.send(embed=embed)
-
-
-def setup(bot):
-    bot.add_cog(Modrinth(bot))
\ No newline at end of file
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"):
diff --git a/cogs/utils.py b/cogs/utils.py
index 4657ad2..a574249 100644
--- a/cogs/utils.py
+++ b/cogs/utils.py
@@ -1,5 +1,6 @@
-import nextcord
-from nextcord.ext import commands
+import discord
+from discord.ext import commands
+
 
 class Utils(commands.Cog):
     def __init__(self, bot):
@@ -7,15 +8,16 @@ class Utils(commands.Cog):
 
     @commands.command(name="about", brief="Gives information about the bot.", help="Gives information about the bot.")
     async def about(self, ctx):
-        embed = nextcord.Embed(title="Tiny Potato Bot",
-                              description="The creator of Tiny Potato Bot is mounderfod (aka redcreeper14385), find him here:",
+        embed = discord.Embed(title="Tiny Potato Bot",
+                              description="The creator of Tiny Potato Bot is mounderfod (aka CraftVoltage), find him here:",
                               color=0xa37dca)
-        embed.add_field(name="GitHub", value="https://github.com/redcreeper14385", inline=False)
-        embed.add_field(name="Twitch", value="https://twitch.tv/mounderfod", inline=False)
-        embed.add_field(name="Discord", value="mounderfod#4179", inline=False)
-        embed.add_field(name="Reddit", value="https://www.reddit.com/user/mounderfod", inline=False)
-        embed.set_footer(text="Tiny Potato Bot v1.0.0")
+        embed.add_field(name="GitHub", value="https://github.com/mounderfod", inline=False)
+        embed.add_field(name="Twitch", value="https://twitch.tv/mounderfod_", inline=False)
+        embed.add_field(name="Discord", value="mounderfod#5949", inline=False)
+        embed.add_field(name="Reddit", value="https://www.reddit.com/user/craftvoltage", inline=False)
+        embed.set_footer(text="Tiny Potato Bot v2.0.0")
         await ctx.send(embed=embed)
 
+
 def setup(bot):
-    bot.add_cog(Utils(bot))
\ No newline at end of file
+    bot.add_cog(Utils(bot))