mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
refactor(SideStore): help command structure
Reorganized SideStore commands to use a group structure, added individual subcommands for troubleshooting topics, and updated the help command to provide a dropdown for specific issues. This improves command discoverability and user experience.
This commit is contained in:
@@ -37,7 +37,6 @@ class Help(commands.Cog, name="help"):
|
|||||||
async def help(self, context: Context, category: str = None) -> None:
|
async def help(self, context: Context, category: str = None) -> None:
|
||||||
|
|
||||||
category_mapping = {
|
category_mapping = {
|
||||||
# Command Groups (using __init__.py structure)
|
|
||||||
"general": "general",
|
"general": "general",
|
||||||
"fun": "fun",
|
"fun": "fun",
|
||||||
"idevice": "idevice",
|
"idevice": "idevice",
|
||||||
@@ -46,7 +45,6 @@ class Help(commands.Cog, name="help"):
|
|||||||
"sidestore": "sidestore",
|
"sidestore": "sidestore",
|
||||||
"utilities": "utilities",
|
"utilities": "utilities",
|
||||||
|
|
||||||
# Individual Owner Commands (exception)
|
|
||||||
"sync": "owner",
|
"sync": "owner",
|
||||||
"logs": "owner",
|
"logs": "owner",
|
||||||
"invite": "owner",
|
"invite": "owner",
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import discord
|
import discord
|
||||||
|
from discord import app_commands
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.ext.commands import Context
|
from discord.ext.commands import Context
|
||||||
|
|
||||||
from .sidestore import sidestore_command
|
from .sidestore import SidestoreView
|
||||||
from .refresh import refresh_command
|
from .refresh import refresh_command
|
||||||
from .code import code_command
|
from .code import code_command
|
||||||
from .crash import crash_command
|
from .crash import crash_command
|
||||||
@@ -18,12 +19,86 @@ class Sidestore(commands.GroupCog, name="sidestore"):
|
|||||||
self.bot = bot
|
self.bot = bot
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@commands.hybrid_command(
|
@commands.group(name="sidestore", invoke_without_command=True)
|
||||||
name="sidestore",
|
async def sidestore_group(self, context: Context):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="SideStore Commands",
|
||||||
|
description="Choose a command from the dropdown below to get help with specific issues:",
|
||||||
|
color=0x8e82f9
|
||||||
|
)
|
||||||
|
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||||
|
view = SidestoreView(self.bot)
|
||||||
|
await context.send(embed=embed, view=view)
|
||||||
|
|
||||||
|
@sidestore_group.command(name="help")
|
||||||
|
async def sidestore_group_help(self, context: Context):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="SideStore Commands",
|
||||||
|
description="Choose a command from the dropdown below to get help with specific issues:",
|
||||||
|
color=0x8e82f9
|
||||||
|
)
|
||||||
|
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||||
|
view = SidestoreView(self.bot)
|
||||||
|
await context.send(embed=embed, view=view)
|
||||||
|
|
||||||
|
async def _invoke_hybrid(self, context: Context, name: str):
|
||||||
|
command = self.bot.get_command(name)
|
||||||
|
if command is not None:
|
||||||
|
await context.invoke(command)
|
||||||
|
else:
|
||||||
|
await context.send(f"Unknown SideStore command: {name}")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="refresh")
|
||||||
|
async def sidestore_group_refresh(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "refresh")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="code")
|
||||||
|
async def sidestore_group_code(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "code")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="crash")
|
||||||
|
async def sidestore_group_crash(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "crash")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="pairing")
|
||||||
|
async def sidestore_group_pairing(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "pairing")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="server")
|
||||||
|
async def sidestore_group_server(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "server")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="afc")
|
||||||
|
async def sidestore_group_afc(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "afc")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="udid")
|
||||||
|
async def sidestore_group_udid(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "udid")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="half")
|
||||||
|
async def sidestore_group_half(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "half")
|
||||||
|
|
||||||
|
@sidestore_group.command(name="sparse")
|
||||||
|
async def sidestore_group_sparse(self, context: Context):
|
||||||
|
await self._invoke_hybrid(context, "sparse")
|
||||||
|
|
||||||
|
@app_commands.command(
|
||||||
|
name="help",
|
||||||
description="SideStore troubleshooting help"
|
description="SideStore troubleshooting help"
|
||||||
)
|
)
|
||||||
async def sidestore(self, context):
|
async def help(self, interaction: discord.Interaction):
|
||||||
return await sidestore_command()(self, context)
|
embed = discord.Embed(
|
||||||
|
title="SideStore Commands",
|
||||||
|
description="Choose a command from the dropdown below to get help with specific issues:",
|
||||||
|
color=0x8e82f9
|
||||||
|
)
|
||||||
|
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||||
|
|
||||||
|
view = SidestoreView(self.bot)
|
||||||
|
|
||||||
|
await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
|
||||||
|
|
||||||
@commands.hybrid_command(
|
@commands.hybrid_command(
|
||||||
name="refresh",
|
name="refresh",
|
||||||
@@ -92,7 +167,7 @@ async def setup(bot) -> None:
|
|||||||
cog = Sidestore(bot)
|
cog = Sidestore(bot)
|
||||||
await bot.add_cog(cog)
|
await bot.add_cog(cog)
|
||||||
|
|
||||||
bot.logger.info("Loaded extension 'sidestore.sidestore'")
|
bot.logger.info("Loaded extension 'sidestore.help'")
|
||||||
bot.logger.info("Loaded extension 'sidestore.refresh'")
|
bot.logger.info("Loaded extension 'sidestore.refresh'")
|
||||||
bot.logger.info("Loaded extension 'sidestore.code'")
|
bot.logger.info("Loaded extension 'sidestore.code'")
|
||||||
bot.logger.info("Loaded extension 'sidestore.crash'")
|
bot.logger.info("Loaded extension 'sidestore.crash'")
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class SidestoreView(discord.ui.View):
|
|||||||
|
|
||||||
def sidestore_command():
|
def sidestore_command():
|
||||||
@commands.hybrid_command(
|
@commands.hybrid_command(
|
||||||
name="sidestore", description="SideStore troubleshooting and help"
|
name="help", description="SideStore troubleshooting and help"
|
||||||
)
|
)
|
||||||
async def sidestore(self, context):
|
async def sidestore(self, context):
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
|
|||||||
Reference in New Issue
Block a user