This commit is contained in:
nemesis 2019-04-11 16:51:41 +02:00
parent 58d5b31cfe
commit 28969891ac

View file

@ -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 = event['content']['body'].split()
args.pop(0) args.pop(0)
pers = "" 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): if (len(args) == 0):
pers = getNick(room,event) pers = getNick(room,event)
else: else: