From b349d40311f9d777ed343cf350451c20010507f3 Mon Sep 17 00:00:00 2001 From: nemesis Date: Sun, 22 Jul 2018 22:58:52 +0200 Subject: [PATCH] =?UTF-8?q?v=C3=A9rif=20admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asmodee.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/asmodee.py b/asmodee.py index 3ae0bad..17e9cf4 100755 --- a/asmodee.py +++ b/asmodee.py @@ -32,6 +32,7 @@ bot = None clock = {} stats = {} quotes = {} +admins = [] # Admins du bot def horloge_read(): global clock @@ -996,16 +997,17 @@ def quote(room,event): reponse = reponse + cle[0] + " / " + str(cle[1]) + " : " + valeur + "\n" salon.send_text(reponse) elif (len(args) > 1 and args[0] == "del"): - id = args[1] - salon = verifPMRoom(room,event) - reponse = "Voici la citation supprimée : \n" - for rid,fame in quotes.items(): - for cle,valeur in fame.items(): - if (str(cle[1]) == id): - del fame[cle[0],cle[1]] - reponse = reponse + rid + " / " + cle[0] + " / " + str(cle[1]) + " : " + valeur + "\n" - break - salon.send_text(reponse) + if (event['sender'] in admins): + id = args[1] + salon = verifPMRoom(room,event) + reponse = "Voici la citation supprimée : \n" + for rid,fame in quotes.items(): + for cle,valeur in fame.items(): + if (str(cle[1]) == id): + del fame[cle[0],cle[1]] + reponse = reponse + rid + " / " + cle[0] + " / " + str(cle[1]) + " : " + valeur + "\n" + break + salon.send_text(reponse) elif (len(args) > 0): # cite une quote d'une personne precise nick = " ".join(args) @@ -1044,11 +1046,17 @@ def main(): USERNAME = "" # Bot's username PASSWORD = "" # Bot's password SERVER = "" # Matrix server URL + global admins + + print("admins") + for admin in admins: + print(admin) if ('AUTH' in config): USERNAME = config['AUTH']['username'] # Bot's username PASSWORD = config['AUTH']['password'] # Bot's password SERVER = config['AUTH']['server'] # Matrix server URL + admins = config['AUTH']['admin'] # Admins du bot else: print("Probleme de lecture de configuration asmodee.ini")