Fixed rape

This commit is contained in:
mrhanky 2017-08-22 21:20:43 +02:00
parent 7924d9119e
commit 3a7bb88a7d
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8

View File

@ -30,7 +30,7 @@ class Rape(DatabasePlugin):
# Colorize owe amount and return string
if owes:
fines = '4${fines}'.format(fines=owes['fines'])
fines = '4${}'.format(owes['fines'])
else:
fines = '3$0'
@ -47,10 +47,14 @@ class Rape(DatabasePlugin):
rand = random.randint(0, 3)
if rand not in (0, 1):
self.bot.action(target, 'rapes {nick}'.format(nick=nick))
self.bot.action(target, 'rapes {}'.format(nick))
else:
fine = random.randint(1, 500)
# Get reason based on rand value
fined = (mask.nick, nick)[rand]
reason = ('raping', 'being too lewd and getting raped')[rand]
# Insert or add fine to database and return total owe
self.cur.execute('''
INSERT INTO
@ -61,15 +65,12 @@ class Rape(DatabasePlugin):
fines = users.fines + excluded.fines
RETURNING
fines
''', [mask.nick, fine])
''', [fined, fine])
self.con.commit()
# Get reason based on rand value
reason = ('raping', 'being too lewd and getting raped')[rand]
# Print fine and total owe
self.bot.action(target, 'fines {nick} \x02${fine}\x02 for {reason}. You owe: \x0304${total}\x03'.format(
nick=mask.nick,
nick=fined,
fine=fine,
reason=reason,
total=self.cur.fetchone()['fines'],