handle empty database

This commit is contained in:
Lynne 2019-07-10 21:25:07 +10:00
parent 023056b5d5
commit 32fa2302aa
1 changed files with 6 additions and 1 deletions

View File

@ -26,10 +26,15 @@ def make_sentence(output):
for toot in toots: # TODO: find a more efficient way to do this
toots_str += "\n{}".format(toot[0])
model = nlt_fixed(toots_str)
toots_str = None
db.close()
os.remove("toots-copy.db")
if toots_str.rstrip("\n") == "":
output.send("Database is empty! Try running main.py.")
return
toots_str = None
sentence = None
tries = 0
while sentence is None and tries < 10: