Formats Per-Command Help Output#1285
Conversation
Modifies the docstring sent for per-command help to remove weird formatting issues mentioned in #1232. Signed-off-by: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com>
|
Thank you for contributing to Python Discord! Please check out the following documents:
|
Numerlor
left a comment
There was a problem hiding this comment.
This breaks the help of multiple commands like tempban or doc.
Is this worth taking care of? I don't think there's a proper way for us to differentiate between newlines added for readability in the source and the ones that are also necessary in the help output. That'd mean we'd have to change the docstrings with some special syntax or using line continuation which imo is not worth the tradeoff of complicating how it looks in the source code for the small improvement to what's sent on discord
|
I tested this with all the commands I could find in help, and I got the following: Broken:
Improved:
I'm not actually seeing any difference in doc, so I won't address it. All the other broken commands have their doc syntax in common. I'm seeing a few possible solutions:
|
Sorry, it's the get subcommand of doc. Doing the checks at runtime doesn't sound like it's worth it to me, as new commands that may use the newlines in a way that shouldn't be stripped most probably won't be affected by it. |
|
Superstarify needs to be fixed too. |
|
As a bit of an update, there is no real good way to fix the output, without changing the docstrings. Paragraphs that pass the 80 character limit have to be spaced onto multiple lines for linting, but discord embeds can't really automatically handle that. There is no good way to stay under the limit, and present a good output. This means we will have to shorten or break up the broken doc strings or implement a parsing solution. |
|
Do we just go for the easy, but tedious, solution and update the doc strings? I think the other options are complex and would add maintenance burden. We could then just ensure we test what the help embed looks like for future commands before approving. |
@ChrisLovering this is probably the best way to do it for now. |
|
@HassanAbouelela we should probably open up another PR to fix the necessary docstrings. |
|
Just to clarify, which solution is this? There are two similar solutions. The first one is the change added by this PR + changing the doc strings of time units. The other is to change every single docstring that takes more than one line. |
|
I think we're going for the 1st option. @ChrisLovering, opinions? |
|
Yea, the former. We should have a mechanism to force a line break when needed though, for when we need to do things like the time units in future. |
|
I had actually written a small patch to allow for forcefully breaking lines (more specifically, I used the escape sequence used for time units -- The implementation had the added benefit of not requiring any docstring changes. At this point, it's gone, and this PR is very outaded, but it should be pretty easy to take the work already done here, add on the patch I just described in a new PR. |
|
@HassanAbouelela I think we should make a new PR for the docstrings if we are to manually format them. |
|
This has been taken over by #1876 |
Closes #1232
Description
Modifies the docstring sent for per-command help to remove weird formatting issues mentioned in #1232. Removes newlines that are not used for paragraph breaks, after retrieving the docstring, and lets the embed handle it on the discord side.
The Old and Updated Output for Reference