diff options
-rw-r--r-- | markov/markov.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/markov/markov.py b/markov/markov.py index a61a3ce..2a37a6c 100644 --- a/markov/markov.py +++ b/markov/markov.py @@ -365,6 +365,7 @@ class Markov(commands.Cog): ) completion_count = row[0] + next_token = None for i in range(MAX_TOKEN_GENERATION_ITERATIONS): row = await ( await db.execute( @@ -405,7 +406,10 @@ class Markov(commands.Cog): " all of them. This should never happen!" ) else: - token = "" + # If we went through MAX_TOKEN_GENERATION_ITERATIONS completions + # without selecting any, then just select the last one we considered + # (round off the probability, effectively). + token = next_token if token == "": break |