Skip to content
This repository has been archived by the owner on Apr 20, 2019. It is now read-only.

Commit

Permalink
don't break entirely on nonexistant word
Browse files Browse the repository at this point in the history
  • Loading branch information
codl committed Feb 2, 2013
1 parent 130c477 commit e8109ec
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions eqbot.py
Expand Up @@ -586,7 +586,6 @@ def rand_track(e, bot):
except (OSError, ValueError):
print("Cannot open triplets.json for reading")
tripletlock.release()
print("ok")

def tripletadd(left, right):
global dumptimer
Expand All @@ -607,16 +606,15 @@ def tripletadd(left, right):
except OSError:
print("Cannot open triplets.json for writing")
tripletlock.release()
print("ok")

def tripletget(left):
left = left.lower()
tripletlock.acquire()
if left not in triplets:
try:
ret = random.choice(triplets[left])
except KeyError:
ret = ""
ret = random.choice(triplets[left])
tripletlock.release()
print("ok")
return ret

def store_words(e, bot):
Expand Down

0 comments on commit e8109ec

Please sign in to comment.