From 57d21cc96df78f4a0826f67c5d306c1ab0c887fc Mon Sep 17 00:00:00 2001 From: admin666 Date: Sun, 6 Feb 2022 01:54:17 +0100 Subject: [PATCH] =?UTF-8?q?=C3=A9tat=20au=206=20f=C3=A9vrier=202022?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands.py | 41 ++++++++++++++++++++++++++++++++++++++++- hintTables.py | 6 +++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/commands.py b/commands.py index 00a00ab..e99b01a 100644 --- a/commands.py +++ b/commands.py @@ -1,4 +1,4 @@ - +import pickle # Isengard commands @@ -32,6 +32,13 @@ def cmdmainteneur(owners, nick, text, sbuf): host = splittedtext[1] maintainer = splittedtext[2] + sbuf.buf[host] = {} + sbuf.buf[host]["destmuc"] = None + sbuf.buf[host]["status_state"] = None + sbuf.buf[host]["status_type"] = None + sbuf.buf[host]["text"] = None + sbuf.buf[host]["raw"] = None + sbuf.buf[host]["needUpdate"] = False sbuf.buf[host]["maintainer"] = maintainer return "le responsable est à présent " \ @@ -43,9 +50,39 @@ def cmdmainteneur(owners, nick, text, sbuf): return "Syntaxe invalide" +def cmdsave(owners, nick, text, sbuf): + """ + Save + """ + + if not nick in owners: + return "désolé mais vous n'êtes pas autorisé à utiliser cette commande." + + try: + with open('current_buffer', 'wb') as current_buffer_file: + pickle.dump(sbuf.buf, current_buffer_file) + return "OK" + except Exception as e: + print(repr(e)) + return "Erreur à l'exécution" +def cmdload(owners, nick, text, sbuf): + """ + Save + """ + + if not nick in owners: + return "désolé mais vous n'êtes pas autorisé à utiliser cette commande." + + try: + with open('current_buffer', 'rb') as current_buffer_file: + sbuf.buf = pickle.load(current_buffer_file) + return "OK" + except Exception as e: + print(repr(e)) + return "Erreur à l'exécution" # Commands @@ -54,6 +91,8 @@ commandtable = { "ping" : cmdping, "mainteneur" : cmdmainteneur, +"save" : cmdsave, +"load" : cmdload, } diff --git a/hintTables.py b/hintTables.py index a7c42a1..481c09d 100644 --- a/hintTables.py +++ b/hintTables.py @@ -57,5 +57,9 @@ topictable = { "à vos ordres !", "yop !", "hello", "chalut"], "Bonjour" : ["yop, c'est moi ! ;)", "ici la Tour, la seule et unique !", - "à vos ordres !", "yop !", "hello"] + "à vos ordres !", "yop !", "hello"], + +"Merci" : ["de rien !", "you're welcome :)", "c'est naturel.", "pas de soucis !"], + +"merci" : ["de rien !", "you're welcome :)", "c'est naturel.", "pas de soucis !"] }