diff --git a/bot.py b/bot.py index 6c7e635..b30784b 100644 --- a/bot.py +++ b/bot.py @@ -90,7 +90,7 @@ class DiscordBot(commands.Bot): if os.path.exists(init_file): try: await self.load_extension(f"cogs.{folder}") - if folder not in ["fun", "general", "idevice", "miscellaneous", "moderation"]: + if folder not in ["fun", "general", "idevice", "miscellaneous", "moderation", "owner", "sidestore"]: self.logger.info(f"Loaded extension '{folder}'") except Exception as e: exception = f"{type(e).__name__}: {e}" diff --git a/cogs/help.py b/cogs/help.py index 50941a3..876ca57 100644 --- a/cogs/help.py +++ b/cogs/help.py @@ -166,7 +166,7 @@ class Help(commands.Cog, name="help"): commands_in_category.append((app_command.name, description)) seen_names.add(app_command.name) - if hasattr(app_command, 'commands') and category in ["fun", "general", "idevice", "miscellaneous", "moderation"]: + if hasattr(app_command, 'commands') and category in ["fun", "general", "idevice", "miscellaneous", "moderation", "owner", "sidestore"]: for subcommand in app_command.commands: if subcommand.name in seen_names: continue diff --git a/cogs/sidestore/__init__.py b/cogs/sidestore/__init__.py new file mode 100644 index 0000000..3e6ce1c --- /dev/null +++ b/cogs/sidestore/__init__.py @@ -0,0 +1,104 @@ +import discord +from discord.ext import commands +from discord.ext.commands import Context + +from .sidestore import sidestore_command +from .refresh import refresh_command +from .code import code_command +from .crash import crash_command +from .pairing import pairing_command +from .server import server_command +from .afc import afc_command +from .udid import udid_command +from .half import half_command +from .sparse import sparse_command + +class Sidestore(commands.GroupCog, name="sidestore"): + def __init__(self, bot) -> None: + self.bot = bot + super().__init__() + + @commands.hybrid_command( + name="sidestore", + description="SideStore troubleshooting help" + ) + async def sidestore(self, context): + return await sidestore_command()(self, context) + + @commands.hybrid_command( + name="refresh", + description="Help with refreshing or installing apps" + ) + async def refresh(self, context): + return await refresh_command()(self, context) + + @commands.hybrid_command( + name="code", + description="No code received when signing in with Apple ID" + ) + async def code(self, context): + return await code_command()(self, context) + + @commands.hybrid_command( + name="crash", + description="Help with SideStore crashing issues" + ) + async def crash(self, context): + return await crash_command()(self, context) + + @commands.hybrid_command( + name="pairing", + description="Help with pairing file issues" + ) + async def pairing(self, context): + return await pairing_command()(self, context) + + @commands.hybrid_command( + name="server", + description="Help with anisette server issues" + ) + async def server(self, context): + return await server_command()(self, context) + + @commands.hybrid_command( + name="afc", + description="Help with AFC Connection Failure issues" + ) + async def afc(self, context): + return await afc_command()(self, context) + + @commands.hybrid_command( + name="udid", + description="SideStore could not determine device UDID" + ) + async def udid(self, context): + return await udid_command()(self, context) + + @commands.hybrid_command( + name="half", + description="Help with half-installed apps" + ) + async def half(self, context): + return await half_command()(self, context) + + @commands.hybrid_command( + name="sparse", + description="Help with sparse bundle issues" + ) + async def sparse(self, context): + return await sparse_command()(self, context) + +async def setup(bot) -> None: + cog = Sidestore(bot) + await bot.add_cog(cog) + + bot.logger.info("Loaded extension 'sidestore.sidestore'") + bot.logger.info("Loaded extension 'sidestore.refresh'") + bot.logger.info("Loaded extension 'sidestore.code'") + bot.logger.info("Loaded extension 'sidestore.crash'") + bot.logger.info("Loaded extension 'sidestore.pairing'") + bot.logger.info("Loaded extension 'sidestore.server'") + bot.logger.info("Loaded extension 'sidestore.afc'") + bot.logger.info("Loaded extension 'sidestore.udid'") + bot.logger.info("Loaded extension 'sidestore.half'") + bot.logger.info("Loaded extension 'sidestore.sparse'") diff --git a/cogs/sidestore/afc.py b/cogs/sidestore/afc.py index 05d218e..5017fea 100644 --- a/cogs/sidestore/afc.py +++ b/cogs/sidestore/afc.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Afc(commands.Cog, name="afc"): - def __init__(self, bot) -> None: - self.bot = bot - +def afc_command(): @commands.hybrid_command( name="afc", description="Help with AFC Connection Failure issues" ) - async def afc(self, context: Context) -> None: + async def afc(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -45,5 +42,4 @@ class Afc(commands.Cog, name="afc"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Afc(bot)) + return afc diff --git a/cogs/sidestore/code.py b/cogs/sidestore/code.py index 494fde6..d641036 100644 --- a/cogs/sidestore/code.py +++ b/cogs/sidestore/code.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Code(commands.Cog, name="code"): - def __init__(self, bot) -> None: - self.bot = bot - +def code_command(): @commands.hybrid_command( name="code", description="No code received when signing in with Apple ID" ) - async def code(self, context: Context) -> None: + async def code(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -59,5 +56,4 @@ class Code(commands.Cog, name="code"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Code(bot)) + return code diff --git a/cogs/sidestore/crash.py b/cogs/sidestore/crash.py index 2f0daaf..36f99e4 100644 --- a/cogs/sidestore/crash.py +++ b/cogs/sidestore/crash.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Crash(commands.Cog, name="crash"): - def __init__(self, bot) -> None: - self.bot = bot - +def crash_command(): @commands.hybrid_command( name="crash", description="Help with SideStore crashing issues" ) - async def crash(self, context: Context) -> None: + async def crash(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -43,5 +40,4 @@ class Crash(commands.Cog, name="crash"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Crash(bot)) + return crash diff --git a/cogs/sidestore/half.py b/cogs/sidestore/half.py index 96fa8fe..00889c8 100644 --- a/cogs/sidestore/half.py +++ b/cogs/sidestore/half.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Half(commands.Cog, name="half"): - def __init__(self, bot) -> None: - self.bot = bot - +def half_command(): @commands.hybrid_command( name="half", description="Help when apps get stuck installing" ) - async def half(self, context: Context) -> None: + async def half(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -52,5 +49,4 @@ class Half(commands.Cog, name="half"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Half(bot)) + return half diff --git a/cogs/sidestore/pairing.py b/cogs/sidestore/pairing.py index 28f6e57..22730c8 100644 --- a/cogs/sidestore/pairing.py +++ b/cogs/sidestore/pairing.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Pairing(commands.Cog, name="pairing"): - def __init__(self, bot) -> None: - self.bot = bot - +def pairing_command(): @commands.hybrid_command( name="pairing", description="Help with pairing file issues" ) - async def pairing(self, context: Context) -> None: + async def pairing(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -57,5 +54,4 @@ class Pairing(commands.Cog, name="pairing"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Pairing(bot)) + return pairing diff --git a/cogs/sidestore/refresh.py b/cogs/sidestore/refresh.py index cbe5b43..08a47fe 100644 --- a/cogs/sidestore/refresh.py +++ b/cogs/sidestore/refresh.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Refresh(commands.Cog, name="refresh"): - def __init__(self, bot) -> None: - self.bot = bot - +def refresh_command(): @commands.hybrid_command( name="refresh", description="Help with refreshing or installing apps" ) - async def refresh(self, context: Context) -> None: + async def refresh(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -47,5 +44,4 @@ class Refresh(commands.Cog, name="refresh"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Refresh(bot)) + return refresh diff --git a/cogs/sidestore/server.py b/cogs/sidestore/server.py index 37e7fb6..4d2a6cf 100644 --- a/cogs/sidestore/server.py +++ b/cogs/sidestore/server.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Server(commands.Cog, name="server"): - def __init__(self, bot) -> None: - self.bot = bot - +def server_command(): @commands.hybrid_command( name="server", description="Help with anisette server issues" ) - async def server(self, context: Context) -> None: + async def server(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -51,5 +48,4 @@ class Server(commands.Cog, name="server"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Server(bot)) + return server diff --git a/cogs/sidestore/sidestore.py b/cogs/sidestore/sidestore.py index f84a6c7..8433b37 100644 --- a/cogs/sidestore/sidestore.py +++ b/cogs/sidestore/sidestore.py @@ -107,14 +107,11 @@ class SidestoreView(discord.ui.View): self.add_item(SidestoreSelect(bot)) -class Sidestore(commands.Cog, name="sidestore"): - def __init__(self, bot) -> None: - self.bot = bot - +def sidestore_command(): @commands.hybrid_command( name="sidestore", description="SideStore troubleshooting and help" ) - async def sidestore(self, context: Context) -> None: + async def sidestore(self, context): embed = discord.Embed( title="SideStore Commands", description="Choose a command from the dropdown below to get help with specific issues:", @@ -128,7 +125,5 @@ class Sidestore(commands.Cog, name="sidestore"): await context.interaction.response.send_message(embed=embed, view=view, ephemeral=True) else: await context.send(embed=embed, view=view) - - -async def setup(bot) -> None: - await bot.add_cog(Sidestore(bot)) + + return sidestore diff --git a/cogs/sidestore/sparse.py b/cogs/sidestore/sparse.py index 4c2dd01..e039bc8 100644 --- a/cogs/sidestore/sparse.py +++ b/cogs/sidestore/sparse.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Sparse(commands.Cog, name="sparse"): - def __init__(self, bot) -> None: - self.bot = bot - +def sparse_command(): @commands.hybrid_command( name="sparse", description="Information about SparseRestore exploit" ) - async def sparse(self, context: Context) -> None: + async def sparse(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -46,5 +43,4 @@ class Sparse(commands.Cog, name="sparse"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Sparse(bot)) + return sparse diff --git a/cogs/sidestore/udid.py b/cogs/sidestore/udid.py index f15f649..660d5e1 100644 --- a/cogs/sidestore/udid.py +++ b/cogs/sidestore/udid.py @@ -5,14 +5,11 @@ from discord.ext.commands import Context import time -class Udid(commands.Cog, name="udid"): - def __init__(self, bot) -> None: - self.bot = bot - +def udid_command(): @commands.hybrid_command( name="udid", description="SideStore could not determine device UDID" ) - async def udid(self, context: Context) -> None: + async def udid(self, context): embed = discord.Embed( color=0x8e82f9, description=( @@ -45,5 +42,4 @@ class Udid(commands.Cog, name="udid"): await context.send(embed=embed, view=view) -async def setup(bot) -> None: - await bot.add_cog(Udid(bot)) + return udid