diff --git a/cogs/api.py b/cogs/api.py index 21e1157..b5ac941 100644 --- a/cogs/api.py +++ b/cogs/api.py @@ -184,7 +184,7 @@ def search_name(self, arg, compatlist): matchlist.append(game) return matchlist - @commands.command(aliases=["nbcompat", "ndscompat"], usage="[title id|game name]") + @commands.hybrid_command(aliases=["nbcompat", "ndscompat"], usage="[title id|game name]") @gspreadkey_exists() async def ndsbcompat(self, ctx, *, title: Optional[str]): """ @@ -275,7 +275,7 @@ async def update_netinfo(self): self.netinfo_embed = embed - @commands.command() + @commands.hybrid_command() async def netinfo(self, ctx): """Shows the Nintendo Network status information""" if await self.bot.is_owner(ctx.author): @@ -320,7 +320,7 @@ async def udb(self, ctx, *, application=None): menu = UDBMenu(source, ctx) await menu.start() - @commands.group(invoke_without_command=True, case_insensitive=True) + @commands.hybrid_group(invoke_without_command=True, case_insensitive=True) async def skins(self, ctx): """Displays an embed with a link to a database of TWiLight Menu++ skins and Unlaunch backgrounds\n To show a random skin: `skins [console] -r` @@ -512,7 +512,7 @@ async def gbatek(self, ctx, *, page): menu = GbatekMenu(links, ctx) await menu.start() - @commands.command(aliases=['mkey']) + @commands.hybrid_command(aliases=['mkey']) async def generatemkey(self, ctx, device: str, month: int, day: int, inquiry: str, deviceid: Optional[str] = None): """ Generate an mkey for given device. diff --git a/cogs/general.py b/cogs/general.py index dc649e1..7551c36 100644 --- a/cogs/general.py +++ b/cogs/general.py @@ -208,7 +208,7 @@ async def guide(self, ctx, guide: Literal("3ds", "wiiu", "vwii", "switch", "wii" embed.description = "The complete guide to modding your Nintendo DSi" await ctx.send(embed=embed) - @commands.group(invoke_without_command=True, case_insensitive=True) + @commands.hybrid_group(invoke_without_command=True, case_insensitive=True) async def install(self, ctx): """Links and/or information on installing apps""" await ctx.send_help(ctx.command) @@ -242,7 +242,7 @@ async def unlaunch_install(self, ctx): embed.description = "How to install Unlaunch on the DSi" await ctx.send(embed=embed) - @commands.group(invoke_without_command=True, case_insensitive=True) + @commands.hybrid_group(invoke_without_command=True, case_insensitive=True) async def uninstall(self, ctx): """Links and/or information on uninstalling apps""" await ctx.send_help(ctx.command) @@ -279,7 +279,7 @@ async def hiyacfw_uninstall(self, ctx): embed.description = "How to uninstall hiyaCFW on the DSi" await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def twlfix(self, ctx): """Information on how to fix a broken TWL Partition""" await self.simple_embed(ctx, """ @@ -287,7 +287,7 @@ async def twlfix(self, ctx): These instructions require that you **perform a system update** after running the app. """, title="Fix broken TWL") - @commands.command() + @commands.hybrid_command() async def twlmanual(self, ctx): """How to access TWiLight Menu++ Instruction Manual""" embed = discord.Embed(title="How to access TWiLight Menu++ Instruction Manual") @@ -299,7 +299,7 @@ async def twlmanual(self, ctx): embed.add_field(name="Online", value=cleandoc("""The TWiLight Menu++ manual is also available online at https://manual.ds-homebrew.com."""), inline=False) await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def twlsettings(self, ctx): """How to access TWiLight Menu++ Settings""" title = "How to access TWiLight Menu++ Settings" @@ -313,7 +313,7 @@ async def twlsettings(self, ctx): view = TWLMThemeMenu(ctx, title, initDescription, themeSteps) await view.start() - @commands.command() + @commands.hybrid_command() async def slot1launch(self, ctx): """How to launch the Slot-1 Game Card from TWiLight Menu++""" title = "How to launch the Slot-1 Game Card from TWiLight Menu++" @@ -327,7 +327,7 @@ async def slot1launch(self, ctx): view = TWLMThemeMenu(ctx, title, initDescription, themeSteps) await view.start() - @commands.command(aliases=["dsimenulaunch"]) + @commands.hybrid_command(aliases=["dsimenulaunch"]) async def homemenulaunch(self, ctx): """How to launch the DSi Menu / 3DS HOME Menu from TWiLight Menu++""" title = "How to launch the DSi Menu / 3DS HOME Menu from TWiLight Menu++" @@ -341,7 +341,7 @@ async def homemenulaunch(self, ctx): view = TWLMThemeMenu(ctx, title, initDescription, themeSteps) await view.start() - @commands.command(aliases=["sd-card-setup", "sdformat"]) + @commands.hybrid_command(aliases=["sd-card-setup", "sdformat"]) async def formatsd(self, ctx): """Displays an embed with a link that tells you how to properly format your SD card""" embed = discord.Embed(title="SD Card Setup") @@ -351,7 +351,7 @@ async def formatsd(self, ctx): embed.description = "How to properly format your SD card" await ctx.send(embed=embed) - @commands.command(aliases=["nanddump", "nandbackup"]) + @commands.hybrid_command(aliases=["nanddump", "nandbackup"]) async def nand(self, ctx): """Links to the NAND dumping guide""" embed = discord.Embed(title="Dumping NAND") @@ -361,7 +361,7 @@ async def nand(self, ctx): embed.description = "How to dump your DSi's NAND" await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def vc(self, ctx): """Links to the 3DS Virtual Console Inject guide""" embed = discord.Embed(title="Virtual Console Injects for 3DS") @@ -371,7 +371,7 @@ async def vc(self, ctx): embed.description = "The recommended way to play old classics on your 3DS" await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def dump(self, ctx): """How to dump games and data for CFW consoles""" await self.simple_embed(ctx, text=""" @@ -380,7 +380,7 @@ async def dump(self, ctx): [Dumping DSiWare](https://dsi.cfw.guide/dsiware-backups.html) """, title="Dumping Games to ROM files") - @commands.group(invoke_without_command=True, case_insensitive=True) + @commands.hybrid_group(invoke_without_command=True, case_insensitive=True) async def nightly(self, ctx): """Instructions on installing nightly builds""" await ctx.send_help(ctx.command) @@ -399,7 +399,7 @@ async def ndsbootstrap_nightly(self, ctx): On the 3DS, this can be installed from Universal Updater. Select nds-bootstrap, then install the [nightly] build." await self.simple_embed(ctx, description, title="nds-bootstrap nightly") - @commands.command(aliases=["crowdin"]) + @commands.hybrid_command(aliases=["crowdin"]) async def translate(self, ctx): """Links to Crowdin projects""" crowdin_baseurl = "https://crowdin.com/project" @@ -414,7 +414,7 @@ async def translate(self, ctx): view.add_item(discord.ui.Button(label="DSi Guide", url=f"{crowdin_baseurl}/dsi-guide")) await ctx.send(embed=embed, view=view) - @commands.command(aliases=["colour"]) + @commands.hybrid_command(aliases=["colour"]) async def color(self, ctx, *, color): """Displays conversions of a color from #RRGGBB, #RGB, RRR GGG BBB, and BGR15""" @@ -445,14 +445,14 @@ async def color(self, ctx, *, color): embed.add_field(name="BGR15", value=f"`0x{bgr15:04X}` `0x{bgr15 | 1 << 15:04X}`") await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def sdroot(self, ctx): """Displays an image that shows what a root is""" embed = discord.Embed() embed.set_image(url="https://media.discordapp.net/attachments/489307733074640926/756947922804932739/wherestheroot.png") await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def sdlock(self, ctx): """Tells you how to disable write protection on an SD Card""" embed = discord.Embed(title="Disable write protection on an SD Card") @@ -464,7 +464,7 @@ async def sdlock(self, ctx): embed.set_image(url="https://i.imgur.com/RvKjWcz.png") await ctx.send(embed=embed) - @commands.group(aliases=["flashcard", "flashcards", "flashcarts"], invoke_without_command=True, case_insensitive=True) + @commands.hybrid_group(aliases=["flashcard", "flashcards", "flashcarts"], invoke_without_command=True, case_insensitive=True) async def flashcart(self, ctx): """Links the r/flashcarts quick start guide for a given console""" await ctx.send_help(ctx.command) @@ -489,7 +489,7 @@ async def gba(self, ctx): embed.set_thumbnail(url="https://b.thumbs.redditmedia.com/lBsOPXDyCx0p1MSx1qCdAtglHB4nineg5w9-3KHzO2A.png") await ctx.send(embed=embed) - @commands.command(aliases=["twlboot"]) + @commands.hybrid_command(aliases=["twlboot"]) async def dsiboot(self, ctx): """Tells you how to automatically boot TWiLight Menu++ with Unlaunch""" embed = discord.Embed(title="How to launch TWiLight Menu++ automatically with Unlaunch") @@ -501,7 +501,7 @@ async def dsiboot(self, ctx): """) await ctx.send(embed=embed) - @commands.command(name="7-zip", aliases=["7zip", "7z"]) + @commands.hybrid_command(name="7-zip", aliases=["7zip", "7z"]) async def sevenzip(self, ctx): """Links to the 7-Zip website""" embed = discord.Embed(title="7-Zip") @@ -509,7 +509,7 @@ async def sevenzip(self, ctx): embed.description = "7-Zip is the recommended program for Windows users to use to extract .7z files, such as the one TWiLight Menu++ comes in.\nMost people should download the '64-bit x64' version." await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def ysmenu(self, ctx): """Links to RetroGameFan's YSMenu download page""" embed = discord.Embed(title="RetroGameFan's YSMenu") @@ -519,17 +519,17 @@ async def ysmenu(self, ctx): embed.set_thumbnail(url="https://gbatemp.net/data/avatars/l/221/221134.jpg?1570890734") await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def lazydsi(self, ctx): """Tells you to stop trying to use it (and/or the vguide)""" embed = discord.Embed(title="Lazy DSi Downloader is deprecated") embed.description = "This application is deprecated. Please read the [guide](https://dsi.cfw.guide)." await ctx.send(embed=embed) - @commands.command() - async def cardflagcheck(self, ctx, inputFlags: str): + @commands.hybrid_command() + async def cardflagcheck(self, ctx, flags: str): try: - card = NDSCardFlagCheck(int(inputFlags, 16)) + card = NDSCardFlagCheck(int(flags, 16)) except ValueError: return await ctx.send("Input is not a valid hex number. Please try again.") await ctx.send(f"0x{card.inputFlags:08X} = {card.calculate()}") diff --git a/cogs/meta.py b/cogs/meta.py index 4ea37f6..2bf790e 100644 --- a/cogs/meta.py +++ b/cogs/meta.py @@ -18,7 +18,7 @@ class Meta(commands.Cog): def __init__(self, bot): self.bot = bot - @commands.command(aliases=["botinfo", "whoisthisbot"]) + @commands.hybrid_command(aliases=["botinfo", "whoisthisbot"]) async def about(self, ctx): """About TWLHelper""" embed = discord.Embed(title="About TWLHelper") diff --git a/cogs/nointro.py b/cogs/nointro.py index 9538a21..25d8af2 100644 --- a/cogs/nointro.py +++ b/cogs/nointro.py @@ -46,7 +46,7 @@ async def cog_check(self, ctx): raise commands.CheckFailure() return True - @commands.command(usage=" <sha1 hash>") + @commands.hybrid_command(usage="<title id|game name> <sha1 hash>") async def nicompare(self, ctx, gamecode: str, sha1hash: str): """ Compares input ROM and hash against No-Intro. @@ -99,7 +99,7 @@ def search_name(self, arg): matchlist.append(game) return matchlist - @commands.command(usage="[title id|game name]") + @commands.hybrid_command(usage="[title id|game name]") async def nilookup(self, ctx, *, title: Optional[str]): """ Shows a No-Intro database entry. diff --git a/cogs/wiki.py b/cogs/wiki.py index 94684b1..8b86986 100644 --- a/cogs/wiki.py +++ b/cogs/wiki.py @@ -27,7 +27,7 @@ def embed(self, title): embed.url = "https://wiki.ds-homebrew.com/" return embed - @commands.group(invoke_without_command=True, case_insensitive=True) + @commands.hybrid_group(invoke_without_command=True, case_insensitive=True) async def update(self, ctx): """Links and/or information on updating apps or system""" await ctx.send_help(ctx.command) @@ -44,7 +44,7 @@ async def twilight_update(self, ctx): view.add_item(discord.ui.Button(label="Flashcard", url="http://wiki.ds-homebrew.com/twilightmenu/updating-flashcard.html")) await ctx.send(embed=embed, view=view) - @commands.command(aliases=["ds-index"]) + @commands.hybrid_command(aliases=["ds-index"]) async def dsindex(self, ctx): """Links to the DS index""" embed = self.embed("Nintendo DS Modding Index") @@ -52,7 +52,7 @@ async def dsindex(self, ctx): embed.description = "An explanation of all things DS modding" await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def widescreen(self, ctx): """Displays an embed with a link telling you how to play in widescreen""" embed = self.embed("Playing in Widescreen") @@ -60,7 +60,7 @@ async def widescreen(self, ctx): embed.description = "Playing in widescreen with TWiLight Menu++ on 3DS" await ctx.send(embed=embed) - @commands.command(aliases=["forwarders", "forwarder", "twlforwarders"]) + @commands.hybrid_command(aliases=["forwarders", "forwarder", "twlforwarders"]) async def ndsforwarders(self, ctx): """Links to the nds-bootstrap forwarder guide""" embed = self.embed("NDS Forwarder Guide") @@ -68,7 +68,7 @@ async def ndsforwarders(self, ctx): embed.description = "Creating forwarders for nds-bootstrap" await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def hardmod(self, ctx): """Links to the DSi hardmod guide""" embed = self.embed("Nintendo DSi Hardmod Guide") @@ -76,7 +76,7 @@ async def hardmod(self, ctx): embed.description = "How to hardmod a Nintendo DSi" await ctx.send(embed=embed) - @commands.command(aliases=["serverrules", "discordrules"]) + @commands.hybrid_command(aliases=["serverrules", "discordrules"]) async def rule(self, ctx: commands.Context, num: Optional[int]): """Links to the server rules""" embed = self.embed("DS⁽ⁱ⁾ Mode Hacking Rules") @@ -95,7 +95,7 @@ async def rule(self, ctx: commands.Context, num: Optional[int]): page = re.sub("### (.*)", "**Rule \\1**", page) await ctx.send(page, suppress_embeds=True) - @commands.command(aliases=["discordinfo"]) + @commands.hybrid_command(aliases=["discordinfo"]) async def serverinfo(self, ctx): """Links to the DSi hardmod guide""" embed = self.embed("DS⁽ⁱ⁾ Mode Hacking Info") @@ -103,7 +103,7 @@ async def serverinfo(self, ctx): embed.description = "Information for the DS⁽ⁱ⁾ Mode Hacking Discord server" await ctx.send(embed=embed) - @commands.command(aliases=["wi-fi"]) + @commands.hybrid_command(aliases=["wi-fi"]) async def wifi(self, ctx): """Links to the Wi-Fi tutorial""" embed = self.embed("Connecting DS Games to the Internet") @@ -111,7 +111,7 @@ async def wifi(self, ctx): embed.description = "Connecting your DS⁽ⁱ⁾ to the Internet to play online" await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def emulators(self, ctx): """Links to the emulator index page""" embed = self.embed("Emulators on the DS") @@ -119,7 +119,7 @@ async def emulators(self, ctx): embed.description = "A reference on emulators & loaders on the DS" await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def retail(self, ctx): """Links to the reference page for miscellaneous information on DS games""" embed = self.embed("Retail ROMs") @@ -127,7 +127,7 @@ async def retail(self, ctx): embed.description = "A reference on retail DS games" await ctx.send(embed=embed) - @commands.command(aliases=["special", "specgames"]) + @commands.hybrid_command(aliases=["special", "specgames"]) async def specialgames(self, ctx): """Links to the list of special games""" embed = self.embed("Special Games") @@ -135,7 +135,7 @@ async def specialgames(self, ctx): embed.description = "A list of DS games with special features" await ctx.send(embed=embed) - @commands.command() + @commands.hybrid_command() async def customskins(self, ctx): """Displays an embed with a link to a guide on custom TWiLight Menu++ skins""" embed = self.embed("Custom DSi/3DS Skins") @@ -143,7 +143,7 @@ async def customskins(self, ctx): embed.description = "How to Create DSi/3DS Skins for TWiLight Menu++" await ctx.send(embed=embed) - @commands.command(aliases=["ramdisks"]) + @commands.hybrid_command(aliases=["ramdisks"]) async def ramdisk(self, ctx): """Links to the RAM Disk creation tutorial""" embed = self.embed("Creating RAM Disks") @@ -151,7 +151,7 @@ async def ramdisk(self, ctx): embed.description = "How to create RAM Disks for using older homebrew with nds-bootstrap" await ctx.send(embed=embed) - @commands.command(aliases=["dlp", "downloadplay"]) + @commands.hybrid_command(aliases=["dlp", "downloadplay"]) async def pictochat(self, ctx): """Links to the page for getting PictoChat and DS Download Play on the DS Classic Menu""" embed = self.embed("Download Play/PictoChat in the DS Classic Menu") @@ -159,7 +159,7 @@ async def pictochat(self, ctx): embed.description = "How to get PictoChat and DS Download Play on the DS Classic Menu in TWiLight Menu++" await ctx.send(embed=embed) - @commands.group(invoke_without_command=True, case_insensitive=True) + @commands.hybrid_group(invoke_without_command=True, case_insensitive=True) async def bios(self, ctx): """BIOS info page""" await ctx.send_help(ctx.command) @@ -204,7 +204,7 @@ async def nds(self, ctx, arg=""): embed.description = "How to dump the NDS and/or DSi BIOS and firmware" await ctx.send(embed=embed) - @commands.command(aliases=['vp']) + @commands.hybrid_command(aliases=['vp']) async def videoplayers(self, ctx: commands.Context): """Links to the video players page on the wiki""" embed = self.embed("Homebrew Video Players for the DS(i)") diff --git a/twlhelper.py b/twlhelper.py index 91a3e2c..be441b2 100755 --- a/twlhelper.py +++ b/twlhelper.py @@ -88,6 +88,7 @@ async def is_owner(self, user: discord.User): return await super().is_owner(user) async def on_ready(self): + await self.tree.sync() log.info("TWLHelper ready.") async def on_command_error(self, ctx: commands.Context, exc: commands.CommandInvokeError):