diff --git a/nardco.py b/nardco.py index 0a8c21a42597872ba480b8c8b00e64126ae1b137..df679b20c914ec3ee59b4daa090f22a4fc40803d 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)