diff options
| author | 2020-01-01 00:43:03 +0100 | |
|---|---|---|
| committer | 2020-01-01 00:43:03 +0100 | |
| commit | 2b032a35fa64e770678b051c164dbfc53ef56893 (patch) | |
| tree | 6d20d8ecf1ffa73ccad28a6fcdfe744c14dd46c0 | |
| parent | Make sure description is truncated to max 1000 chars (diff) | |
Rename last_paragraph_end variable to a more fitting name
Diffstat (limited to '')
| -rw-r--r-- | bot/cogs/doc.py | 12 | 
1 files changed, 6 insertions, 6 deletions
| diff --git a/bot/cogs/doc.py b/bot/cogs/doc.py index c1bb4ad41..16a690f39 100644 --- a/bot/cogs/doc.py +++ b/bot/cogs/doc.py @@ -306,17 +306,17 @@ class Doc(commands.Cog):          # of a double newline (interpreted as a paragraph) before index 1000.          if len(description) > 1000:              shortened = description[:1000] -            last_paragraph_end = shortened.rfind('\n\n', 100) +            description_cutoff = shortened.rfind('\n\n', 100)              # Search the shortened version for cutoff points in decreasing desirability,              # cutoff at 1000 if none are found. -            if last_paragraph_end == -1: +            if description_cutoff == -1:                  for string in (". ", ", ", ",", " "): -                    last_paragraph_end = shortened.rfind(string) -                    if last_paragraph_end != -1: +                    description_cutoff = shortened.rfind(string) +                    if description_cutoff != -1:                          break                  else: -                    last_paragraph_end = 1000 -            description = description[:last_paragraph_end] +                    description_cutoff = 1000 +            description = description[:description_cutoff]              # If there is an incomplete code block, cut it out              if description.count("```") % 2: | 
