first_word -> first_words, better if statement
This commit is contained in:
parent
3c60de8164
commit
f49f34a98f
1 changed files with 14 additions and 15 deletions
|
@ -116,7 +116,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
stderr.write("Failed to generate markov chain")
|
stderr.write("Failed to generate markov chain")
|
||||||
|
|
||||||
def _generate(self, channel_id, first_words):
|
def _generate(self, channel_id, first_words):
|
||||||
if first_word == None:
|
if not first_words:
|
||||||
first_words = self.bot.database.execute_fetchall("""SELECT
|
first_words = self.bot.database.execute_fetchall("""SELECT
|
||||||
third_word, frequency FROM markov WHERE channel_id=? AND
|
third_word, frequency FROM markov WHERE channel_id=? AND
|
||||||
first_word IS NULL AND second_word IS NULL AND third_word
|
first_word IS NULL AND second_word IS NULL AND third_word
|
||||||
|
@ -134,8 +134,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
second_word = self._choose(second_words)
|
second_word = self._choose(second_words)
|
||||||
words = [first_word, second_word]
|
words = [first_word, second_word]
|
||||||
else:
|
elif len(first_words) == 1:
|
||||||
if len(first_words) == 1:
|
|
||||||
first_word = first_word.lower()
|
first_word = first_word.lower()
|
||||||
second_two_words = self.bot.database.execute_fetchall("""SELECT
|
second_two_words = self.bot.database.execute_fetchall("""SELECT
|
||||||
second_word, third_word, frequency FROM markov WHERE
|
second_word, third_word, frequency FROM markov WHERE
|
||||||
|
|
Loading…
Reference in a new issue