Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop printing help menu on unknown command #558

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Conversation

H-Shay
Copy link
Contributor

@H-Shay H-Shay commented Oct 29, 2024

while I was in the area, make the help menu a little more manageable by grouping related commands. I couldn't fit all of the new menu into a screenshot, but the gist of it is:
mjolnir_help

Areas are:

  • Protection Actions/Options
  • Moderation Actions
  • Policy List Options/Actions
  • Room Managment
  • Bot Status and Management

Fixes #204 and #52

@H-Shay H-Shay requested a review from a team as a code owner October 29, 2024 22:01
@H-Shay H-Shay requested a review from turt2live October 29, 2024 22:59
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

const html = `<b>Mjolnir help:</b><br><pre><code>${htmlEscape(menu)}</code></pre>`;
const text = `Mjolnir help:\n${menu}`;

const html = `<h3>Mjolnir help menu:</h3><br><b>Protection Actions/Options:</b><pre><code>${htmlEscape(protectionMenu)}</code></pre><br><b>Moderation Actions:</b><pre><code>${htmlEscape(actionMenu)}</code></pre><br><b>Policy List Options/Actions:</b><pre><code>${htmlEscape(policyListMenu)}</code></pre><br><b>Room Managment:</b><pre><code>${htmlEscape(roomsMenu)}</code></pre><br><b>Bot Status and Management:</b><pre><code>${htmlEscape(botMenu)}</code></pre>`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking: fwiw, the tilde character strings support newlines to retain formatting. For plaintext this is somewhat of an issue, but for HTML the extra whitespace doesn't affect anything. To make this a bit easier to read we can add a bunch of newlines:

Suggested change
const html = `<h3>Mjolnir help menu:</h3><br><b>Protection Actions/Options:</b><pre><code>${htmlEscape(protectionMenu)}</code></pre><br><b>Moderation Actions:</b><pre><code>${htmlEscape(actionMenu)}</code></pre><br><b>Policy List Options/Actions:</b><pre><code>${htmlEscape(policyListMenu)}</code></pre><br><b>Room Managment:</b><pre><code>${htmlEscape(roomsMenu)}</code></pre><br><b>Bot Status and Management:</b><pre><code>${htmlEscape(botMenu)}</code></pre>`;
const html = `<h3>Mjolnir help menu:</h3><br>
<b>Protection Actions/Options:</b><pre><code>${htmlEscape(protectionMenu)}</code></pre><br>
<b>Moderation Actions:</b><pre><code>${htmlEscape(actionMenu)}</code></pre><br>
<b>Policy List Options/Actions:</b><pre><code>${htmlEscape(policyListMenu)}</code></pre><br>
<b>Room Managment:</b><pre><code>${htmlEscape(roomsMenu)}</code></pre><br>
<b>Bot Status and Management:</b><pre><code>${htmlEscape(botMenu)}</code></pre>`;

The linter may have opinions on my formatting here.

(also <br /> should be self-closing, like so)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are good to know, thanks for pointing them out!

@H-Shay H-Shay merged commit dc138be into main Oct 30, 2024
5 checks passed
@H-Shay H-Shay deleted the shay/intentional_help branch October 30, 2024 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't print help automatically on unknown command
2 participants