2025-09-19 20:14:02 -04:00
import discord
from discord import app_commands
from discord . ext import commands
from discord . ext . commands import Context
2025-09-22 09:11:05 -04:00
class ideviceSelect ( discord . ui . Select ) :
2025-09-19 20:14:02 -04:00
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 " ,
)
]
2025-09-22 09:11:05 -04:00
super ( ) . __init__ ( placeholder = " Choose an idevice command... " , options = options )
2025-09-19 20:14:02 -04:00
async def callback ( self , interaction : discord . Interaction ) :
command_name = self . values [ 0 ]
command = self . bot . get_command ( command_name )
if command :
2025-09-22 00:21:23 -04:00
try :
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
)
2025-09-22 09:11:05 -04:00
embed . set_author ( name = " idevice " , icon_url = " https://yes.nighty.works/raw/snLMuO.png " )
2025-09-22 00:21:23 -04:00
await interaction . response . edit_message ( embed = embed , view = None )
except discord . Forbidden :
self . bot . logger . warning ( f " Bot missing permissions in server { interaction . guild . name } (ID: { interaction . guild . id } ) - cannot execute { command_name } command " )
2025-09-19 20:14:02 -04:00
embed = discord . Embed (
2025-09-22 00:21:23 -04:00
title = " Permission Error " ,
description = " The bot doesn ' t have the required permissions in this server to execute commands. Please contact a server administrator to add the bot to the server. " ,
color = 0xFF0000
)
2025-09-22 09:11:05 -04:00
embed . set_author ( name = " idevice " , icon_url = " https://yes.nighty.works/raw/snLMuO.png " )
2025-09-22 00:21:23 -04:00
await interaction . response . edit_message ( embed = embed , view = None )
except Exception as e :
self . bot . logger . error ( f " Error executing { command_name } command: { e } " )
embed = discord . Embed (
title = " Error " ,
description = " An error occurred while executing the command. " ,
color = 0xFF0000
2025-09-19 20:14:02 -04:00
)
2025-09-22 09:11:05 -04:00
embed . set_author ( name = " idevice " , icon_url = " https://yes.nighty.works/raw/snLMuO.png " )
2025-09-19 20:14:02 -04:00
await interaction . response . edit_message ( embed = embed , view = None )
else :
embed = discord . Embed (
title = " Error " ,
description = " Command not found! " ,
color = 0xFF0000
)
2025-09-22 09:11:05 -04:00
embed . set_author ( name = " idevice " , icon_url = " https://yes.nighty.works/raw/snLMuO.png " )
2025-09-19 20:14:02 -04:00
await interaction . response . edit_message ( embed = embed , view = None )
2025-09-22 09:11:05 -04:00
class ideviceView ( discord . ui . View ) :
2025-09-19 20:14:02 -04:00
def __init__ ( self , bot ) :
super ( ) . __init__ ( )
2025-09-22 09:11:05 -04:00
self . add_item ( ideviceSelect ( bot ) )
2025-09-17 08:30:05 -04:00
2025-09-19 20:14:02 -04:00
2025-09-22 09:11:05 -04:00
class idevice ( commands . Cog , name = " idevice " ) :
2025-09-19 20:14:02 -04:00
def __init__ ( self , bot ) - > None :
self . bot = bot
@commands.hybrid_command (
2025-09-19 20:39:49 -04:00
name = " idevice " , description = " idevice troubleshooting and help "
2025-09-19 20:14:02 -04:00
)
async def idevice ( self , context : Context ) - > None :
embed = discord . Embed (
2025-09-19 20:39:49 -04:00
title = " idevice Commands " ,
2025-09-19 20:14:02 -04:00
description = " Choose a command from the dropdown below to get help with specific issues: " ,
color = 0xfa8c4a
)
2025-09-19 20:39:49 -04:00
embed . set_author ( name = " idevice " , icon_url = " https://yes.nighty.works/raw/snLMuO.png " )
2025-09-19 20:14:02 -04:00
2025-09-22 09:11:05 -04:00
view = ideviceView ( self . bot )
2025-09-19 20:14:02 -04:00
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 :
2025-09-22 09:11:05 -04:00
await bot . add_cog ( idevice ( bot ) )