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