feat(melonx): new melonx commands

Introduced new commands to the MeloNX cog: mods, gamecrash, requirements, error, and 26 (iOS 26), each with their own handler and help embed. Updated the README and melonx.py select menu to reflect the new commands. These additions provide users with troubleshooting and informational commands for common MeloNX issues and topics.
This commit is contained in:
neoarz
2025-10-04 08:54:48 -04:00
parent 023ec85640
commit ad1e117e75
8 changed files with 330 additions and 1 deletions

View File

@@ -5,6 +5,11 @@ from discord.ext.commands import Context
from .melonx import MelonxView
from .transfer import transfer_command
from .mods import mods_command
from .gamecrash import crash_command
from .requirements import requirements_command
from .error import error_command
from .ios26 import ios26_command
class Melonx(commands.GroupCog, name="melonx"):
def __init__(self, bot) -> None:
@@ -37,6 +42,26 @@ class Melonx(commands.GroupCog, name="melonx"):
async def melonx_group_transfer(self, context: Context):
await self._invoke_hybrid(context, "transfer")
@melonx_group.command(name="mods")
async def melonx_group_mods(self, context: Context):
await self._invoke_hybrid(context, "mods")
@melonx_group.command(name="gamecrash")
async def melonx_group_gamecrash(self, context: Context):
await self._invoke_hybrid(context, "gamecrash")
@melonx_group.command(name="requirements")
async def melonx_group_requirements(self, context: Context):
await self._invoke_hybrid(context, "requirements")
@melonx_group.command(name="error")
async def melonx_group_error(self, context: Context):
await self._invoke_hybrid(context, "error")
@melonx_group.command(name="26")
async def melonx_group_26(self, context: Context):
await self._invoke_hybrid(context, "26")
async def _invoke_hybrid(self, context: Context, name: str):
command = self.bot.get_command(name)
if command is not None:
@@ -44,6 +69,16 @@ class Melonx(commands.GroupCog, name="melonx"):
else:
await context.send(f"Unknown MeloNX command: {name}")
def _require_group_prefix(context: Context) -> bool:
if getattr(context, "interaction", None):
return True
group = getattr(getattr(context, "cog", None), "qualified_name", "").lower()
if not group:
return True
prefix = context.prefix or ""
content = context.message.content.strip().lower()
return content.startswith(f"{prefix}{group} ")
@app_commands.command(
name="help",
description="MeloNX troubleshooting help"
@@ -58,6 +93,7 @@ class Melonx(commands.GroupCog, name="melonx"):
view = MelonxView(self.bot)
await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
@commands.check(_require_group_prefix)
@commands.hybrid_command(
name="transfer",
description="How to transfer save files from other emulators or platforms"
@@ -65,9 +101,54 @@ class Melonx(commands.GroupCog, name="melonx"):
async def transfer(self, context):
return await transfer_command()(self, context)
@commands.check(_require_group_prefix)
@commands.hybrid_command(
name="mods",
description="How to install mods within MeloNX (Limited Support)"
)
async def mods(self, context):
return await mods_command()(self, context)
@commands.check(_require_group_prefix)
@commands.hybrid_command(
name="gamecrash",
description="Why does my game crash?"
)
async def gamecrash(self, context):
return await crash_command()(self, context)
@commands.check(_require_group_prefix)
@commands.hybrid_command(
name="requirements",
description="What does MeloNX require?"
)
async def requirements(self, context):
return await requirements_command()(self, context)
@commands.check(_require_group_prefix)
@commands.hybrid_command(
name="error",
description="What does this error message mean?"
)
async def error(self, context):
return await error_command()(self, context)
@commands.check(_require_group_prefix)
@commands.hybrid_command(
name="26",
description="How can I run MeloNX on iOS 26?"
)
async def ios26(self, context):
return await ios26_command()(self, context)
async def setup(bot) -> None:
cog = Melonx(bot)
await bot.add_cog(cog)
bot.logger.info("Loaded extension 'melonx.help'")
bot.logger.info("Loaded extension 'melonx.transfer'")
bot.logger.info("Loaded extension 'melonx.mods'")
bot.logger.info("Loaded extension 'melonx.gamecrash'")
bot.logger.info("Loaded extension 'melonx.requirements'")
bot.logger.info("Loaded extension 'melonx.error'")
bot.logger.info("Loaded extension 'melonx.26'")