[Help] formatting additions #3339

Merged
mikeshardmind merged 3 commits from help-additions into V3/develop 2020-01-13 17:50:46 +01:00
mikeshardmind commented 2020-01-11 16:47:59 +01:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

This one was discussed back with #3063 but was delayed.
This includes most of those changes, barring the whitespace ones, which were the hold up.

### Type - [ ] Bugfix - [X] Enhancement - [ ] New feature ### Description of the changes This one was discussed back with #3063 but was delayed. This includes most of those changes, barring the whitespace ones, which were the hold up.
Jackenmen commented 2020-01-13 13:17:19 +01:00 (Migrated from github.com)

Would it be bad to have this as async function instead? I.e. for accessing config, unless you would just want cog creators to cache it which probably isn't a bad idea either.

Would it be bad to have this as async function instead? I.e. for accessing config, unless you would just want cog creators to cache it which probably isn't a bad idea either.
Jackenmen (Migrated from github.com) requested changes 2020-01-13 13:54:47 +01:00
Jackenmen (Migrated from github.com) left a comment

A very cool addition, saw you're adding i18n here, and noticed 2 places with missing T_(), other than that and what I asked in previous comment, looks good.

https://github.com/mikeshardmind/Red-DiscordBot/blob/help-additions/redbot/core/commands/help.py#L554

https://github.com/mikeshardmind/Red-DiscordBot/blob/help-additions/redbot/core/commands/help.py#L564

I'm probably gonna use such Command subclass once this feature goes in:

class MultilineDescription(commands.Command):
    def format_help_for_context(self, ctx: commands.Context) -> str:
        command_help = super().format_help_for_context(ctx)
        pos = command_help.find("\n\n")
        command_help = command_help[:pos].replace("\n", " ") + command_help[pos:]
        return command_help
A very cool addition, saw you're adding i18n here, and noticed 2 places with missing `T_()`, other than that and what I asked in previous comment, looks good. https://github.com/mikeshardmind/Red-DiscordBot/blob/help-additions/redbot/core/commands/help.py#L554 https://github.com/mikeshardmind/Red-DiscordBot/blob/help-additions/redbot/core/commands/help.py#L564 I'm probably gonna use such Command subclass once this feature goes in: ```py class MultilineDescription(commands.Command): def format_help_for_context(self, ctx: commands.Context) -> str: command_help = super().format_help_for_context(ctx) pos = command_help.find("\n\n") command_help = command_help[:pos].replace("\n", " ") + command_help[pos:] return command_help ```
Jackenmen (Migrated from github.com) requested changes 2020-01-13 16:55:02 +01:00
Jackenmen (Migrated from github.com) commented 2020-01-13 16:54:59 +01:00

If use_embeds=True, format_fuzzy_results will return discord.Embed so this doesn't work properly with L560 where you create a new embed using msg var as embed description.

If `use_embeds=True`, `format_fuzzy_results` will return `discord.Embed` so this doesn't work properly with L560 where you create a new embed using `msg` var as embed description.
mikeshardmind (Migrated from github.com) reviewed 2020-01-13 17:09:28 +01:00
mikeshardmind (Migrated from github.com) commented 2020-01-13 17:09:27 +01:00

Yep.... Will handle consolidating more of the logic another time...

Yep.... Will handle consolidating more of the logic another time...
Jackenmen (Migrated from github.com) requested changes 2020-01-13 17:40:54 +01:00
@ -57,6 +58,49 @@ class CogCommandMixin:
checks=getattr(decorated, "__requires_checks__", []),
Jackenmen (Migrated from github.com) commented 2020-01-13 17:37:42 +01:00

Letter casing is a little weird here.

Letter casing is a little weird here.
@ -60,0 +66,4 @@
- get the localized help
- substitute ``[p]`` with ``ctx.clean_prefix``
- substitute ``[botname]`` with ``ctx.me.display_name``
Jackenmen (Migrated from github.com) commented 2020-01-13 17:38:48 +01:00

Preference thing, but we could start using from __future__ import annotations for this.

Preference thing, but we could start using `from __future__ import annotations` for this.
Jackenmen (Migrated from github.com) commented 2020-01-13 17:40:27 +01:00

It might also be good to mention here that this method can (is intended to) be subclassed.

It might also be good to mention here that this method can (is intended to) be subclassed.
mikeshardmind (Migrated from github.com) reviewed 2020-01-13 17:44:59 +01:00
@ -60,0 +66,4 @@
- get the localized help
- substitute ``[p]`` with ``ctx.clean_prefix``
- substitute ``[botname]`` with ``ctx.me.display_name``
mikeshardmind (Migrated from github.com) commented 2020-01-13 17:44:59 +01:00

It's mentioned in the docstring already.

It's mentioned in the docstring already.
mikeshardmind (Migrated from github.com) reviewed 2020-01-13 17:46:21 +01:00
@ -60,0 +66,4 @@
- get the localized help
- substitute ``[p]`` with ``ctx.clean_prefix``
- substitute ``[botname]`` with ``ctx.me.display_name``
mikeshardmind (Migrated from github.com) commented 2020-01-13 17:46:21 +01:00

I've been adding it to files I touch where it doesn't require re-evaluating existing forward references for validity. Planned, but this one can wait.

I've been adding it to files I touch where it doesn't require re-evaluating existing forward references for validity. Planned, but this one can wait.
Jackenmen (Migrated from github.com) approved these changes 2020-01-13 17:49:36 +01:00
Jackenmen (Migrated from github.com) left a comment

LGTM, thank you for this one, this will allow cog creators to do some great things.

LGTM, thank you for this one, this will allow cog creators to do some great things.
Sign in to join this conversation.
No reviewers
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!3339
No description provided.