corrige le ban aléatoire

This commit is contained in:
klafyvel 2018-02-02 01:35:57 +01:00 committed by root
parent 4ddb788e82
commit 9c31a0e4b9

View file

@ -78,10 +78,14 @@ def get_player(player_id):
con = connect_sql() con = connect_sql()
cur = con.cursor() cur = con.cursor()
cur.execute("""select id,firstname,name,ban_end from players s = """select id,firstname,name,ban_end from players
where id=%i"""% player_id) where id={}""".format(player_id)
if DEBUG:
print(s)
cur.execute(s)
row = cur.fetchone() row = cur.fetchone()
print(row)
con.close() con.close()
return {'id': row[0], 'firstname': row[1], 'name': row[2], 'ban_end': row[3]} return {'id': row[0], 'firstname': row[1], 'name': row[2], 'ban_end': row[3]}
@ -447,14 +451,14 @@ def ban_guimoz():
def ban_aleatoire(): def ban_aleatoire():
players = get_players_not_banned() players = get_players_not_banned()
playerid = random.choose(players).id player_1, player_2 = random.sample(players, 2)
ban(23981,playerid,True) ban(player_1['id'],player_2['id'],True)
if __name__ == '__main__': if __name__ == '__main__':
if(sys.argv[1] == "ban_guimoz"): if(sys.argv[1] == "ban_guimoz"):
ban_guimoz() ban_guimoz()
elif(sys.argv[1] == "ban_alea"): elif(sys.argv[1] == "ban_aleatoire"):
ban_aleatoire() ban_aleatoire()
else: else:
app.run() app.run()