generated from Nemesis/Exemple
last all
This commit is contained in:
parent
58d5b31cfe
commit
28969891ac
1 changed files with 30 additions and 11 deletions
19
asmodee.py
19
asmodee.py
|
@ -1142,6 +1142,25 @@ def last(room,event): # Regarde la dernière fois que quelqu'un a écrit un mess
|
|||
args = event['content']['body'].split()
|
||||
args.pop(0)
|
||||
pers = ""
|
||||
if (len(args) >= 1 and args[0] == "all"):
|
||||
try:
|
||||
max_sign = "+"
|
||||
max_duree = 0
|
||||
if (len(args) > 1):
|
||||
max_sign = args[1][0]
|
||||
max_duree = int(args[1][1:])
|
||||
ref_duree = datetime.now() - timedelta(days=max_duree)
|
||||
salon = verifPMRoom(room,event)
|
||||
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 ((max_sign == "+" and usrstats.date < ref_duree) or ((max_sign == "-" and usrstats.date > ref_duree))):
|
||||
reponse += "- " + usrstats.nick + " le " + usrstats.date.strftime("%Y-%m-%d %H:%M:%S") + "\n"
|
||||
msg(salon, reponse)
|
||||
except:
|
||||
msg(room,pers + " : Erreur de commande")
|
||||
else:
|
||||
if (len(args) == 0):
|
||||
pers = getNick(room,event)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue