generated from Nemesis/Exemple
vérif admin
This commit is contained in:
parent
7f656a5ea0
commit
b349d40311
1 changed files with 18 additions and 10 deletions
28
asmodee.py
28
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")
|
||||
|
||||
|
|
Loading…
Reference in a new issue