mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
fix(idevice): fix error commands
This commit is contained in:
23
README.md
23
README.md
@@ -17,17 +17,12 @@
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> This bot is heavily customized and may not be a good starting point template wise. But if you wanna use this bot, or maybe add to your own server, download it by clicking the button below.
|
> **Download**
|
||||||
|
>
|
||||||
|
> This bot is heavily customized and may not be a good starting point template wise. But if you wanna use this bot, or maybe add to your own server, [download](#download) it by clicking the button below. After downloading run `/help` to get started.
|
||||||
|
|
||||||
### Download
|
|
||||||
|
|
||||||
<div align="left">
|
## Commands
|
||||||
<a href="https://discord.com/oauth2/authorize?client_id=1376728824108286034" target="_blank" rel="noopener noreferrer">
|
|
||||||
<img src="assets/download.png" alt="Download" style="width: 300px; height: auto;">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
### Commands
|
|
||||||
|
|
||||||
| Command group | Subcommands |
|
| Command group | Subcommands |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
@@ -39,6 +34,16 @@
|
|||||||
| idevice | `idevice`, `noapps`, `errorcode` |
|
| idevice | `idevice`, `noapps`, `errorcode` |
|
||||||
| miscellaneous | `keanu`, `labubu` |
|
| miscellaneous | `keanu`, `labubu` |
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
<div align="left">
|
||||||
|
<a href="https://discord.com/oauth2/authorize?client_id=1376728824108286034" target="_blank" rel="noopener noreferrer">
|
||||||
|
<img src="assets/download.png" alt="Download" style="width: 300px; height: auto;">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class ErrorCodesBrowserView(discord.ui.View):
|
|||||||
inline=True
|
inline=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add empty fields to maintain 3x3 grid if needed
|
|
||||||
while len(current_codes) % 3 != 0:
|
while len(current_codes) % 3 != 0:
|
||||||
embed.add_field(name="\u200b", value="\u200b", inline=True)
|
embed.add_field(name="\u200b", value="\u200b", inline=True)
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ class ideviceSelect(discord.ui.Select):
|
|||||||
),
|
),
|
||||||
discord.SelectOption(
|
discord.SelectOption(
|
||||||
label="Error Codes",
|
label="Error Codes",
|
||||||
value="errorcodes_ephemeral",
|
value="errorcodes",
|
||||||
description="Browse idevice error codes",
|
description="Browse idevice error codes",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@@ -160,20 +160,39 @@ class ideviceSelect(discord.ui.Select):
|
|||||||
async def callback(self, interaction: discord.Interaction):
|
async def callback(self, interaction: discord.Interaction):
|
||||||
command_name = self.values[0]
|
command_name = self.values[0]
|
||||||
|
|
||||||
if command_name == "errorcodes_ephemeral":
|
if command_name == "errorcodes":
|
||||||
# Send success message first
|
try:
|
||||||
embed = discord.Embed(
|
view = ErrorCodesBrowserView()
|
||||||
title="Command Executed",
|
embed = view.create_embed()
|
||||||
description="Successfully executed `/errorcodes`",
|
|
||||||
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)
|
|
||||||
|
|
||||||
# Follow up with the error codes browser
|
success_embed = discord.Embed(
|
||||||
view = ErrorCodesBrowserView()
|
title="Command Executed",
|
||||||
embed = view.create_embed()
|
description="Successfully executed `/errorcodes`",
|
||||||
await interaction.followup.send(embed=embed, view=view, ephemeral=True)
|
color=0x00FF00
|
||||||
|
)
|
||||||
|
success_embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
||||||
|
await interaction.response.edit_message(embed=success_embed, view=None)
|
||||||
|
|
||||||
|
await interaction.followup.send(embed=embed, view=view, ephemeral=True)
|
||||||
|
|
||||||
|
except discord.Forbidden:
|
||||||
|
self.bot.logger.warning(f"Bot missing permissions in server {interaction.guild.name} (ID: {interaction.guild.id}) - cannot execute errorcodes command")
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot doesn't have the required permissions in this server to execute this command. Use the slash command `/errorcodes` instead.",
|
||||||
|
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)
|
||||||
|
except Exception as e:
|
||||||
|
self.bot.logger.error(f"Error executing errorcodes command: {e}")
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Error",
|
||||||
|
description="An error occurred while executing the command.",
|
||||||
|
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)
|
||||||
return
|
return
|
||||||
|
|
||||||
command = self.bot.get_command(command_name)
|
command = self.bot.get_command(command_name)
|
||||||
@@ -194,7 +213,7 @@ class ideviceSelect(discord.ui.Select):
|
|||||||
self.bot.logger.warning(f"Bot missing permissions in server {interaction.guild.name} (ID: {interaction.guild.id}) - cannot execute {command_name} command")
|
self.bot.logger.warning(f"Bot missing permissions in server {interaction.guild.name} (ID: {interaction.guild.id}) - cannot execute {command_name} command")
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Permission Error",
|
title="Permission Error",
|
||||||
description="The bot doesn't have the required permissions in this server to execute this command. Use the slash command `/{command_name}` instead.",
|
description=f"The bot doesn't have the required permissions in this server to execute this command. Use the slash command `/{command_name}` instead.",
|
||||||
color=0xFF0000
|
color=0xFF0000
|
||||||
)
|
)
|
||||||
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
||||||
|
|||||||
Reference in New Issue
Block a user