From 018048cb47212f2e3b8c6381fa495720e27fe21c Mon Sep 17 00:00:00 2001 From: Loris TICHADOU <loris.tichadou@ensiie.fr> Date: Fri, 9 Jul 2021 09:10:59 +0000 Subject: [PATCH] Update nardco.py --- nardco.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/nardco.py b/nardco.py index 0a8c21a..df679b2 100755 --- a/nardco.py +++ b/nardco.py @@ -74,6 +74,16 @@ total = 0 pachoTime = time.time() +def convert_seconds_to_days(seconds) : + seconds_in_day = 60 * 60 * 24 + seconds_in_hour = 60 * 60 + seconds_in_minute = 60 + days = seconds // seconds_in_day + hours = (seconds - (days * seconds_in_day)) // seconds_in_hour + minutes = (seconds - (days * seconds_in_day) - (hours * seconds_in_hour)) // seconds_in_minute + return str(days) + " jours, " + str(hours) + " heures, " + str(minutes) + " minutes" + + def isCommande(string): return string[0] == config.cmdCarac @@ -312,10 +322,14 @@ class Boooob(ircbot.SingleServerIRCBot): ("Commandes disponibles :{0}").format(', '.join(cmds))) elif cmd == "pacho" : difference = time.time() - pachoTime - sent_message = "Wooow ! Ca fait deja " + str(int(difference)) + " secondes que Pacho n'est plus beauf" + sent_message = "Wooow ! Ca fait deja " + convert_seconds_to_days(int(difference)) + " que Pacho n'est plus beauf" + if len(args) > 2 and args[1] == "set" and int(args[2]): + pachoTime = time.time() - int(args[2]) + sent_message = "Timer setté à " + args[2] + if len(args) > 1 and args[1] == "reset" : pachoTime = time.time() - sent_message = "Et dire que ca faisait seulement " + str(int(difference)) + " secondes que Pacho n'avait pas fait d'allusions" + sent_message = "Et dire que ca faisait seulement " + convert_seconds_to_days(int(difference)) + " que Pacho n'avait pas fait d'allusions" serv.privmsg(canal, sent_message) -- GitLab