bots should no longer get stuck in a loop forever

This commit is contained in:
Lynne 2018-10-29 06:28:56 +10:00
parent 8bc97a0203
commit f39fbc9c67

View file

@ -29,8 +29,9 @@ def make_sentence(output):
os.remove("toots-copy.db")
sentence = None
while sentence is None or re.match("^@\u202B", sentence):
while sentence is None:
sentence = model.make_short_sentence(500, tries=10000)
sentence = re.sub("^@\u202B[^ ]* ", "", sentence)
output.send(sentence)
def make_toot(force_markov = False, args = None):