Skip to content

Commit

Permalink
Implement Markdown command system (nh-server#1001)
Browse files Browse the repository at this point in the history
* Implement Markdown command system

This contains the first implementation of the Markdown command system,
designed for the assistance module. It creates commands based on
Markdown files which are easily editable compared to Python commands.

Command files contain the command name and the relevant console. An
example is `ntrstream.3ds.md`. A command can have multiple files for
different consoles, such as `update.3ds.md` and `update.switch.md`.

If one console exists for the command, it will always return the
contents for that file. If multiple consoles exist, it uses the current
system for checking which file to print (based on channel name or
requested consoles).

A Markdown file contains a header with these fields (all optional):
* `title`
* `url`
* `author.name` (if setting author fields, this is required)
* `author.url`
* `author.icon-url`
* `help-desc` (shows in `.help`, last one to be loaded is the one
  actually used)
* `aliases` (merged from all files for the command)
* `color` (RGB hex code, defaults to console color)
* `thumbnail-url`

A few commands were ported to this new system as a test. This includes:
* `dsp.3ds.md`
* `nospace.3ds.md`
* `ntrstream.3ds.md`
* `update.3ds.md`
* `update.switch.md`
* `tutorial/layeredfs.3ds.md`

This still needs:
- [ ] using format_map to subtitute things like software versions
- [ ] documentation
- [ ] per-command cooldown

* fix flake8 issues & remove useless code

* Markdown command file documentation

* Add example embed image

* Use correct (soon-to-be-valid) image url

* support format_map for Markdown command files

* fix image width

* wrap header with --- lines

* port more commands to markdown files

* port even more commands to markdown files

* mention "all" as a valid console value

* port more commands to markdown files

* [skip ci] undo temp cooldown change
  • Loading branch information
ihaveamac authored Sep 7, 2021
1 parent ebaec93 commit 261526b
Show file tree
Hide file tree
Showing 49 changed files with 839 additions and 666 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*.ini
*.sh
!dockerbuild.sh
*.log
*.log*
*.json
*.png
*.bin
._*
.DS_Store
Expand Down
59 changes: 59 additions & 0 deletions WritingAssistanceCommands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Markdown commands
Kurisu can create commands based on Markdown command files. Currently this supports the Assistance module and the tutorial group.

These commands are placed in the `cogs/assistance-cmds` directory. Tutorial commands are placed in `cogs/assistance-cmds/tutorial`.

### File format
A Markdown command file must follow this filename format: `commandname.console.md`. Valid console names are `3ds`, `wiiu`, `vwii`, `switch`, `wii`, `dsi`, and `all`.

A command can have multiple responses for different consoles. This means `commandname.3ds.md` and `commandname.switch.md` can exist. The resulting command will attempt to figure out which one to display in the channel, or the console names can be provided as arguments.

The file is split into two parts: a header and a body. The header ends once a double newline is found. The header should be wrapped with a `---` at the beginning and end. All header keys are optional. Valid header keys are:
* `title`
* `url`
* `author.name` (if setting author fields, this is required)
* `author.url`
* `author.icon-url`
* `help-desc` (shows in `.help`, last one to be loaded is the one actually used)
* `aliases` (comma-separated, merged from all files for the command)
* `color` (RGB hex code, defaults to console color)
* `thumbnail-url`

A file can have no header keys if it starts with two newlines, but this is not recommended.

Any Markdown syntax supported by Discord embeds is supported. Notably this includes Markdown links, which normal user messages cannot use.

Headers define the start of a new embed field. There is only one header size, so any amount of `#` at the beginning will produce the same result.

The body supports certain including certain variables in the format of `{variable_name}`. These will be replaced with the variable contents. Supported variables include: `nx_firmware`, `ams_ver`, `hekate_ver`, and `last_revision`. The contents are stored in `cogs/assistance.py`.

### Example

This file should be called `mycommand.3ds.md` and placed in `cogs/assistance-cmds`:

```md
---
title: Title
url: https://example.com
author.name: Author Name
author.url: https://your-site.com
author.icon-url: https://upload.wikimedia.org/wikipedia/commons/b/b8/Anagallis_arvensis_2.jpg
help-desc: Help Description
aliases: thing,stuff
color: 93A0D5
thumbnail-url: https://upload.wikimedia.org/wikipedia/commons/e/e7/Starr_070302-5063_Merremia_tuberosa.jpg
---

Description goes here...

# My header
This goes in one section!
[Example url](https://3ds.hacks.guide/faq)

# My other header
This goes in another section!
```

When either `.mycommand` or the aliases `.thing` or `.stuff` are used:

<img src="https://github.com/nh-server/Kurisu/raw/main/example-embed.png" width="302">
12 changes: 12 additions & 0 deletions cogs/assistance-cmds/atmosphere.switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Atmosphère
url: https://github.com/Atmosphere-NX/Atmosphere/releases
thumbnail-url: https://avatars2.githubusercontent.com/u/37918415?s=200&v=4
author.name: Atmosphère-NX Team
author.url: https://github.com/Atmosphere-NX
help-desc: Download link for the latest Atmosphère version
aliases: atmos,ams
color: 3498db
---

Link to Atmosphère latest release
11 changes: 11 additions & 0 deletions cogs/assistance-cmds/atob.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Upgrading a9lh to b9s
url: https://3ds.hacks.guide/a9lh-to-b9s
thumbnail-url: https://nintendohomebrew.com/assets/img/nhplai.png
author.name: NH & Friends
author.url: https://3ds.hacks.guide/a9lh-to-b9s
aliases: a9lhtob9s,updatea9lh
help-desc: Links to the guide for updating from a9lh to b9s
---

A guide for upgrading your device from arm9loaderhax to boot9strap.
10 changes: 10 additions & 0 deletions cogs/assistance-cmds/baninfo.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: 3DS Bans
help-desc: Links to ban information pages
---

**Nintendo has shown a marked lack of care about bans on the 3DS lately.**
However, such things as piracy and cheating online/cheating in multiplayer games have been known causes for NNID/console bans in the past.
eShop fraud (eg credit card chargebacks) will also get you banned.

You can enable online status and Spotpass/Streetpass as these do not seem to be high risk at this time.
8 changes: 8 additions & 0 deletions cogs/assistance-cmds/baninfo.switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: NX Bans
url: https://nx.eiphax.tech/ban
thumbnail-url: https://nintendohomebrew.com/assets/img/gunther.png
help-desc: Links to ban information pages
---

Bans on the Switch are complicated. Please click the embed header link and read the linked page to learn more.
14 changes: 14 additions & 0 deletions cogs/assistance-cmds/bigsd.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Big SD
help-desc: Embeds big sd information
---

Although Nintendo says the official SD size limit is 32GB, the 3DS can accept cards up to 2TB.
In order to use them, you will have to format them to FAT32 first.
You can do this using these tools:

-GUIFormat for Windows: http://ridgecrop.co.uk/index.htm?guiformat.htm
-gparted for Linux: https://gparted.org/download.php
-Disk Utility for macOS: https://support.apple.com/guide/disk-utility/format-a-disk-for-windows-computers-dskutl1010

IMPORTANT: On macOS, always select "MS-DOS (Fat)". Formatting will erase all data on the card. Make a backup first.
14 changes: 14 additions & 0 deletions cogs/assistance-cmds/bigsd.switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Big SD
help-desc: Embeds big sd information
---

Although Nintendo supports large SD cards in EXFAT format, it is recommended to use FAT32.
In order to change the card's format, you will need to use an external utility.
Here are some suggestions:

-GUIFormat for Windows: http://ridgecrop.co.uk/index.htm?guiformat.htm
-gparted for Linux: https://gparted.org/download.php
-Disk Utility for macOS: https://support.apple.com/guide/disk-utility/format-a-disk-for-windows-computers-dskutl1010

IMPORTANT: On macOS, always select "MS-DOS (Fat)". Formatting will erase all data on the card. Make a backup first.
5 changes: 5 additions & 0 deletions cogs/assistance-cmds/cfwuses.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
help-desc: Uses for CFW on Wii U, Switch, and 3DS
---

Want to know what CFW can be used for? <https://3ds.eiphax.tech/tips.html>
15 changes: 15 additions & 0 deletions cogs/assistance-cmds/cfwuses.switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: What can I do with a hacked switch?
help-desc: Uses for CFW on Wii U, Switch, and 3DS
---

There is no complete list about what is possible and what not, but to give you an idea of what you can do, here is an overview:

-Have custom themes,
-Run emulators (up to N64 works, with a bit of modification GCN/Wii work fine as well but it varies from game to game),
-Run custom homebrew apps,
-Backup, edit and restore game saves,
-Dump game cartridges (to look at the contents, for example)
-Mod games,
-Run Android or Linux on your Switch,
-Still have access to normal stock features (e.g. eShop, online services etc.)
11 changes: 11 additions & 0 deletions cogs/assistance-cmds/cfwuses.wiiu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: What can Wii U CFW be used for?
help-desc: Uses for CFW on Wii U, Switch, and 3DS
---

# Among other things, it allows you to do the following:
- Use “ROM hacks” for games that you own.
- Backup, edit and restore saves for many games.
- Play games for older systems with various emulators, using RetroArch or other standalone emulators.
- Play out-of-region games.
- Dump your Wii U game discs to a format that can be installed on your internal or external Wii U storage drive.
11 changes: 11 additions & 0 deletions cogs/assistance-cmds/ctr.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Guide - ctrtransfer
url: https://3ds.hacks.guide/ctrtransfer
thumbnail-url: https://nintendohomebrew.com/assets/img/nhplai.png
author.name: NH & Friends
author.url: https://3ds.hacks.guide/
aliases: ctrtransfer,ctrnandtransfer
help-desc: Links to ctrtransfer guide
---

How to do the 11.5.0-38 ctrtransfer
11 changes: 11 additions & 0 deletions cogs/assistance-cmds/dsp.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Dsp1
url: https://github.com/zoogie/DSP1/releases
thumbnail-url: https://raw.githubusercontent.com/Cruel/DspDump/master/icon.png
author.name: zoogie
author.url: https://github.com/zoogie
author.icon-url: https://gbatemp.net/data/avatars/l/357/357147.jpg?1426471484
help-desc: Links to Dsp1.
---

Dump 3DS's DSP component to SD for homebrew audio.
11 changes: 11 additions & 0 deletions cogs/assistance-cmds/formatsd.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: SD Formatting Tools
help-desc: SD Format Tools
aliases: sdformat
---

Here are some links to common FAT32 formatting tools:
[GUIFormat](http://ridgecrop.co.uk/index.htm?guiformat.htm) (Windows)
[gparted](https://gparted.org/download.php) + [dosfstools](https://github.com/dosfstools/dosfstools) (Linux)
[Disk Utility](https://support.apple.com/guide/disk-utility/format-a-disk-for-windows-computers-dskutl1010) (MacOS)
MacOS: Always select "MS-DOS (FAT)", even if the card is larger than 32GB.
11 changes: 11 additions & 0 deletions cogs/assistance-cmds/hekate.switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Hekate
url: https://github.com/CTCaer/hekate/releases/latest
thumbnail-url: https://imgur.com/kFEZyuC.png
author.name: CTCaer
author.url: https://github.com/CTCaer
help-desc: Download link for the latest Hekate version
color: e74c3c
---

Link to Hekate's latest release
12 changes: 12 additions & 0 deletions cogs/assistance-cmds/ip.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Check your 3DSs IP (CFW)
help-desc: How to check your IP
---

1. FBI
2. Remote Install
3. Receive URLs over the network

# Check your 3DSs IP (Homebrew)
1. Open Homebrew Launcher
2. Press Y
11 changes: 11 additions & 0 deletions cogs/assistance-cmds/lumabug.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Luma Black Screen Bug
help-desc: Luma Black Screen Bug
---

If you have Luma3DS and your console is stuck on a black screen after you power it on, follow these steps:
1. Power off the console.
2. Take out any game cartridge, but leave the SD card in.
3. Power on the console.
4. Leave the console open and powered on for 10-15 minutes. Do not touch the console during this time.
If the console boots successfully in that time, the bug is now fixed and is unlikely to happen again. If the console still fails to boot to home menu, come back and ask for more help. Mention that you have already tried the Luma black screen process.
13 changes: 13 additions & 0 deletions cogs/assistance-cmds/lumacheck.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Please check your Luma version.
help-desc: How to check Luma version
aliases: checkluma
---

In order to do this, you will need to load the Luma Configuration screen.

# Steps to open Luma Configuration
1. Turn your console off.
2. Hold the SELECT button.
3. While still holding SELECT, turn the console on.
4. Provide a photo of your console's screens, or if you can see the version, tell us here.
7 changes: 7 additions & 0 deletions cogs/assistance-cmds/modmoon.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
help-desc: Links to a tool for a mod manager
---

To install mods for Smash 3DS, and to manage other LayeredFS mods, [Mod-Moon](https://github.com/Swiftloke/ModMoon/releases) is recommended.

Instructions for usage can be found [in this thread.](https://gbatemp.net/threads/modmoon-a-beautiful-simple-and-compact-mods-manager-for-the-nintendo-3ds.519080#)
14 changes: 14 additions & 0 deletions cogs/assistance-cmds/newver.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Is the new 3DS update safe?
help-desc: Quick advice for new versions
---

Currently, the latest 3DS system firmware is `11.15.0-47`.

If you currently have CFW installed (boot9strap/Luma):
Is your Luma version up to date? If your Luma version is 10.2.1 or above, **updating is safe**.
If it is 10.2 or below, please type `.update` in <#261581918653513729> and follow the information there.

If you DO NOT currently have CFW installed (stock console):
11.15.0-46 can be hacked with current methods. **Updating is safe**; however, if you are on 11.3 or below, it may be worthwhile to stay on that version as it is faster to hack your console there.
*Last edited: November 16th, 2020*
14 changes: 14 additions & 0 deletions cogs/assistance-cmds/newver.switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Is the new Switch update safe?
help-desc: Quick advice for new versions
---

Currently, the latest Switch system firmware is `{nx_firmware}`.

If your Switch is **unpatched and can access RCM**:
Atmosphere and Hekate currently support {nx_firmware}, and unpatched units will always be hackable.
You should follow the precautions in our update guide, and always update Atmosphere and Hekate before updating the system firmware.

If your Switch is **hardware patched and cannot access RCM**:
Stay on the lowest possible firmware version. Any Switch that is patched and above 7.0.1 is unlikely to be hackable.
*Last edited: {last_revision}*
12 changes: 12 additions & 0 deletions cogs/assistance-cmds/nospace.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: How to create a 3DS NAND backup without enough space on the SD card
help-desc: Low space NAND Backup
aliases: lowspace,lowbackup
---

# Steps to create the backup

1. Copy the Nintendo 3DS folder from the root of your SD card to your computer then delete it from **the SD card.**
2. Boot GodMode9 by holding START on boot then preform a normal NAND backup. After that, power off the system.
3. Copy the files in gm9/out on your SD card to a safe spot on your computer. Then, delete the files from **the SD card.**
4. Copy the Nintendo 3DS folder to your SD card root then delete it **from your computer.**
23 changes: 23 additions & 0 deletions cogs/assistance-cmds/nsupdate.switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: What do I need to do before updating my system firmware when running CFW?
help-desc: What you should do before updating a Nintendo Switch
aliases: updateprep,nxupdate
---

**Make sure your version of Atmosphere is up to date and that it supports the latest firmware**

**Atmosphere {ams_ver} (latest release)**
Supports up to firmware {nx_firmware}.

*To find Atmosphere's version information, while booted into CFW, go into System Settings -> System, and look at the text under the System Update button. If it says that a system update is ready instead of displaying the CFW version, type .pendingupdate in <#261581918653513729> to learn how to delete it.*

**Make sure your version of Hekate is up to date and that it supports the latest firmware**

**Hekate {hekate_ver} (latest release)**
Supports up to firmware {nx_firmware}.

*To find Hekate's version information, once Hekate starts, look in the top left corner of the screen. If you use auto-boot, hold `volume -` to stop it.*

**If you use a custom theme (Atmosphere 0.10.0 and above)**
Delete or rename `/atmosphere/contents/0100000000001000` on your SD card prior to updating, as custom themes must be reinstalled for most firmware updates. **Note: On Atmosphere 0.9.4 or below, `contents` is called `titles`.**

20 changes: 20 additions & 0 deletions cogs/assistance-cmds/ntrstream.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Snickerstream: NTR Streaming Client
url: https://gbatemp.net/threads/release-snickerstream-revived-a-proper-release-with-lots-of-improvements-and-new-features.488374/
help-desc: Snickerstream/NTR streaming guide
aliases: snickerstream
---

How to use NTR CFW with Snickerstream to stream your 3DS' screen

# Guide and Advice

Easy [install guide](https://github.com/RattletraPM/Snickerstream/wiki/Streaming-with-NTR) for streaming with Snickerstream.
Snickerstream [app download](https://github.com/RattletraPM/Snickerstream/releases/latest)
Having issues? Check the following:
• Are you connected to the Internet?
• Is your antivirus program blocking the program?
• Make sure you typed the IP correctly.
• Make sure you are using the latest BootNTR Selector with NTR 3.6.
More detailed troubleshooting [available here](https://github.com/RattletraPM/Snickerstream/wiki/Troubleshooting)
Other information about Snickerstream on [Snickerstream's GitHub Wiki](https://github.com/RattletraPM/Snickerstream/wiki)
6 changes: 6 additions & 0 deletions cogs/assistance-cmds/readguide.all.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Please read the guide
help-desc: Read the guide please
---

Asking something that is on the guide will make everyone lose time, so please read and re-read the guide steps 2 or 3 times before coming here.
10 changes: 10 additions & 0 deletions cogs/assistance-cmds/seedminer.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Seedminer
url: https://3ds.hacks.guide/seedminer
thumbnail-url: https://nintendohomebrew.com/assets/img/nhplai.png
author.name: NH & Friends
author.url: https://3ds.hacks.guide/seedminer
help-desc: Links the seedminer guide
---

A guide on how to do the seedminer process to get your 3ds' movable.sed file
7 changes: 7 additions & 0 deletions cogs/assistance-cmds/stock.3ds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Running stock (unmodified) 3DS firmware?
help-desc: Advisory for various Nintendo systems on stock firmware
---

# Check Your Firmware
The latest update to common guide methods mean that the best method for you now depends on your firmware version. Please read the [guide](https://3ds.hacks.guide/get-started) to learn more.
Loading

0 comments on commit 261526b

Please sign in to comment.