From a0a85d877a7a576af17a1176a052df35a220fde0 Mon Sep 17 00:00:00 2001 From: neoarz Date: Fri, 19 Sep 2025 20:14:02 -0400 Subject: [PATCH] feat(idevice): create idevice category and first commands Implemented the /idevice command with a dropdown for troubleshooting options and added the /noapps command to assist users when apps aren't showing in the installed apps view. Updated TODO.md to reflect completed tasks. --- TODO.md | 8 ++--- cogs/idevice/idevice.py | 75 +++++++++++++++++++++++++++++++++++++++-- cogs/idevice/noapps.py | 47 ++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 cogs/idevice/noapps.py diff --git a/TODO.md b/TODO.md index 6611fba..5760387 100644 --- a/TODO.md +++ b/TODO.md @@ -1,11 +1,11 @@ # Todo List for Syntrel [ ] Finish [idevice commands](https://github.com/jkcoxson/idevice/blob/master/idevice/src/lib.rs#L522) -> [ ] Add /idevice command -> -> [ ] Add /idevice-pair command +> [X] Add /idevice command > -> [ ] Add /no apps command +> [X] Add /no apps command +> +> [ ] Add rest of the errors yikes [ ] Add unit tests diff --git a/cogs/idevice/idevice.py b/cogs/idevice/idevice.py index 5360f64..a47c834 100644 --- a/cogs/idevice/idevice.py +++ b/cogs/idevice/idevice.py @@ -1,3 +1,74 @@ -async def setup(bot) -> None: - pass +import discord +from discord import app_commands +from discord.ext import commands +from discord.ext.commands import Context + +class IdeviceSelect(discord.ui.Select): + def __init__(self, bot): + self.bot = bot + options = [ + discord.SelectOption( + label="No Apps", + value="noapps", + description="Help when apps aren't showing in installed apps view", + ) + ] + super().__init__(placeholder="Choose an iDevice command...", options=options) + + async def callback(self, interaction: discord.Interaction): + command_name = self.values[0] + command = self.bot.get_command(command_name) + + if command: + ctx = await self.bot.get_context(interaction.message) + if ctx: + await ctx.invoke(command) + embed = discord.Embed( + title="Command Executed", + description=f"Successfully executed `/{command_name}`", + color=0x00FF00 + ) + embed.set_author(name="iDevice", icon_url="https://yes.nighty.works/raw/snLMuO.png") + await interaction.response.edit_message(embed=embed, view=None) + else: + embed = discord.Embed( + title="Error", + description="Command not found!", + color=0xFF0000 + ) + embed.set_author(name="iDevice", icon_url="https://yes.nighty.works/raw/snLMuO.png") + await interaction.response.edit_message(embed=embed, view=None) + + +class IdeviceView(discord.ui.View): + def __init__(self, bot): + super().__init__() + self.add_item(IdeviceSelect(bot)) + + +class Idevice(commands.Cog, name="idevice"): + def __init__(self, bot) -> None: + self.bot = bot + + @commands.hybrid_command( + name="idevice", description="iDevice troubleshooting and help" + ) + async def idevice(self, context: Context) -> None: + embed = discord.Embed( + title="iDevice Commands", + description="Choose a command from the dropdown below to get help with specific issues:", + color=0xfa8c4a + ) + embed.set_author(name="iDevice", icon_url="https://yes.nighty.works/raw/snLMuO.png") + + view = IdeviceView(self.bot) + + if context.interaction: + 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(Idevice(bot)) diff --git a/cogs/idevice/noapps.py b/cogs/idevice/noapps.py new file mode 100644 index 0000000..8f52685 --- /dev/null +++ b/cogs/idevice/noapps.py @@ -0,0 +1,47 @@ +import discord +from discord import app_commands +from discord.ext import commands +from discord.ext.commands import Context +import time + + +class Noapps(commands.Cog, name="noapps"): + def __init__(self, bot) -> None: + self.bot = bot + + @commands.hybrid_command( + name="noapps", description="Help when apps aren't showing in installed apps view" + ) + async def noapps(self, context: Context) -> None: + embed = discord.Embed( + color=0xfa8c4a, + description=( + '# Apps Not Showing in Installed Apps View\n\n---\n\n' + + 'If apps aren\'t appearing in the StikDebug installed apps view, this is likely because they were signed with a distribution certificate instead of a development certificate.\n\n' + + 'Distribution certificates lack the `get-task-allow` entitlement needed for JIT.\n\n' + + 'To fix this issue:\n' + + '- Use a development certificate when signing apps, or\n' + + '- Try SideStore, the best free sideloading method available\n\n' + + 'More details can be found at [SideStore\'s official website](https://sidestore.io/)' + ) + ) + embed.set_author(name="iDevice", icon_url="https://yes.nighty.works/raw/snLMuO.png") + embed.set_footer(text=f'Last Edited by neoarz') + embed.timestamp = discord.utils.utcnow() + + view = discord.ui.View() + view.add_item(discord.ui.Button( + label="Edit Command", + style=discord.ButtonStyle.secondary, + url="https://github.com/neoarz/Syntrel/blob/main/cogs/idevice/noapps.py", + emoji="<:githubicon:1417717356846776340>" + )) + + if context.interaction: + await context.interaction.response.send_message(embed=embed, view=view) + else: + await context.send(embed=embed, view=view) + + +async def setup(bot) -> None: + await bot.add_cog(Noapps(bot))