fixed not responding bug

This commit is contained in:
lickthecheese 2020-04-23 16:05:16 -04:00
parent a16fade5af
commit 7cf6a2d747
2 changed files with 9 additions and 2 deletions

View file

@ -35,11 +35,18 @@ async def genOut(self, noun):
iter=0 iter=0
out = [noun] out = [noun]
while (out[0] not in beg or nouns.count(out[0])-1 > iter * self.enmul) and iter < 7: while (out[0] not in beg or nouns.count(out[0])-1 > iter * self.enmul) and iter < 7:
try:
out = [ random.choice(list(prew.find(pro=out[0])))['pre'] ] + out out = [ random.choice(list(prew.find(pro=out[0])))['pre'] ] + out
except IndexError:
iter += 69
iter += 1 iter += 1
iter = 0 iter = 0
while (out[-1] not in end or nouns.count(out[-1])-1 > iter * self.enmul) and iter < 7: while (out[-1] not in end or nouns.count(out[-1])-1 > iter * self.enmul) and iter < 7:
try:
out.append(random.choice(list(prew.find(pre=out[-1])))['pro']) out.append(random.choice(list(prew.find(pre=out[-1])))['pro'])
except IndexError:
iter += 69
iter += 1 iter += 1
return out return out