generated from Nemesis/Exemple
last inactif
This commit is contained in:
parent
c2e067236e
commit
2b02b689be
1 changed files with 21 additions and 0 deletions
21
asmodee.py
21
asmodee.py
|
@ -1162,6 +1162,27 @@ def last(room,event): # Regarde la dernière fois que quelqu'un a écrit un mess
|
||||||
if ((max_sign == "+" and usrstats.date < ref_duree) or ((max_sign == "-" and usrstats.date > ref_duree))):
|
if ((max_sign == "+" and usrstats.date < ref_duree) or ((max_sign == "-" and usrstats.date > ref_duree))):
|
||||||
reponse += "- " + usrstats.nick + "(" + user + ")" + " le " + usrstats.date.strftime("%Y-%m-%d %H:%M:%S") + "\n"
|
reponse += "- " + usrstats.nick + "(" + user + ")" + " le " + usrstats.date.strftime("%Y-%m-%d %H:%M:%S") + "\n"
|
||||||
msg(salon, reponse)
|
msg(salon, reponse)
|
||||||
|
elif (len(args) >= 1 and args[0] == "inactifs"):
|
||||||
|
max_sign = "+"
|
||||||
|
max_duree = 0
|
||||||
|
max_mess = 0
|
||||||
|
if (len(args) > 2):
|
||||||
|
max_sign = args[1][0]
|
||||||
|
max_duree = int(args[1][1:])
|
||||||
|
max_mess = int(args[2])
|
||||||
|
ref_duree = datetime.now() - timedelta(days=max_duree)
|
||||||
|
salon = verifPMRoom(room,event)
|
||||||
|
all_usr = {}
|
||||||
|
reponse = "Les gens ayant posté à " + max_sign + " de " + str(max_duree) + " jours :\n"
|
||||||
|
for cle,valeur in stats.items():
|
||||||
|
if (cle[0] == room.room_id):
|
||||||
|
usrstats = stats[room.room_id,cle[1]]
|
||||||
|
if ((usrstats.user in all_usr and all_usr[usrstats.user].date < usrstats.date) or not usrstats.user in all_usr):
|
||||||
|
all_usr[usrstats.user] = usrstats
|
||||||
|
for user,usrstats in all_usr.items():
|
||||||
|
if (((max_sign == "+" and usrstats.date < ref_duree) or ((max_sign == "-" and usrstats.date > ref_duree))) and usrstats.mess <= max_mess):
|
||||||
|
reponse += "- " + usrstats.nick + "(" + user + ")" + " le " + usrstats.date.strftime("%Y-%m-%d %H:%M:%S") + "\n"
|
||||||
|
msg(salon, reponse)
|
||||||
else:
|
else:
|
||||||
if (len(args) == 0):
|
if (len(args) == 0):
|
||||||
pers = getNick(room,event)
|
pers = getNick(room,event)
|
||||||
|
|
Loading…
Reference in a new issue