[V3 Help] add tagline support #1705

Merged
palmtree5 merged 4 commits from V3/enhancement/helpset_tagline into V3/develop 2018-05-28 05:25:19 +02:00
palmtree5 commented 2018-05-24 00:49:25 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Implements another feature requested in #1605

[p]helpset tagline allows for adding additional text onto the current footer message (this one)

Type !!!help <command> for more info on a command. You can also type !!!help <category> for more info on a category.

The command:

  • grabs the old tagline
    • If a tagline already exists, sets the tagline in config to an empty string
  • grabs formatted help for itself using the embed help formatter
  • grabs the footer out of the first embed in the list
  • length calculations (split out based on the value of the result)
    • default footer + 2 newlines + the new tagline > 2048
      • a message is sent indicating the tagline is too long
        • Contains max character count allowed for it (2046 - the length of the default footer)
      • old tagline (if there was one) is placed back in config.
    • default footer + 2 newlines + the new tagline <= 2048
      • the user's input is set as the tagline in config
      • a message is output indicating that it has been set

NOTE: The reason for formatting help and extracting from the embed instead of just calling the function containing the text of the default footer (redbot.core.help_formatter.Help.get_ending_note) directly is an error message I was getting trying to do it that way

ERROR events on_command_error 203: Exception in command 'helpset tagline'
Traceback (most recent call last):
  File "/home/palm/.local/share/virtualenvs/Red-DiscordBot-zFqGc7tM/src/discord.py/discord/ext/commands/core.py", line 62, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/home/palm/code/Red-DiscordBot/redbot/core/core_commands.py", line 886, in helpset_tagline
    end_note_length = len(ctx.bot.formatter.get_ending_note())
  File "/home/palm/code/Red-DiscordBot/redbot/core/help_formatter.py", line 116, in get_ending_note
    self.clean_prefix
  File "/home/palm/.local/share/virtualenvs/Red-DiscordBot-zFqGc7tM/src/discord.py/discord/ext/commands/formatter.py", line 184, in clean_prefix
    user = self.context.bot.user
AttributeError: 'NoneType' object has no attribute 'bot'

EDIT: formatting of the command logic description

### Type - [ ] Bugfix - [x] Enhancement - [ ] New feature ### Description of the changes Implements another feature requested in #1605 `[p]helpset tagline` allows for adding additional text onto the current footer message (this one) ``` Type !!!help <command> for more info on a command. You can also type !!!help <category> for more info on a category. ``` The command: - grabs the old tagline - If a tagline already exists, sets the tagline in config to an empty string - grabs formatted help for itself using the embed help formatter - grabs the footer out of the first embed in the list - length calculations (split out based on the value of the result) - default footer + 2 newlines + the new tagline > 2048 - a message is sent indicating the tagline is too long - Contains max character count allowed for it (2046 - the length of the default footer) - old tagline (if there was one) is placed back in config. - default footer + 2 newlines + the new tagline <= 2048 - the user's input is set as the tagline in config - a message is output indicating that it has been set NOTE: The reason for formatting help and extracting from the embed instead of just calling the function containing the text of the default footer (`redbot.core.help_formatter.Help.get_ending_note`) directly is an error message I was getting trying to do it that way ```py ERROR events on_command_error 203: Exception in command 'helpset tagline' Traceback (most recent call last): File "/home/palm/.local/share/virtualenvs/Red-DiscordBot-zFqGc7tM/src/discord.py/discord/ext/commands/core.py", line 62, in wrapped ret = yield from coro(*args, **kwargs) File "/home/palm/code/Red-DiscordBot/redbot/core/core_commands.py", line 886, in helpset_tagline end_note_length = len(ctx.bot.formatter.get_ending_note()) File "/home/palm/code/Red-DiscordBot/redbot/core/help_formatter.py", line 116, in get_ending_note self.clean_prefix File "/home/palm/.local/share/virtualenvs/Red-DiscordBot-zFqGc7tM/src/discord.py/discord/ext/commands/formatter.py", line 184, in clean_prefix user = self.context.bot.user AttributeError: 'NoneType' object has no attribute 'bot' ``` EDIT: formatting of the command logic description
tekulvw (Migrated from github.com) reviewed 2018-05-24 00:49:25 +02:00
Twentysix26 (Migrated from github.com) reviewed 2018-05-24 00:49:25 +02:00
palmtree5 commented 2018-05-24 02:15:53 +02:00 (Migrated from github.com)

On second thought, I've actually changed this to be so that the user has full control over the content of the footer in the help embeds. They can always reset to the default too (by running [p]helpset tagline with no args).

The thought with putting the tagline in the footer is that the footer is already consistent across all cases of help command usage, whereas something like the description isn't.

Consider the following:

  • Command
    • Footer: Type ???help <command> for more info on a command. You can also type ???help <category> for more info on a category.
    • Description: "Syntax: {0.clean_prefix}{1.signature}".format(self, command)
  • Cog
    • Footer: Type ???help <command> for more info on a command. You can also type ???help <category> for more info on a category.
    • Description: class docstring, possibly translated into another language
  • Bot
    • Footer: Type ???help <command> for more info on a command. You can also type ???help <category> for more info on a category.
    • Description: Red - Version <insert version number here> - Page <number> of <total>

It's much easier to just put this into the footer of the embed rather than trying to put it into the description, which is of variable length (especially when considering class docstrings are used and are likely to be different in length per-cog). We're also not really losing anything giving the user control over the content of the footer as the default is literally a somewhat concise version of [p]help help.

On second thought, I've actually changed this to be so that the user has full control over the content of the footer in the help embeds. They can always reset to the default too (by running `[p]helpset tagline` with no args). The thought with putting the tagline in the footer is that the footer is already consistent across all cases of help command usage, whereas something like the description isn't. Consider the following: - Command - Footer: `Type ???help <command> for more info on a command. You can also type ???help <category> for more info on a category.` - Description: `"Syntax: {0.clean_prefix}{1.signature}".format(self, command)` - Cog - Footer: `Type ???help <command> for more info on a command. You can also type ???help <category> for more info on a category.` - Description: class docstring, possibly translated into another language - Bot - Footer: `Type ???help <command> for more info on a command. You can also type ???help <category> for more info on a category.` - Description: *Red - Version \<insert version number here\> - Page \<number\> of \<total\>* It's much easier to just put this into the footer of the embed rather than trying to put it into the description, which is of variable length (especially when considering class docstrings are used and are likely to be different in length per-cog). We're also not really losing anything giving the user control over the content of the footer as the default is literally a somewhat concise version of `[p]help help`.
Kowlin (Migrated from github.com) approved these changes 2018-05-28 05:25:12 +02:00
Sign in to join this conversation.
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!1705
No description provided.