diff --git a/TODO.md b/TODO.md index ddaee96..bc0ef07 100644 --- a/TODO.md +++ b/TODO.md @@ -1,9 +1,10 @@ # Todo List for Syntrel -- [x] Finish [idevice commands](https://github.com/jkcoxson/idevice/blob/master/idevice/src/lib.rs#L522) +- [ ] Finish [idevice commands](https://github.com/jkcoxson/idevice/blob/master/idevice/src/lib.rs#L522) - [x] Add /idevice command - [x] Add /no apps command - [x] Add rest of the errors yikes + - [ ] Add ddi mounting command - [ ] Add unit tests diff --git a/cogs/general/help.py b/cogs/general/help.py index 27d1b5d..de496f1 100644 --- a/cogs/general/help.py +++ b/cogs/general/help.py @@ -77,6 +77,7 @@ class Help(commands.Cog, name="help"): # idevice Commands "idevice": "idevice", "noapps": "idevice", + "errorcode": "idevice", # Owner Commands "sync": "owner", diff --git a/cogs/idevice/error_codes.py b/cogs/idevice/error_codes.py index e41b08f..9f00fb9 100644 --- a/cogs/idevice/error_codes.py +++ b/cogs/idevice/error_codes.py @@ -3,6 +3,7 @@ import os import discord from discord import app_commands from discord.ext import commands +from discord.ext.commands import Context class ErrorCodes(commands.Cog, name="errorcodes"): @@ -34,10 +35,10 @@ class ErrorCodes(commands.Cog, name="errorcodes"): break return items - @app_commands.command(name="errorcode", description="Look up an idevice error code by name or number") + @commands.hybrid_command(name="errorcode", description="Look up an idevice error code by name or number") @app_commands.describe(name="Start typing to search all error names and codes") @app_commands.autocomplete(name=errorcode_autocomplete) - async def errorcode(self, interaction: discord.Interaction, name: str): + async def errorcode(self, context: Context, name: str): key = name if key not in self.key_to_data: try: @@ -46,7 +47,10 @@ class ErrorCodes(commands.Cog, name="errorcodes"): except ValueError: key = None if key is None or key not in self.key_to_data: - await interaction.response.send_message("Error not found.", ephemeral=True) + if context.interaction: + await context.interaction.response.send_message("Error not found.", ephemeral=True) + else: + await context.send("Error not found.") return title, code = self.key_to_data[key] @@ -65,7 +69,10 @@ class ErrorCodes(commands.Cog, name="errorcodes"): emoji="<:githubicon:1417717356846776340>" )) - await interaction.response.send_message(embed=embed, view=view) + 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: cog = ErrorCodes(bot)