diff options
author | redcreeper14385 <mounderfod@gmail.com> | 2021-08-31 17:56:00 +0100 |
---|---|---|
committer | redcreeper14385 <mounderfod@gmail.com> | 2021-08-31 17:56:00 +0100 |
commit | 45ddeff3ec499e79d82ee265d729c8e0c453e020 (patch) | |
tree | c643caf0c078ba505c3e6bcfd157a44b265f536d | |
parent | 75045f045f1fc524b6a0f5e7b40a87dffc377cdf (diff) | |
download | tiny-potato-bot-45ddeff3ec499e79d82ee265d729c8e0c453e020.tar.gz |
Port to nextcord :D
-rw-r--r-- | bot.py | 6 | ||||
-rw-r--r-- | bot_utils.py | 8 | ||||
-rw-r--r-- | cogs/fun.py | 10 | ||||
-rw-r--r-- | cogs/modrinth.py | 8 | ||||
-rw-r--r-- | cogs/utils.py | 6 | ||||
-rw-r--r-- | requirements.txt | 6 |
6 files changed, 22 insertions, 22 deletions
diff --git a/bot.py b/bot.py index 8db368b..c6b9ba7 100644 --- a/bot.py +++ b/bot.py @@ -1,11 +1,11 @@ -import discord -from discord.ext import commands +import nextcord +from nextcord.ext import commands import os from dotenv import load_dotenv import bot_utils load_dotenv() -bot = commands.Bot(command_prefix="t!", activity=discord.Activity(name="for commands", type=discord.ActivityType.watching)) +bot = commands.Bot(command_prefix="t!", activity=nextcord.Activity(name="for commands", type=nextcord.ActivityType.watching)) bot.help_command = bot_utils.MyHelpCommand(command_attrs={'hidden':True}) @bot.event diff --git a/bot_utils.py b/bot_utils.py index 98fa8de..bed54d7 100644 --- a/bot_utils.py +++ b/bot_utils.py @@ -1,5 +1,5 @@ -import discord -from discord.ext import commands +import nextcord +from nextcord.ext import commands async def parse_error(ctx, error): if hasattr(ctx.command, 'on_error'): @@ -12,7 +12,7 @@ async def parse_error(ctx, error): if isinstance(error, commands.CommandNotFound): pass else: - embed = discord.Embed(title="An error occurred!", color=0xc71a1a) + embed = nextcord.Embed(title="An error occurred!", color=0xc71a1a) embed.set_thumbnail(url="https://cdn.discordapp.com/emojis/798974923954978817.png?v=1") embed.add_field(name=type(error).__name__, value=error, inline=False) embed.set_footer(text="Tiny Potato Bot") @@ -21,7 +21,7 @@ async def parse_error(ctx, error): class MyHelpCommand(commands.MinimalHelpCommand): async def send_pages(self): destination = self.get_destination() - e = discord.Embed(color=0xa37dca, description='') + e = nextcord.Embed(color=0xa37dca, description='') for page in self.paginator.pages: e.description += page await destination.send(embed=e) \ No newline at end of file diff --git a/cogs/fun.py b/cogs/fun.py index c105934..297fb67 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -1,6 +1,6 @@ -import discord +import nextcord import requests -from discord.ext import commands +from nextcord.ext import commands import urllib.request import random @@ -24,7 +24,7 @@ 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 = discord.Embed(color=0xa37dca) + embed = nextcord.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) @@ -38,7 +38,7 @@ class Fun(commands.Cog): if comic is None: try: response = requests.get('https://xkcd.com/info.0.json').json() - embed = discord.Embed(title=f"XKCD {response['num']}: {response['safe_title']}", colour=0xa37dca) + embed = nextcord.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) @@ -49,7 +49,7 @@ class Fun(commands.Cog): else: try: response = requests.get(f'https://xkcd.com/{comic}/info.0.json').json() - embed = discord.Embed(title=f"XKCD {response['num']}: {response['safe_title']}", colour=0xa37dca) + embed = nextcord.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 index dff091b..0dddc78 100644 --- a/cogs/modrinth.py +++ b/cogs/modrinth.py @@ -1,5 +1,5 @@ -import discord -from discord.ext import commands +import nextcord +from nextcord.ext import commands import requests, datetime, math class Modrinth(commands.Cog): @@ -11,7 +11,7 @@ class Modrinth(commands.Cog): 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 = discord.Embed(title = response['title'], url=f'https://modrinth.com/mod/{mod}', description = response['description'], color = 0x5da426) + 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) @@ -24,7 +24,7 @@ class Modrinth(commands.Cog): 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 = discord.Embed(title=response['username'], url=f'https://modrinth.com/user/{user}', + 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) diff --git a/cogs/utils.py b/cogs/utils.py index c06049b..4657ad2 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -1,5 +1,5 @@ -import discord -from discord.ext import commands +import nextcord +from nextcord.ext import commands class Utils(commands.Cog): def __init__(self, bot): @@ -7,7 +7,7 @@ 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 = discord.Embed(title="Tiny Potato Bot", + embed = nextcord.Embed(title="Tiny Potato Bot", description="The creator of Tiny Potato Bot is mounderfod (aka redcreeper14385), find him here:", color=0xa37dca) embed.add_field(name="GitHub", value="https://github.com/redcreeper14385", inline=False) diff --git a/requirements.txt b/requirements.txt index 1acc1d9..96e273e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -discord ~= 1.7 -python-dotenv ~= 0.18.0 +python-dotenv == 0.19.0 requests ~= 2.26.0 -jishaku ~= 2.2.0 \ No newline at end of file +jishaku ==2.2.0 +nextcord~=2.0.0a1 \ No newline at end of file |