diff --git a/extensions/pokemon.py b/extensions/pokemon.py index ed13565..45788a1 100644 --- a/extensions/pokemon.py +++ b/extensions/pokemon.py @@ -6,9 +6,8 @@ import os import json import math import time -import aiohttp -class Pokemon(commands.Cog): +class PokemonGame(commands.Cog): def __init__(self, bot): self.bot = bot @@ -16,9 +15,17 @@ class Pokemon(commands.Cog): self.data_dir = "data/pokemon/" self.folder_setup() + def folder_setup(self): + try: + if not os.path.exists(self.working_dir): + os.mkdir(self.working_dir) + if not os.path.exists(self.data_dir): + os.mkdir(self.data_dir) + except: + print("PokemonGame failed to make directories") + async def get_json(self, url): - http_session = aiohttp.ClientSession() - async with http_session.get(url) as resp: + async with self.bot.http_session.get(url) as resp: json_data = await resp.json() return json_data @@ -275,4 +282,4 @@ class Pokemon(commands.Cog): await ctx.channel.send(message) async def setup(bot): - bot.add_cog(Pokemon) + await bot.add_cog(PokemonGame(bot)) diff --git a/sparkytron3000.py b/sparkytron3000.py index 0612c08..06cf6ac 100644 --- a/sparkytron3000.py +++ b/sparkytron3000.py @@ -30,10 +30,9 @@ ftp_public_html = os.getenv('ftp_public_html') #discord setup START intents = discord.Intents.default() intents.message_content = True -bot = commands.Bot(command_prefix='!', intents=intents) +bot = commands.Bot(command_prefix='?', intents=intents) #discord setup END - async def handle_error(error): print(error) @@ -243,7 +242,7 @@ async def on_message(ctx): await react_to_msg(ctx, channel_vars["react_to_msgs"]) #emoji reactions - if channel_vars["commands_enabled"] or (ctx.author.id == 242018983241318410 and ctx.content[0] == "!"): + if channel_vars["commands_enabled"] or (ctx.author.id == 242018983241318410 and ctx.content[0] == "?"): await bot.process_commands(ctx) if not channel_vars["commands_enabled"]: await ctx.channel.send("This command only ran because you set it to allow to run even when commands are disabled")