Improve simple responses.

This commit is contained in:
Alexandr
2018-12-28 18:52:37 +03:00
parent d406ec14b4
commit e1e6ee1e9d
2 changed files with 10 additions and 8 deletions

View File

@ -153,8 +153,9 @@ class DataBase:
result = self.execute(sql)
return(result)
def get_random_word(self, count=1):
sql = "SELECT word FROM word ORDER BY random() LIMIT %s" % count
def get_random_word(self, count=1, like="%"):
sql = "SELECT word FROM word WHERE word LIKE '%s' ORDER BY random() LIMIT %s" % (like, count)
print(sql)
result = self.execute(sql)
return(result)