diff options
-rw-r--r-- | markov/markov.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/markov/markov.py b/markov/markov.py index 73ac08e..d7cf14b 100644 --- a/markov/markov.py +++ b/markov/markov.py @@ -164,12 +164,12 @@ class Markov(commands.Cog): def append_token(self, text, token): # NOTE: if changing PUNCTUATION, also change the regex in process_message() with the corresponding note PUNCTUATION = r".,!?/;()" - if token == "/": - text = text[:-1] + token - elif token == "(": + if token == "(": text += token + elif token == "/": + text = text.removesuffix(" ") + token elif token in PUNCTUATION: - text = text[:-1] + token + " " + text = text.removesuffix(" ") + token + " " else: text += token + " " return text |