mirror of
https://github.com/erkin/ponysay.git
synced 2025-03-19 02:07:12 +01:00
Fallback quote for ponies without quotes
This commit is contained in:
parent
3bb5a68d7f
commit
2301f094ad
1 changed files with 13 additions and 9 deletions
22
ponysay.py
22
ponysay.py
|
@ -349,15 +349,19 @@ class ponysay():
|
||||||
alts.append(pair)
|
alts.append(pair)
|
||||||
pairs = alts
|
pairs = alts
|
||||||
|
|
||||||
pair = pairs[random.randrange(0, len(pairs))]
|
if not len(pairs) == 0:
|
||||||
qfile = None
|
pair = pairs[random.randrange(0, len(pairs))]
|
||||||
try:
|
qfile = None
|
||||||
qfile = open(pair[1], 'r')
|
try:
|
||||||
args.message = '\n'.join(qfile.readlines()).strip()
|
qfile = open(pair[1], 'r')
|
||||||
finally:
|
args.message = '\n'.join(qfile.readlines()).strip()
|
||||||
if qfile is not None:
|
finally:
|
||||||
qfile.close()
|
if qfile is not None:
|
||||||
args.pony = [pair[0]]
|
qfile.close()
|
||||||
|
args.pony = [pair[0]]
|
||||||
|
else:
|
||||||
|
args.pony = args.quote
|
||||||
|
args.message = 'I got nuthin\' good to say :('
|
||||||
|
|
||||||
self.print_pony(args)
|
self.print_pony(args)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue