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