diff --git a/README.md b/README.md index 7610669..0997e35 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,12 @@ | general | `help`, `botinfo`, `serverinfo`, `ping`, `feedback`, `uptime` | | fun | `randomfact`, `coinflip`, `rps`, `8ball`, `minesweeper` | | moderation | `kick`, `ban`, `nick`, `purge`, `hackban`, `warnings`, `archive` | -| media | `download` | | sidestore | `sidestore`, `refresh`, `code`, `crash`, `pairing`, `server`, `half`, `sparse`, `afc`, `udid` | | idevice | `idevice`, `noapps`, `errorcode`, `developermode`, `mountddi` | +| melonx | `melonx`, `transfer` | | miscellaneous | `keanu`, `labubu`, `piracy`, `tryitandsee`, `rickroll`, `dontasktoask`, `support`| | utilities | `translate`, `codepreview`, `dictionary` | +| media | `download` | ## Download diff --git a/cogs/help.py b/cogs/help.py index d86e651..9513655 100644 --- a/cogs/help.py +++ b/cogs/help.py @@ -13,7 +13,7 @@ class Help(commands.Cog, name="help"): interaction: discord.Interaction, current: str, ) -> list[app_commands.Choice[str]]: - categories = ["general", "fun", "moderation", "owner", "sidestore", "idevice", "media", "miscellaneous", "utilities"] + categories = ["general", "fun", "moderation", "owner", "sidestore", "idevice", "melonx", "media", "miscellaneous", "utilities"] suggestions = [] for category in categories: @@ -40,6 +40,7 @@ class Help(commands.Cog, name="help"): "general": "general", "fun": "fun", "idevice": "idevice", + "melonx": "melonx", "media": "media", "misc": "miscellaneous", "miscellaneous": "miscellaneous", @@ -65,6 +66,7 @@ class Help(commands.Cog, name="help"): "owner": "Owner commands", "sidestore": "SideStore troubleshooting commands", "idevice": "idevice troubleshooting commands", + "melonx": "MeloNX troubleshooting commands", "media": "Media commands", "utilities": "Utility commands", "miscellaneous": "Miscellaneous commands" diff --git a/cogs/melonx/__init__.py b/cogs/melonx/__init__.py new file mode 100644 index 0000000..e5dc66a --- /dev/null +++ b/cogs/melonx/__init__.py @@ -0,0 +1,73 @@ +import discord +from discord import app_commands +from discord.ext import commands +from discord.ext.commands import Context + +from .melonx import MelonxView +from .transfer import transfer_command + +class Melonx(commands.GroupCog, name="melonx"): + def __init__(self, bot) -> None: + self.bot = bot + super().__init__() + + @commands.group(name="melonx", invoke_without_command=True) + async def melonx_group(self, context: Context): + embed = discord.Embed( + title="MeloNX Commands", + description="Choose a command from the dropdown below to get help with specific issues:", + color=0x963155 + ) + embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png") + view = MelonxView(self.bot) + await context.send(embed=embed, view=view) + + @melonx_group.command(name="help") + async def melonx_group_help(self, context: Context): + embed = discord.Embed( + title="MeloNX Commands", + description="Choose a command from the dropdown below to get help with specific issues:", + color=0x963155 + ) + embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png") + view = MelonxView(self.bot) + await context.send(embed=embed, view=view) + + @melonx_group.command(name="transfer") + async def melonx_group_transfer(self, context: Context): + await self._invoke_hybrid(context, "transfer") + + 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 MeloNX command: {name}") + + @app_commands.command( + name="help", + description="MeloNX troubleshooting help" + ) + async def help(self, interaction: discord.Interaction): + embed = discord.Embed( + title="MeloNX Commands", + description="Choose a command from the dropdown below to get help with specific issues:", + color=0x963155 + ) + embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png") + view = MelonxView(self.bot) + await interaction.response.send_message(embed=embed, view=view, ephemeral=True) + + @commands.hybrid_command( + name="transfer", + description="How to transfer save files from other emulators or platforms" + ) + async def transfer(self, context): + return await transfer_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'") diff --git a/cogs/melonx/melonx.py b/cogs/melonx/melonx.py new file mode 100644 index 0000000..e0f249e --- /dev/null +++ b/cogs/melonx/melonx.py @@ -0,0 +1,66 @@ +import discord +from discord import app_commands +from discord.ext import commands +from discord.ext.commands import Context + + +class MelonxSelect(discord.ui.Select): + def __init__(self, bot): + self.bot = bot + options = [ + discord.SelectOption( + label="Transfer", + value="transfer", + description="How to transfer save files from other emulators or platforms", + ), + ] + super().__init__(placeholder="Choose a MeloNX command...", options=options) + + async def callback(self, interaction: discord.Interaction): + command_name = self.values[0] + command = self.bot.get_command(command_name) + + if command: + 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 + ) + embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png") + 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") + 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 `/{command_name}` instead.", + color=0x963155 + ) + embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png") + 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=0x963155 + ) + embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png") + await interaction.response.edit_message(embed=embed, view=None) + else: + embed = discord.Embed( + title="Error", + description="Command not found!", + color=0x963155 + ) + embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png") + await interaction.response.edit_message(embed=embed, view=None) + + +class MelonxView(discord.ui.View): + def __init__(self, bot): + super().__init__() + self.add_item(MelonxSelect(bot)) diff --git a/cogs/melonx/transfer.py b/cogs/melonx/transfer.py new file mode 100644 index 0000000..1c3959c --- /dev/null +++ b/cogs/melonx/transfer.py @@ -0,0 +1,52 @@ +import discord +from discord import app_commands +from discord.ext import commands +from discord.ext.commands import Context +import time + + +def transfer_command(): + @commands.hybrid_command( + name="transfer", description="How to transfer save files from other emulators or platforms" + ) + async def transfer(self, context): + embed = discord.Embed( + color=0x963155, + description=( + '# How do I transfer my save files from another emulator, my pc, or other platform?\n\n---\n\n' + + '### **Ryujinx Based**: \n' + + '1. Go too Ryujinx\'s main directory -> copy and and transfer the **"bis"** folder to your iDevice.\n' + + '2. Replace the **"bis"** folder in MeloNX with the one you transferred over.\n\n' + + '### **Yuzu Based**:\n' + + '1. Go to Yuzu\'s main directory and locate "**nand**" then go to -> users -> save\n' + + '2. Get the **title ID** of the game you want to transfer to by locating the game on MeloNX, hold down on it and press "Game Info" \n' + + '3. Then search the title ID within the **save** folder\n' + + '4. Open that folder labeled your title ID and copy of all of the contents to your iDevice\n' + + '5. Boot the game once in MeloNX so the save directories appear and is the latest created\n' + + '6. On your iDevice, go into files-> MeloNX -> bis -> user -> save\n' + + '7. In the save folder, there will be many folders named 0000001, 0000002, etc\n' + + '8. Sort by last modified or open each one too see the modified date/time of the files\n' + + '9. Once you\'ve found the newest one, inside will be two folders named 1 and 0, one will have a brand new save file inside.\n' + + '10. drop the contents copied from the title ID folder in Yuzu into that directory and press "replace" when prompted.\n' + + '11. Launch the game again in MeloNX to verify the transfer.' + ) + ) + embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png") + embed.set_footer(text=f'Last Edited by neoarz') + embed.timestamp = discord.utils.utcnow() + + view = discord.ui.View() + view.add_item(discord.ui.Button( + label="Edit Command", + style=discord.ButtonStyle.secondary, + url="https://github.com/neoarz/Syntrel/blob/main/cogs/melonx/transfer.py", + emoji="<:githubicon:1417717356846776340>" + )) + + if context.interaction: + await context.interaction.response.send_message(embed=embed, view=view) + else: + await context.send(embed=embed, view=view) + + + return transfer