#2257 the title in help commands is too large.#2286
Conversation
CaedenPH
left a comment
There was a problem hiding this comment.
Perhaps there is a better way to format this instead of just completely cutting off anything after 256 characters. Does anyone have any ideas?
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
| async def send_error_message(self, error: HelpQueryNotFound) -> None: | ||
| """Send the error message to the channel.""" | ||
| embed = Embed(colour=Colour.red(), title=str(error)) | ||
| # 2257 the title can be too big. so we trim it |
There was a problem hiding this comment.
| # 2257 the title can be too big. so we trim it | |
| # Embed titles have a length limits, so we trim here. |
having a number out of context in a comment isn't very useful.
I know it links to the issue you are fixing, but in 2 months when someone looks at this code, they won't.
Linking the comment to the issue doesn't really add anything, since we already explain why we need to do this.
| """Send the error message to the channel.""" | ||
| embed = Embed(colour=Colour.red(), title=str(error)) | ||
| # 2257 the title can be too big. so we trim it | ||
| embed = Embed(colour=Colour.red(), title=str(error)[:256]) |
There was a problem hiding this comment.
a title of 256 characters is far too long. I know discord allows it to be this long, but that doesn't mean it would be a good title.
| embed = Embed(colour=Colour.red(), title=str(error)[:256]) | |
| embed = Embed( | |
| colour=Colour.red(), | |
| title=textwrap.shorten(error, width=150, placeholder="…"), | |
| ) |
Doing something like this, where we limit to 150 characters, and also append an ellipses would be better IMO.
This suggestion will also require an import textwrap at the top of the file.
|
@ddjerqq Greetings. There seems to be request for changes on this PR. Would you mind fixing them up? Thanks! |
|
oh im so sorry, I forgot i was assigned to this! ill fix the issues asap |
|
No problem. Thanks for the quick reply! |
|
I'll finish this off. I don't have commit permissions to this branch so i'll open a new PR. |
|
Closing in favour of #2380 |
trimmed title in
send_error_message. the title will be 256 characters at most now.